Skip to Content
0
Former Member
May 14, 2008 at 01:02 AM

Dynamically Using BAPI_MATERIAL_SAVEDATA

81 Views

Greetings all,

I am trying to utilize BAPI_MATERIAL_SAVEDATA. This BAPI updates the material master. However I have a problem. I have an input file that holds the material number, the actual fieldname being updated, and the applicable data for that field (weird setup yes I know). The way this BAPI is setup, it seems like the importing parameter structures are all for specific material master tables (MARA, MARD, MARC, etc.). Within each of these importing parameters there are all the fields of each table, however they are named something different than the field itself, however the data element is the same (this can be seen by looking at the types of the import parameters).

My question is this: is it possible to take the input file specified above, and successfully use this BAPI? I will be updating both custom fields and standard SAP fields on the material master. However, these fields will NOT always be in MARA, so I must somehow tell the program 'depending on what field is coming in on each record of the input file, move the data to the appropriate import parameter structure on the BAPI (if it is a standard field, otherwise use the extension area of course under the TABLES section of the BAPI).

I would think a case statement checking for if the field exists in each table down the list on the BAPI import parameters since they correspond to the material master tables. However, I think there has got to be a better way to do this.

Im sure this isnt enough info for an answer but it is a start. Any ideas! Please Help!