Alexey Zhandarov написал:
Делал добавление позиций в заказ ТОРО BAPI_ALM_ORDER_MAINTAIN
Резервирование создаётся автоматически внутри BAPI. Резервирование есть всегда, даже у недеблокированных закзов
Выдержки из кода по заполнению структур. Правда у меня всё на одну операцию вешалось( <fs_components_new>-activity = '0010'.) но это уже детали.
[/code]
Спасибо за подсказку Алексей. Попробовал Ваш пример, материал действительно добавляется, но опять же не понятно как добавлять больше одного материала, пробовал сделать так
Code:
APPEND INITIAL LINE TO lt_components_new ASSIGNING FIELD-SYMBOL(<fs_components_new>).
<fs_components_new>-item_number = '0010'.
<fs_components_new>-material = '000000000201003348'. "ls_matdoc-matnr.
<fs_components_new>-batch = ''.
<fs_components_new>-item_cat = 'L' .
<fs_components_new>-requirement_quantity = '1'."ls_matdoc-menge.
<fs_components_new>-requirement_quantity_unit = 'KG'." ls_matdoc-meins.
<fs_components_new>-stge_loc = '0035'. "ls_matdoc-umlgo.
<fs_components_new>-activity = '0010'.
*
APPEND INITIAL LINE TO lt_components_up ASSIGNING FIELD-SYMBOL(<fs_components_up>).
<fs_components_up>-item_number = 'X'.
<fs_components_up>-material = 'X'.
<fs_components_up>-batch = 'X'.
<fs_components_up>-item_cat = 'X'.
<fs_components_up>-requirement_quantity = 'X'.
<fs_components_up>-requirement_quantity_unit = 'X'.
<fs_components_up>-stge_loc = 'X'.
<fs_components_up>-activity = 'X'.
APPEND INITIAL LINE TO lt_components_new ASSIGNING <fs_components_new>.
<fs_components_new>-item_number = '0020'.
<fs_components_new>-material = '000000000201014445'. "ls_matdoc-matnr.
<fs_components_new>-batch = ''.
<fs_components_new>-item_cat = 'L' .
<fs_components_new>-requirement_quantity = '1'."ls_matdoc-menge.
<fs_components_new>-requirement_quantity_unit = 'KG'." ls_matdoc-meins.
<fs_components_new>-stge_loc = '0035'. "ls_matdoc-umlgo.
<fs_components_new>-activity = '0010'.
APPEND INITIAL LINE TO lt_components_up ASSIGNING <fs_components_up>.
<fs_components_up>-item_number = 'X'.
<fs_components_up>-material = 'X'.
<fs_components_up>-batch = 'X'.
<fs_components_up>-item_cat = 'X'.
<fs_components_up>-requirement_quantity = 'X'.
<fs_components_up>-requirement_quantity_unit = 'X'.
<fs_components_up>-stge_loc = 'X'.
<fs_components_up>-activity = 'X'.
APPEND INITIAL LINE TO lt_methods ASSIGNING FIELD-SYMBOL(<lt_methods>).
<lt_methods>-refnumber = lv_num_row.
<lt_methods>-objecttype = 'COMPONENT'.
<lt_methods>-method = 'CREATE'.
<lt_methods>-objectkey = '9010038298'."lv_pm_order'.
APPEND INITIAL LINE TO lt_methods ASSIGNING <lt_methods>.
<lt_methods>-refnumber = lv_num_row.
<lt_methods>-method = 'SAVE'.
CALL FUNCTION 'BAPI_ALM_ORDER_MAINTAIN'
TABLES
it_methods = lt_methods
it_component = lt_components_new
it_component_up = lt_components_up
return = itab_return
ET_NUMBERS = itab_numbers.
call function 'BAPI_TRANSACTION_COMMIT'.
Добавляет только первый материал, второй игнорирует или тут надо запускать каждое добавление по одному материалу в заказ в цикле?