Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Update user defined fields in MARA using bapi_material_savedata

Hi,

I have this problem:

I am creating materials from a Z table filled by another application (not SAP). I am using the bapi "bapi_material_savedata" to create the materials and it is working fine. But now I need to fill user defined fields in the MARA table from this Z table, and this fields, are not filled after using the bapi.

I am using the bapi tables "extensionin" and "extensioninx".

I have modified the BAPI_TE_MARA structure adding the ZZ fields of the MARA and the BAPI_TE_MARAX structure with the same fields but different data elements. So I have this structures/tables:

BAPI_TE_MARA:

MATERIAL - MATNR

ZZDIM1 - ZZCHDIM1

ZZDIM2 - ZZCHDIM2

ZZDIM3 - ZZCHDIM3

BAPI_TE_MARAX:

MATERIAL - MATNR

ZZDIM1 - BAPIUPDATE

ZZDIM2 - BAPIUPDATE

ZZDIM3 - BAPIUPDATE

MARA:

..(standard fields of the MARA)....

ZZDIM1 - ZZCHDIM1

ZZDIM2 - ZZCHDIM2

ZZDIM3 - ZZCHDIM3

Here is the code that i'm using to update the extensionin and extensioninx tables:

DATA x_bapi_te_mara TYPE bapi_te_mara.
  DATA x_bapi_te_marax TYPE bapi_te_marax.

  it_extensionin-structure = 'BAPI_TE_MARA'.
  it_extensioninx-structure = 'BAPI_TE_MARAX'.

* the internal table it_material contains the data of the
* ZZ fields
  MOVE-CORRESPONDING it_material TO x_bapi_te_mara.
  x_bapi_te_mara-material = it_material-matnr.

  x_bapi_te_marax-material = it_material-matnr.
  x_bapi_te_marax-zzdim1 = 'X'.
  x_bapi_te_marax-zzdim2 = 'X'.
  x_bapi_te_marax-zzdim3 = 'X'.

  it_extensionin-valuepart1 = x_bapi_te_mara.
  APPEND it_extensionin.

  it_extensioninx-valuepart1 = x_bapi_te_marax.
  APPEND it_extensioninx.

Also i have an entry in the table T130F that i'm not sure i need.

Please help me to fill this user defined fields !!

Regards,

Jesus

Tags:
Former Member
Not what you were looking for? View more on this topic or Ask a question