‎2008 Mar 03 8:02 PM
Hello everyone,
I'm using BAPI_MATERIAL_SAVEREPLICA to create new materials.
My problem is the following:
We have extended the MARA table with multiple ZZ fields. I've already added that fields to the structure BAPI_TE_E1MARA.
When I execute my program, the material is created but the thing is that some ZZ fields get populated and some doesn't get populated.
- It doesn't has to do with "Group Selection Fields" because one of my ZZ fields doesn't has a "Group Selection" and still it get's populated.
I'm thinking that it has something to do with the "Lenght" of my MARA table. If i sum the "Internal lenght" of every field of the MARA table, I get to 1000 chars just in the middle of my ZZ fields. And guess what... The fields "before the position 1000" are populated and the fields "after the position 1000" are not populated.
Does anyone have a clue?
Thank you very much.
I will reward usefel answers.
Greetings,
Mariano.-
‎2008 Mar 04 4:45 AM
CAN YOU PLEASE NARRATE EACH AND EVERY STEP FROM THE BEGINNING . MAY BE WE CAN FIND OUT THE PROBLEM
‎2008 Mar 04 11:26 AM
* TOP
DATA: it_bapie1_header LIKE bapie1matheader OCCURS 0 WITH HEADER LINE,
it_bapie1_mara LIKE bapie1mara OCCURS 0 WITH HEADER LINE,
it_bapie1_marax LIKE bapie1marax OCCURS 0 WITH HEADER LINE,
it_bapie1_extensionin TYPE STANDARD TABLE OF bapie1parex,
it_bapie1_extensioninx TYPE STANDARD TABLE OF bapie1parexx,
wa_return LIKE bapiret2,
it_returnmessages LIKE bapie1ret2 OCCURS 0 WITH HEADER LINE.
-
* FORM fill_bapi_header.
DATA: wa_bapie1_header LIKE bapie1matheader.
wa_bapie1_header-material = '00000001'. " Material Number
wa_bapie1_header-basic_view = abap_true.
APPEND wa_bapie1_header TO it_bapie1_header.
-
* FORM fill_bapi_mara.
wa_bapie1_mara-function = 'INS'.
wa_bapie1_marax-function = 'INS'.
wa_bapie1_mara-material = '00000001'. " Material Number
wa_bapie1_marax-material = '00000001'. " Material Number
* Other fields of mara
wa_bapie1_mara-division = '02'.
wa_bapie1_marax-division = abap_true.
* etc....
APPEND wa_bapie1_mara TO it_bapie1_mara.
APPEND wa_bapie1_marax TO it_bapie1_marax.
-
* FORM fill_bapi_extensionin
DATA: wa_bapie1_extensionin TYPE bapie1parex,
wa_bapie1_extensioninx TYPE bapie1parexx.
DATA: wa_bapi_te_mara TYPE bapi_te_e1mara,
wa_bapi_te_marax TYPE bapi_te_e1marax.
DATA: v_valuepart_auxiliar(960),
v_valuepart_auxiliarx(960).
wa_bapi_te_mara-material = '00000001'. " Material Number
wa_bapi_te_marax-material = '00000001'. " Material Number
* ZZ Fields of the Table MARA
wa_bapi_te_mara-zzfield1 = 'Value1'.
wa_bapi_te_marax-zzfield1 = abap_true.
wa_bapi_te_mara-zzfield2 = 'Value2'.
wa_bapi_te_marax-zzfield2 = abap_true.
wa_bapi_te_mara-zzfield3 = 'Value3'.
wa_bapi_te_marax-zzfield3 = abap_true.
*
wa_bapie1_extensionin-structure = 'BAPI_TE_E1MARA'.
wa_bapie1_extensioninx-structure = 'BAPI_TE_E1MARAX'.
wa_bapie1_extensionin-function = 'INS'.
wa_bapie1_extensioninx-function = 'INS'.
wa_bapie1_extensionin-material = '00000001'. " Material Number
wa_bapie1_extensioninx-material = '00000001'. " Material Number
wa_bapie1_extensionin-valuepart1 = wa_bapi_te_mara.
wa_bapie1_extensioninx-valuepart1 = wa_bapi_te_marax.
APPEND wa_bapie1_extensionin TO it_bapie1_extensionin.
APPEND wa_bapie1_extensioninx TO it_bapie1_extensioninx.
-
CALL FUNCTION 'BAPI_MATERIAL_SAVEREPLICA'
EXPORTING
noappllog = ' '
nochangedoc = ' '
testrun = ''
inpfldcheck = ' '
IMPORTING
return = wa_return
TABLES
headdata = it_bapie1_header
clientdata = it_bapie1_mara
clientdatax = it_bapie1_marax
extensionin = it_bapie1_extensionin
extensioninx = it_bapie1_extensioninx
returnmessages = it_returnmessages.
-
ZZFIELD1 and ZZFIELD2 are updated.
ZZFIELD3 is not updated.
Thank you,
Please help,
Greetings.
‎2008 Mar 04 12:45 PM
Hi ,
The filed wa_bapie1_extensionin-valuepart1 is limited to 240 bytes only.
Can you check the length of the fields that you defined for zzfield1,zzfield2,zzfield3.
The sum of the fields in structure wa_bapi_te_mara should be equal to 240 characters.
If it is more than thta then the other fileds will not get populated.
Please check and let us know.
Regards,
sasi
‎2008 Mar 04 12:53 PM
Hello sasidhar,
The sum of the fields in structure wa_bapi_te_mara it's equal to 118 characters, including the material number.
Thank you,
Greetings,
Mariano.-
‎2008 Mar 04 1:17 PM
hI,
Can you copy the whole structure BAPI_TE_E1MARA here, all the fields details.
Regards,
sasi
‎2008 Mar 04 1:28 PM
Of Course, here it is, from trx SE11:
BAPI_TE_E1MARA
Component - Tp.Component - DataType - Length - Decimals - Short Descriptio
MATERIAL MATNR CHAR 18 0 Material Number
.APPEND ZABAPI_TE_E1MARA 0 0 Z Structure
ZZFIELD1 ZZFIELD1 CHAR 10 0 Description ZZFIELD1
ZZFIELD2 ZZFIELD2 CHAR 10 0 Description ZZFIELD2
ZZFIELD3 ZZFIELD3 CHAR 1 0 Description ZZFIELD3
ZZFIELD4 ZZFIELD4 CHAR 3 0 Description ZZFIELD4
ZZFIELD5 ZZFIELD5 CHAR 4 0 Description ZZFIELD5
ZZFIELD6 ZZFIELD6 NUMC 3 0 Description ZZFIELD6
ZZFIELD7 ZZFIELD7 CHAR 1 0 Description ZZFIELD7
ZZFIELD8 ZZFIELD8 NUMC 3 0 Description ZZFIELD8
ZZFIELD9 ZZFIELD9 CHAR 3 0 Description ZZFIELD9
ZZFIELD10 ZZFIELD10 CHAR 3 0 Description ZZFIELD10
ZZFIELD11 ZZFIELD11 CHAR 1 0 Description ZZFIELD11
ZZFIELD12 ZZFIELD12 NUMC 3 0 Description ZZFIELD12
ZZFIELD13 ZZFIELD13 CHAR 6 0 Description ZZFIELD13
ZZFIELD14 ZZFIELD14 CHAR 6 0 Description ZZFIELD14
ZZFIELD15 ZZFIELD15 CHAR 3 0 Description ZZFIELD15
ZZFIELD16 ZZFIELD16 CHAR 3 0 Description ZZFIELD16
ZZFIELD17 ZZFIELD17 DATS 8 0 Description ZZFIELD17
ZZFIELD18 ZZFIELD18 DATS 8 0 Description ZZFIELD18
ZZFIELD19 ZZFIELD19 CHAR 4 0 Description ZZFIELD19
ZZFIELD20 ZZFIELD20 LANG 1 0 Description ZZFIELD20
ZZFIELD21 ZZFIELD21 LANG 1 0 Description ZZFIELD21
ZZFIELD22 ZZFIELD22 CHAR 3 0 Description ZZFIELD22
ZZFIELD23 ZZFIELD23 CHAR 2 0 Description ZZFIELD23
ZZFIELD24 ZZFIELD24 CHAR 4 0 Description ZZFIELD24
ZZFIELD25 ZZFIELD25 CHAR 6 0 Description ZZFIELD25
‎2008 Mar 04 9:53 PM
Hello,
So (following the example) the thing is that ZZFIELD2 is not updated, it just has a "default" value that was the same as the one i was trying to update.
I change the "Group selection fields" of every ZZ field of the Mara Table, transport the order with SCC1 and it worked fine.
Thank you
Greetings.-