If you wish to edit a Material, you can use the following BAPI.
BAPI_MATERIAL_EDIT
The above mentioned BAPI makes use of CALL TRANSACTION MM02 or MM42 to edit the MATERIAL. The selection of the appropriate transaction is made based on the entered material. The table MAW1 is checked for the existence of material, if the material exists in MAW1 then the transaction MM02 is called else transaction MM42 is called.
BAPI_MATERIAL_EDIT in turn calls the following function modules.
BAPI_MATERIAL_EXISTENCECHECK and CONVERSION_EXIT_MATN1_OUTPUT
The user is then presented with the change material screen either for MM02 or MM42.
The code below shows the values of the input parameters for the BAPI BAPI_MATERIAL_EDI
REPORT ZEX_CHANGEMAT .
Parameters: p_matnr like BAPIMATALL-MATERIAL, p_fscrn like BAPIMATALL-SKIP_1ST_SCREEN.
Data: d_ret like BAPIRET1.
CALL FUNCTION 'BAPI_MATERIAL_EDIT' EXPORTING MATERIAL = p_matnr SKIP_1ST_SCREEN = p_fscrn IMPORTING RETURN = d_ret .
Always use Pretty Printer and Extended Program Check before releasing the code.
Do not leave unused code in the program. Comment the code thoroughly. Align the comments and the Code. Follow the SAP Standards and SAP Best Practices guidelines. It’s a good practice to take a dump of the code on your local drive.
No comments:
Post a Comment