Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Standard BAPI BAPI_GOODSMVT_CREATE Header Custom fields add for custom table

hossain_rajib55
Participant
0 Kudos
544

Hello Expert!!!

Need to add zfields in the header portion as per business requirement. I want to make a copy of "BAPI_GOODSMVT_CREATE" to ''ZBAPI_GOODSMVT_CREATE''. In the header portion 3 custom fields need to add.

Function group MB_BUS2017 copy as ZMB_BUS2017.For Function module am I give Z against all old function module. Please guided me step by step guideline to complete the task or any link.

Customs fields data kept in Ztable. Using BAPI ZBAPI_GOODSMVT_CREATE user complete GRN from Apps.

Am I copy standard BAPI and create a ZBAPI or using standard BAPI added custom fields to BAPI2017_GM_HEAD_01 (which is added in header portion in mIGO).

Need guideline to complete the job.

Custom fields in MIGO:

hossain_rajib55_0-1738659220031.png

Custom Tables where data saved:

hossain_rajib55_1-1738659275544.png

Thanks in advance.

Regards-
Rajib

 

 

 

9 REPLIES 9

raymond_giuseppi
Active Contributor
523

Why didn't you use the EXTENSIONIN parameter of the BAPI and process this data with an implementation of MB_BAPI_GOODSMVT_CREATE as described in the BAPI documentation?

  • Look at the sample implementation BAdI CL_EX_IM_MB_BAPI_GOODSMVT_CRE, which processes structures BAPI_TE_XMKPF and BAPI_TE_XMSEG.
  • Ensure that customer fields appended to tables MKPF and MSEG are also appended to structures IMKPF and IMSEG (see BAdI documentation).

NB: Copying/modifying standard code is usually (always) bad practice, apart from the risk of database discrepancies, it will cause problems with any patch or upgrade.

0 Kudos
497

I am using a custom table where custom fields data saved. Is this possible for that case.

478

Yes, you should be able to handle this table in the BAdI, don't pass data back to the main program structures, but store it to process it later, at commit work, when the document number is calculated. You should have already done this in MIGO.

0 Kudos
371

Using BAPI user process it through third party apps. Could you please guided me step by step process to complete the task. From MIGO its working fine.I need to provide them BAPI to do GRN .

0 Kudos
332

Create the BAdI implementation and ask them to use the standard BAPI, giving them the structure name and data to pass to the EXTENSIONIN parameter.

Of course, you could create a Z-BAPI, but not as a copy of the standard. but as a wrapper of the standard BAPI to simplify their process (your Z-BAPI will map additional data to extensionin).

0 Kudos
86

@raymond_giuseppithanks for the way you showing to solve. I did it , just one things is pending now i keep that data into a temporary table now i need material documents number and year to save the ztable. Could you please guided me to fetch the data.In migo i did it at POST_DOCUMENT stage creating a z enhancement spot. For BADI where I can do it.

hossain_rajib55_0-1739255607842.pnghossain_rajib55_1-1739255668214.png

 

0 Kudos
59

The item document numbers are returned at the end of the BAPI (after the MB_POST_GOODS_MOVEMENT form has been run).
and so must have been calculated beforehand.

  • As I've always added my ZZ fields at the end of the standard tables, I've never had to solve this problem.
  • You could try to debug BAPI execution, defining a watchpoint on variable XMKPF-MBLNR or a break-point in  FM NUMBER_GET_NEXT ?
  • or you could use some PERFORM ON COMMIT and some assign to XMKPF record 1

Sandra_Rossi
Active Contributor
442

Never ever copy standard code, as explained in the SAP note 213751 - Programs: Copying versus modification - SAP for Me.

437

The 11th crime of Top 10 ABAP crimes 😎