42 0 317KB
My requirement was to add a custom field in sales order item (VA01) that could be able to store Unique Product ID into it. Please follow the following steps to get your destination.
Step 1: Create a structure, mind it the structure must contain the field name starting with ZZ as shown below.
Step 2: Append that structure to VBAP table, because this table contains the Sales Order Item Data.
Step 3: Open program SAPMV45A from SE80 and go to screen 8459 and change the layout by adding your
required
Custom fields as shown below.
Do not write any codes in the PBO and PAI of this screen. Step 4: Open the program SAPMV45A from SE38 and open the INCLUDE MV45AFZZ. And write the following codes.
(a) **** Use this section to modify the custom table created by you, if required. FORM USEREXIT_SAVE_DOCUMENT. *** Write your own requirement here, if you want to store data in your Ztable. ENDFORM. (b) **** Use this section to prepare the line item before document is saved…* FORM USEREXIT_SAVE_DOCUMENT_PREPARE. DATA: zzprodid type XVBAP-ZZPRODID. CLEAR: zzprodid.LOOP AT XVBAP WHERE updkz = 'I'. zzprodid = zzprodid + 1. XVBAP-ZZPRODID = zzprodid. MODIFY XVBAP. ENDLOOP. ENDFORM.