Application Development and Automation 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: 
Read only

BAPI_MATERIAL_SAVEDATA EXTENSIONIN BAPI_TE_MARC

Former Member
0 Likes
6,257

Dear experts,

I am using BAPI_MATERIAL_SAVEDATA in order to update certain fields from table MARC.

I would also like to update the custom fields, which are not updated by default.

In order to do this, I have to fill the EXTENSIONIN and EXTENSIONINX table parameters of the BAPI_MATERIAL_SAVEDATA.

My BAPI_TE_MARC structure is not maintained with all custom fields of the MARC table. My MARC table has the Z-fields in APPEND structures.

I have to mention that I would not like to update the structure BAPI_TE_MARC manually. My update solution has to work for every client and regardless of how many fields the customer may add in MARC as Z-fields, the extension of the BAPI_TE_MARC structure has to be done at runtime

Does the EXTENSIONIN-STRUCTURE (char30) require the name of the dictionary structure BAPI_TE_MARC, for example, or is it possible to create a structure at runtime with the name /NAMESPACE/BAPI_TE_MARC and pass it on to the EXTENSIONIN-STRUCTURE parameter?

Is it recommanded to change the BAPI_TE_MARC structure at runtime or to create a new /NAMESPACE/BAPI_TE_MARC structure at runtime with function module DDIF_TABL_PUT and DDIF_TABL_ACTIVATE? I can delete it later in the program with  DDIF_OBJECT_DELETE.


If the structure BAPI_TE_MARC has to be extended at runtime, how is that possible?


My MARC table has the Z-fields in APPEND structures. In both cases, how can I add the APPEND structures to my new/extended structure, as they are APPENDs, not INCLUDEs and can be used only once? By creating a new /NAMESPACE/BAPI_TE_MARC structure with the DDIF_TABL_PUT function, I can choose the names of my Z-fields from the DD03P_TAB table and create a new structure, but in order to activate the new structure I also need to add my namespace to every field /NAMESPACE/ZFIELD of the new structure. Would this not affect the update possibility of the custom fields in the function module, as the names of the custom fields differ from the actual MARC custom fields?


Also, is it possible to pass the EXTENSIONIN-STRUCTURE as a field symbol or somehow dynamically, without activating it in the dictionary in the first place? If yes, how?


Thank you for your help!


BR,

Matei

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,614

Hi Matei,

First, I have to be honest your post freaked me out. Seeing that you want play with DDIC structures at runtime and even more on this strutures is a bit crazy.

Could you maybe explain a little more what your goal is ?

If you want to update Z* fields in BAPI material, you have to extend both structures BAPI_TE_MARC and BAPI_TE_MARCX and use them in EXTENSIONIN and *X tables of BAPI.

I don't think that you can use a new one with namespace the value of STRUCTURE is used to determine where goes the values so your namespace will not be known by the BAPI.

Unless you make your own BAPI out of it. But good luck !

If your concern is to be sure that MARC and BAPI_TE_MARC are aligned with Z* field. APPEND a structure with the Z* fields in both of them. So even if you add fields in this structure in MARC you will also add it in BAPI_TE_MARC.

Note that you cannot do it in BAPI_TE_MARCX because this one is only composed of FLAG type fields with fieldname same as BAPI_TE_MARC (order of the fields is also important i think).

Dear experts,

I am using BAPI_MATERIAL_SAVEDATA in order to update certain fields from table MARC.

I would also like to update the custom fields, which are not updated by default.

In order to do this, I have to fill the EXTENSIONIN and EXTENSIONINX table parameters of the BAPI_MATERIAL_SAVEDATA.

My BAPI_TE_MARC structure is not maintained with all custom fields of the MARC table. My MARC table has the Z-fields in APPEND structures.

I have to mention that I would not like to update the structure BAPI_TE_MARC manually. My update solution has to work for every client and regardless of how many fields the customer may add in MARC as Z-fields, the extension of the BAPI_TE_MARC structure has to be done at runtime

Does the EXTENSIONIN-STRUCTURE (char30) require the name of the dictionary structure BAPI_TE_MARC, for example, or is it possible to create a structure at runtime with the name /NAMESPACE/BAPI_TE_MARC and pass it on to the EXTENSIONIN-STRUCTURE parameter?

Is it recommanded to change the BAPI_TE_MARC structure at runtime or to create a new /NAMESPACE/BAPI_TE_MARC structure at runtime with function module DDIF_TABL_PUT and DDIF_TABL_ACTIVATE? I can delete it later in the program with  DDIF_OBJECT_DELETE.


If the structure BAPI_TE_MARC has to be extended at runtime, how is that possible?


My MARC table has the Z-fields in APPEND structures. In both cases, how can I add the APPEND structures to my new/extended structure, as they are APPENDs, not INCLUDEs and can be used only once? By creating a new /NAMESPACE/BAPI_TE_MARC structure with the DDIF_TABL_PUT function, I can choose the names of my Z-fields from the DD03P_TAB table and create a new structure, but in order to activate the new structure I also need to add my namespace to every field /NAMESPACE/ZFIELD of the new structure. Would this not affect the update possibility of the custom fields in the function module, as the names of the custom fields differ from the actual MARC custom fields?


Also, is it possible to pass the EXTENSIONIN-STRUCTURE as a field symbol or somehow dynamically, without activating it in the dictionary in the first place? If yes, how?


Thank you for your help!


BR,

Matei

3 REPLIES 3
Read only

Former Member
0 Likes
3,615

Hi Matei,

First, I have to be honest your post freaked me out. Seeing that you want play with DDIC structures at runtime and even more on this strutures is a bit crazy.

Could you maybe explain a little more what your goal is ?

If you want to update Z* fields in BAPI material, you have to extend both structures BAPI_TE_MARC and BAPI_TE_MARCX and use them in EXTENSIONIN and *X tables of BAPI.

I don't think that you can use a new one with namespace the value of STRUCTURE is used to determine where goes the values so your namespace will not be known by the BAPI.

Unless you make your own BAPI out of it. But good luck !

If your concern is to be sure that MARC and BAPI_TE_MARC are aligned with Z* field. APPEND a structure with the Z* fields in both of them. So even if you add fields in this structure in MARC you will also add it in BAPI_TE_MARC.

Note that you cannot do it in BAPI_TE_MARCX because this one is only composed of FLAG type fields with fieldname same as BAPI_TE_MARC (order of the fields is also important i think).

Read only

0 Likes
3,614

Hi Mikaël,

Thank you for your quick reply!

I am looking for some kind of "engineering" in order to be able to update all fields of the MARC table. Not only the non-custom, and without any interaction needed from the customer part, like adding smth in BAPI_TE_MARC. Let's say the customer creates an APPEND structure with his Z-fields in the MARC table. He doesn't know he has to add it to the BAPI_TE_MARC, or simply forgets.

I want to avoid adding the append structure manually to BAPI_TE_MARC, which the customer has added to the MARC table, in order to avoid human error. So, if a new customer field is found in the MARC table, and is not in BAPI_TE_MARC, it should be added automatically, may it well be a new or the existent structure BAPI_TE_MARC.

From what you suggest, I understand it would be easier to adapt the BAPI_TE_MARC structure.

If that is the only solution, could you please suggest a function module on how to add an append structure to BAPI_TE_MARC at runtime, containing the new Z-field?

Or is there any other simplier way to update the custom fields?

Thank you for your help!

BR,

Matei

Read only

0 Likes
3,614

Ok Matei,

There is two things in your demand :

First, the target audience that is capable of adding new Z* fields into material tables is same as the one that should maintain the working structures of the BAPI. So  in a sens you are to much focusing on giving a fully automated solution. And understand that there no raison to put the fields and remove them after.

If the fields are in material tables they have to be and remains in tech structure of BAPI.

Second point is an automated solution :

This kind of functionnality exist in SAP for other structures like adding fields in COBL is done using a customizing transaction to add the fields "everywhere" needed in SAP (tables, structures, dynpro, etc.)

So if you want it, build it and yes at the end everything needs to be activated in DDIC to be fully operational.

Last thing :

Create a structure type with all your Z* fields.

create an append in both MARC and BAPI_TE_MARC, and include structure off Z* fields.

Then everytime you change your Z* fields structure both of them are updated.