In SAP ABAP you can create a Material using a BAPI. To do so you first need to get the Next Material Number. This can be obtained by using the following BAPI.
To create a Material in SAP using a BAPI you need to use the following 2 BAPIs
BAPI_MATERIAL_GETINTNUMBER
BAPI_MATERIAL_SAVEDATA
If you are suing the transaction MM01 to create a Material, you can see the Material Number being assigned automatically. If you have not noticed this please run the transaction MM01 and enter the values in the initial screen. After hitting enter you will see the Material Number appear in the next screen automatically.
Let us now see the parameters that need to be passed to the BAPI BAPI_MATERIAL_GETINTNUMBER.
The Mandatory Parameters that need to be passed to the BAPI are as follows.
Material Type Industry Sector Required Numbers
Enter the desired values and generate the Next Material Number. Once you obtain the Material Number, you then need to pass this number to the following BAPI.
BAPI to create Material in SAP
BAPI_MATERIAL_SAVEDATA
The following program demonstrates the BAPI BAPI_MATERIAL_GETINTNUMBER
REPORT ZEX_GETMATNUM .
Parameters: p_matype like BAPIMATDOA-MATL_TYPE, p_indsr like BAPIMATDOA-IND_SECTOR, p_reqnum like BAPIMATALL-REQ_NUMBERS.
Material Type HAWA Industry Sector C Required Numbers 1
See Also: SAP ABAP Creating a Material using a BAPI Part 2 ____________________________________________________________________________________________________________________________________________________________________
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