2023 Sep 04 5:59 AM
Which BAPI to call to change MARC's CONS_PROCG (Consignment Control)?
DATA:
lt_plantdata TYPE TABLE OF bapie1marcrt WITH HEADER LINE,
lt_plantdatax TYPE TABLE OF bapie1marcrtx WITH HEADER LINE,
lv_function TYPE bapie1mathead-function,
ls_headdata LIKE bapie1mathead,
ls_return LIKE bapireturn1,
lt_store TYPE TABLE OF znmmms_mm001_dc,
ls_store TYPE znmmms_mm001_dc,
lt_input TYPE TABLE OF znmmms_mm001_input,
ls_input TYPE znmmms_mm001_input.
LOOP AT i_item.
CLEAR: ls_headdata, lt_plantdata, lt_plantdatax, ls_return.
CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
EXPORTING
input = i_item-matnr
IMPORTING
output = i_item-matnr
EXCEPTIONS
length_error = 1
OTHERS = 2.
ls_headdata-material = i_item-matnr.
ls_headdata-logst_view = 'X'.
ls_headdata-logdc_view = 'X'.
* ls_headdata-function = '004'.
lv_function = '004'.
* lt_plantdata-function = lv_function.
lt_plantdata-material = i_item-matnr. "Material code
lt_plantdata-plant = i_item-plant.
IF i_item-cons <> 'X'.
lt_plantdata-consignment_control = 3.
ENDIF.
APPEND lt_plantdata.
lt_plantdatax-function = lv_function.
lt_plantdatax-material = i_item-matnr. "Material code
lt_plantdatax-plant = i_item-plant.
IF i_item-cons <> 'X'.
lt_plantdatax-consignment_control = 'X'.
ENDIF.
APPEND lt_plantdatax.
ls_store-matnr = i_item-matnr.
ls_store-werks = i_item-plant.
ls_store-cons_procg = i_item-cons.
APPEND ls_store TO lt_store.
ls_input-matnr = i_item-matnr.
APPEND ls_input TO lt_input.
CALL FUNCTION 'BAPI_MATERIAL_MAINTAINDATA_RT'
EXPORTING
headdata = ls_headdata
IMPORTING
return = ls_return
TABLES
plantdata = lt_plantdata
planningdatax = lt_plantdatax.
IF ls_return-type EQ 'E' OR ls_return-type EQ 'A'.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
ENDIF.
ENDLOOP.
2023 Sep 04 6:00 AM
Welcome to the SAP Community. Thank you for visiting us to get answers to your questions.
Since you're asking a question here for the first time, I'd like to offer some friendly advice on how to get the most out of your community membership and experience.
First, please see https://community.sap.com/resources/questions-and-answers, as this resource page provides tips for preparing questions that draw responses from our members. Second, feel free to take our Q&A tutorial at https://developers.sap.com/tutorials/community-qa.html, as that will help you when submitting questions to the community.
I also recommend that you include a profile picture. By personalizing your profile, you encourage readers to respond: https://developers.sap.com/tutorials/community-profile.html.
Now for some specific suggestions on how you might improve your question:
* Outline what steps you took to find answers (and why they weren't helpful) -- so members don't make suggestions that you've already tried.
* Share screenshots of what you've seen/done (if possible), as images always helps our members better understand your problem.
Should you wish, you can revise your question by selecting Actions, then Edit.
The more details you provide (in questions tagged correctly), the more likely it is that members will be able to respond.
I hope you find this advice useful, and we're happy to have you as part of SAP Community!