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: 

Best practice for updating custom fields of standard table after a BAPI

kjyothiraditya
Participant
0 Kudos
3,543

Hi experts,

I have to update a dynamic set of custom fields of a standard table- qmel. I am using bapi_qualnot_create/change in which the parameters doesn't have all the fields of qmel table. So I have to update the custom fields of qmel dynamically as when the value is available. I would be getting the values in idoc with structure tabname, fieldname and value which would be repeating.

Any suggestions on the best way to dynamically update these fields ??

Also can I update field by field in a loop and do commit work outside the loop?

5 REPLIES 5

Gourab_Dey
Contributor
956

The best practice is to use "BAPI extension". Below are the link for the same.

https://blogs.sap.com/2014/06/24/bapi-extension-for-customer-added-fields/

Thanks,

Gourab

0 Kudos
956

Hi Gaurav,

This is the scenario where the BAPI has the provision of extension parameters. In my case, I do not have such.

Also, the BAPI doesn't have the exact structure as the db table.

Thanks and regards

Aditya

Gourab_Dey
Contributor
0 Kudos
956

Hi jyothir aditya k,

Please share the name of the BAPI.

Thanks,

Gourab

0 Kudos
956

bapi_qualnot_create/change

0 Kudos
956

Just want to give idea. In past I have done it for one of the BAPI. I am assuming the custom fields are added in header table in the notification. So, you can proceeds as below:

  • Append the structure "BAPI2078_NOTHDRI" with custom field. This is the structure for importing parameter "notifheader".
  • FM "QQM_MAP_EXT_TO_INT" is called inside the BAPI "BAPI_QUALNOT_CREATE". The FM takes "notifheader" as importing parameter. So the value of custom field will be propagated to this automatically
  • The FM has a Exporting parameter "f_riqs5". Append the structure with custom field. Create a implicit enhancement in FM "QQM_MAP_EXT_TO_INT" in the end and assign the custom field values from NOTIFHEADER to "F_RIQS5.
  • Commit the BAPI and check the values in custom field. It may work.

This scenario I mentioned for custom fields in header table. If you have custom fields in item table as well, then check for similar opportunity for enhance. It may work. Done similarly for one of the BAPI in past and it worked.

Thanks,

Gourab