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: 

BAPI_MATERIAL_SAVEDATA field MARA-KZKFG not in ClientData

Former Member
0 Kudos
1,257

Hi There

I am using BAPI: BAPI_MATERIAL_SAVEDATA to create a material, it works properly, but I am unable to update field MARA-KZKFG, as it does not exist in BAPI_MARA, does anyone know of a way of updating this field using the BAPI?

Thanx

Tracy

1 ACCEPTED SOLUTION

Former Member
273

Hi,

Have you checked the flag CM_RELEVANCE_FLAG in the structure BAPI_MARA.

Regards,

sasi

8 REPLIES 8

Former Member
274

Hi,

Have you checked the flag CM_RELEVANCE_FLAG in the structure BAPI_MARA.

Regards,

sasi

Former Member
0 Kudos
273

Hi Sasi

Thanx for your help, but this updates the field MARA-CMREL.

Has anyone used BAPI_TE_MARA to update this field?

Thanx

Tracy

Message was edited by:

Tracy Tessendorf

Former Member
0 Kudos
273

if its not in BAPI_MARA then you have to use ExtensionIn table to populate this field.

In Extensionin Table you have to enter the following two fields

structure name "BAPI_TE_MARA" and

the values for all the fields in this structure in valuepart1 field.

Thanks,

Ganesh.

0 Kudos
273

Hi Ganesh

Thank you for your helpful answer.

Do you perhaps have an example of how to do this, as we have used this in the following way, but we get an ABAP dump saying that In this case, the sum of offset and length (=554) for the structure

"WA_BAPI_TE_MARA" exceeds the length of the character-type initial part (=537).

Source Code: it_extensionin-structure = 'BAPI_TE_MARA'.

it_extensionin-valuepart1 = is_bapi_te_mara.

APPEND it_extensionin.

it_extensioninx-structure = 'BAPI_TE_MARAX'.

it_extensioninx-valuepart1 = is_bapi_te_marax.

APPEND it_extensioninx.

Thanx

Tracy

0 Kudos
273

can you please tell me what is is_bapi_te_mara in your case. if the structure of bapi_te_mara is say

matnr (18), zfield1(10), zfield2(10)

Then it_extensionin-valuepart1 should have matnr in the first 18 char's and then zfield1 in the next 10 chars and zfield2 in the next 10 chars. so you should have filled the first 38 chars of valuepart1. In your case you dont need is_bapi_te_mara

you can just say

it_extensionin-valuepart1+0(18) = matnr.

it_extensionin_valuepart1+18(10) = zfield1

it_extensionin_valuepart1+28(10) = zfield2

append.

it should be something like this. Please try this and let me know if you still face any problems. Let me know the structure of bapi_te_mara.

Thanks.

0 Kudos
273

Hi There

Thank you for your helpful answer, this is how I have done it and it works in 4.6C, but not in ECC6. I get an ABAP dump, saying that DATA_UC_STRUCT_C_OFFSET_LENGTH.

Has anyone used this in ECC6?

Thanx.

Tracy

Message was edited by:

Tracy Tessendorf

0 Kudos
273

Can you please send me your code. I am working on ecc 6.0. I can try and let you know.

Thanks,

Ganesh.

0 Kudos
273

Hi Ganesh

Thanks so much for your help. Below is the code that I am using.

BAPI_TE_MARA looks like the following;

MATERIAL MATNR CHAR 18 0

.APPEND ZABAPI_TE_MARA 0 0 Missing fields fo

EXTWG EXTWG CHAR 18 0 Ext

ZZLSTATION1 ZLSTATION1 CHAR 13 0 Line

ZZLFEEDER1 ZLFEEDER1 CHAR 12 0 Line

FUNCTION z_mmc_local_material_create.

*"----


""Local interface:

*" IMPORTING

*" VALUE(SINGLE) TYPE CHAR1

*" VALUE(IV_UNAME) TYPE SYUNAME OPTIONAL

*" EXPORTING

*" VALUE(MESSAGE) TYPE ZCHAR150

*" TABLES

*" MATDATA STRUCTURE ZMMCLOCMM

*" EXCEPTIONS

*" ERROR

*"----


TABLES: zmmcuser. "DG28347E

TYPE-POOLS shlp.

  • Tables

TABLES: t9mmclocmm,

t9mmcuser,

t100,

z19ppl_mm_dat,

t134t,

t9mmclocmt,

z19sloccon.

  • Strutures and internal tables

DATA: is_headdata LIKE bapimathead,

is_clientdata LIKE bapi_mara,

is_clientdatax LIKE bapi_marax,

is_plantdata LIKE bapi_marc,

is_plantdatax LIKE bapi_marcx,

is_forecastparameters LIKE bapi_mpop,

is_forecastparametersx LIKE bapi_mpopx,

is_planningdata LIKE bapi_mpgd,

is_planningdatax LIKE bapi_mpgdx,

is_storagelocationdata LIKE bapi_mard,

is_storagelocationdatax LIKE bapi_mardx,

is_valuationdata LIKE bapi_mbew,

is_valuationdatax LIKE bapi_mbewx,

is_warehousenumberdata LIKE bapi_mlgn,

is_warehousenumberdatax LIKE bapi_mlgnx,

is_salesdata LIKE bapi_mvke,

is_salesdatax LIKE bapi_mvkex,

is_storagetypedata LIKE bapi_mlgt,

is_storagetypedatax LIKE bapi_mlgtx,

is_return LIKE bapiret2,

is_bapi_te_mara LIKE bapi_te_mara,

is_bapi_te_marax LIKE bapi_te_marax,

it_materialdescription LIKE bapi_makt

OCCURS 0

WITH HEADER LINE,

it_unitsofmeasure LIKE bapi_marm

OCCURS 0

WITH HEADER LINE,

it_unitsofmeasurex LIKE bapi_marmx

OCCURS 0

WITH HEADER LINE,

it_internationalartnos LIKE bapi_mean

OCCURS 0

WITH HEADER LINE,

it_materiallongtext LIKE bapi_mltx

OCCURS 0

WITH HEADER LINE,

it_taxclassifications LIKE bapi_mlan

OCCURS 0

WITH HEADER LINE,

it_returnmessages LIKE bapi_matreturn2

OCCURS 0

WITH HEADER LINE,

it_prtdata LIKE bapi_mfhm

OCCURS 0

WITH HEADER LINE,

it_prtdatax LIKE bapi_mfhmx

OCCURS 0

WITH HEADER LINE,

it_extensionin LIKE bapiparex

OCCURS 0

WITH HEADER LINE,

it_extensioninx LIKE bapiparexx

OCCURS 0

WITH HEADER LINE.

DATA: BEGIN OF it_error OCCURS 0,

uname LIKE t9mmcuser-uname,

cltprt LIKE z19ppl_mm_dat-cltprt,

prttx LIKE z19ppl_mm_dat-prttx,

message(150),

msgno(23),

END OF it_error.

DATA: BEGIN OF it_class OCCURS 0,

mtart LIKE t9mmclocmm-mtart,

traw LIKE t9mmclocmm-traw,

cltprt LIKE z19ppl_mm_dat-cltprt,

prttx LIKE z19ppl_mm_dat-prttx,

END OF it_class.

DATA: BEGIN OF it_mmflag OCCURS 0,

cltprt LIKE z19ppl_mm_dat-cltprt,

mmflag LIKE z19ppl_mm_dat-mmflag,

END OF it_mmflag.

DATA: BEGIN OF it_extend OCCURS 0.

INCLUDE STRUCTURE zmmclocmm.

DATA: END OF it_extend.

  • BDC Data

DATA: BEGIN OF it_bdctab OCCURS 30.

INCLUDE STRUCTURE bdcdata.

DATA: END OF it_bdctab.

  • Data returned from transaction

DATA: BEGIN OF it_trn_ret OCCURS 10.

INCLUDE STRUCTURE bdcmsgcoll.

DATA: END OF it_trn_ret.

  • Email

DATA: BEGIN OF it_mail_text OCCURS 0.

INCLUDE STRUCTURE solisti1.

DATA: END OF it_mail_text.

  • Storage location and warehouse data

DATA: BEGIN OF it_whse OCCURS 0,

cltprt LIKE zmmclocmm-cltprt,

lgnum LIKE z19sloccon-lgnum,

END OF it_whse.

DATA: BEGIN OF it_sloc OCCURS 0,

cltprt LIKE zmmclocmm-cltprt,

lgort LIKE z19sloccon-lgort,

END OF it_sloc.

DATA: BEGIN OF it_lgnum OCCURS 0,

lgnum LIKE z19sloccon-lgnum,

END OF it_lgnum.

DATA: BEGIN OF it_lgort OCCURS 0,

lgort LIKE z19sloccon-lgort,

END OF it_lgort.

DATA: BEGIN OF it_sloc_extend OCCURS 0.

INCLUDE STRUCTURE zmmclocmm.

DATA: END OF it_sloc_extend.

  • Start of Insert TT67507

DATA: BEGIN OF it_qm OCCURS 0,

matnr LIKE mara-matnr,

werks LIKE marc-werks,

END OF it_qm.

  • End of Insert TT67507

DATA: v_slin TYPE i,

v_wlin TYPE i,

v_index TYPE i,

v_lgort LIKE z19sloccon-lgort,

v_lgnum LIKE z19sloccon-lgnum.

  • Work fields

DATA: v_ermsg(500),

v_subrc LIKE sy-subrc,

v_mode,

v_mail_subject LIKE sodocchgi1-obj_descr,

v_email LIKE sadrud,

v_single,

v_message TYPE zchar150,

v_mtart LIKE t9mmclocmt-mtart,

v_traw LIKE t9mmclocmt-traw,

v_skip,

v_hold_cltprt LIKE z19ppl_mm_dat-cltprt.

  • Constants

CONSTANTS: co_mark VALUE 'X',

co_klart LIKE rmclf-klart VALUE '001',

  • co_class1 LIKE rmclf-class VALUE 'PARTNUM', "DK69475E

  • co_class2 LIKE rmclf-class VALUE 'L/STATION', "DK69475E

co_ssqss(4) VALUE '0001', "TT67505

co_insp1(2) VALUE '01', "TT67505

co_insp2(2) VALUE '08'. "TT67505

CHECK NOT matdata[] IS INITIAL.

v_single = single.

CLEAR: it_class,

it_error,

message,

v_message,

it_extend,

v_hold_cltprt.

REFRESH: it_class,

it_error,

it_extend,

it_sloc,

it_whse,

it_sloc_extend.

LOOP AT matdata.

  • Get default data

SELECT SINGLE * FROM t9mmclocmm

WHERE mtart = matdata-mtart

AND traw = matdata-traw.

IF sy-subrc NE 0.

IF v_single = space.

SELECT uname INTO t9mmcuser-uname

FROM t9mmcuser WHERE mtart = matdata-mtart

AND traw = matdata-traw.

CLEAR it_error.

it_error-uname = t9mmcuser-uname.

it_error-cltprt = matdata-cltprt.

it_error-prttx = matdata-prttx.

CONCATENATE 'Table T9MMCLOCMM not maintained for'

matdata-mtart

matdata-traw

INTO it_error-message SEPARATED BY space.

APPEND it_error.

ENDSELECT.

ELSE.

CONCATENATE 'Table T9MMCLOCMM not maintained for'

matdata-mtart

matdata-traw

INTO v_message SEPARATED BY space.

ENDIF.

CONTINUE.

ENDIF.

  • Extract storage location and warehouse data

CLEAR: v_lgort,

v_lgnum.

PERFORM fm_sloc_whse_data USING matdata-cltprt

matdata-prttx.

IF t9mmclocmm-lgort NE space.

v_lgort = t9mmclocmm-lgort.

ENDIF.

  • Initialise

CLEAR: is_headdata,

is_clientdata,

is_clientdatax,

it_materialdescription,

it_taxclassifications,

is_plantdata,

is_plantdatax,

is_forecastparameters,

is_forecastparametersx,

is_storagelocationdata,

is_storagelocationdatax,

is_valuationdata,

is_valuationdatax,

is_warehousenumberdata,

is_warehousenumberdatax,

is_salesdata,

is_salesdatax,

is_bapi_te_mara,

is_bapi_te_marax,

it_extensionin,

it_extensioninx,

is_return,

it_mail_text.

REFRESH: it_materialdescription,

it_taxclassifications,

it_extensionin,

it_extensioninx,

it_mail_text.

  • Fill BAPI structures

is_headdata-material_external = matdata-cltprt.

is_headdata-ind_sector = t9mmclocmm-mbrsh.

is_headdata-matl_type = t9mmclocmm-mtart.

is_headdata-basic_view = co_mark.

is_headdata-sales_view = co_mark.

is_headdata-purchase_view = co_mark.

is_headdata-mrp_view = co_mark.

is_headdata-storage_view = co_mark.

is_headdata-warehouse_view = co_mark.

is_headdata-quality_view = co_mark.

is_headdata-account_view = co_mark.

is_headdata-cost_view = co_mark.

IF t9mmclocmm-prmod NE space.

is_headdata-forecast_view = co_mark.

ENDIF.

  • Basic data

IF t9mmclocmm-meins = space.

is_clientdata-base_uom = matdata-meins.

ELSE.

is_clientdata-base_uom = t9mmclocmm-meins.

ENDIF.

is_clientdata-matl_group = t9mmclocmm-matkl.

is_clientdata-division = t9mmclocmm-spart.

is_clientdatax-base_uom = co_mark.

is_clientdatax-matl_group = co_mark.

is_clientdatax-division = co_mark.

  • PANDA

IF t9mmclocmm-traw = 'P1'.

is_clientdata-trans_grp = t9mmclocmm-tragr.

is_clientdatax-trans_grp = co_mark.

ENDIF.

  • Quality

is_clientdata-qm_procmnt = co_mark. "TT67507

is_clientdatax-qm_procmnt = co_mark. "TT67505

is_plantdata-ctrl_key = co_ssqss. "TT67507

is_plantdatax-ctrl_key = co_mark. "TT67507

  • Description data

it_materialdescription-langu = 'E'.

it_materialdescription-matl_desc = matdata-prttx.

APPEND it_materialdescription.

  • Tax classifications for PANDA

IF t9mmclocmm-traw = 'P1'.

CLEAR it_taxclassifications.

it_taxclassifications-depcountry = t9mmclocmm-aland.

it_taxclassifications-tax_type_1 = t9mmclocmm-tatyp.

it_taxclassifications-taxclass_1 = t9mmclocmm-taxkm.

APPEND it_taxclassifications.

ENDIF.

  • Country of origin for XP via ZMMCM

IF v_single NE space

AND t9mmclocmm-traw = 'XP'

AND t9mmclocmm-herkl = space.

t9mmclocmm-herkl = matdata-herkl.

ENDIF.

  • Plant data

is_plantdata-plant = t9mmclocmm-werks.

is_plantdata-profit_ctr = t9mmclocmm-prctr.

is_plantdata-pur_group = t9mmclocmm-ekgrp.

is_plantdata-pur_status = t9mmclocmm-mmsta.

is_plantdata-comm_code = t9mmclocmm-stawn.

is_plantdata-countryori = t9mmclocmm-herkl.

is_plantdata-pvalidfrom = sy-datum. "mmstd

is_plantdata-sloc_exprc = t9mmclocmm-lgfsb.

is_plantdata-mrpprofile = t9mmclocmm-dispr.

is_plantdata-mrp_ctrler = t9mmclocmm-dispo.

is_plantdata-lotsizekey = t9mmclocmm-disls.

is_plantdatax-plant = t9mmclocmm-werks.

is_plantdatax-profit_ctr = co_mark.

is_plantdatax-pur_group = co_mark.

is_plantdatax-pur_status = co_mark.

is_plantdatax-comm_code = co_mark.

is_plantdatax-countryori = co_mark.

is_plantdatax-pvalidfrom = co_mark.

is_plantdatax-sloc_exprc = co_mark.

is_plantdatax-mrpprofile = co_mark.

is_plantdatax-mrp_ctrler = co_mark.

is_plantdatax-lotsizekey = co_mark.

  • PANDA

IF t9mmclocmm-traw = 'P1'.

is_plantdata-loadinggrp = t9mmclocmm-ladgr.

is_plantdata-gr_pr_time = t9mmclocmm-webaz.

is_plantdata-specprocty = t9mmclocmm-sobsk.

is_plantdata-dep_req_id = t9mmclocmm-sbdkz.

is_plantdatax-loadinggrp = co_mark.

is_plantdatax-gr_pr_time = co_mark.

is_plantdatax-specprocty = co_mark.

is_plantdatax-dep_req_id = co_mark.

ENDIF.

  • Forecast data

IF t9mmclocmm-prmod NE space.

is_forecastparameters-plant = t9mmclocmm-werks.

is_forecastparameters-fore_model = t9mmclocmm-prmod.

is_forecastparametersx-plant = t9mmclocmm-werks.

is_forecastparametersx-fore_model = co_mark.

ENDIF.

  • Storage location data

IF t9mmclocmm-traw = 'P1' " PANDA

OR v_lgort NE space.

is_storagelocationdata-plant = t9mmclocmm-werks.

is_storagelocationdata-stge_loc = v_lgort.

is_storagelocationdatax-plant = t9mmclocmm-werks.

is_storagelocationdatax-stge_loc = v_lgort.

ENDIF.

  • Valuation data

is_valuationdata-val_area = t9mmclocmm-werks.

is_valuationdata-val_type = space.

is_valuationdata-val_class = t9mmclocmm-bklas.

is_valuationdata-orig_group = t9mmclocmm-hrkft.

is_valuationdatax-val_area = t9mmclocmm-werks.

is_valuationdatax-val_type = space.

is_valuationdatax-val_class = co_mark.

is_valuationdatax-orig_group = co_mark.

  • Warehouse data

IF v_lgnum NE space.

is_warehousenumberdata-whse_no = v_lgnum.

is_warehousenumberdatax-whse_no = v_lgnum.

ENDIF.

  • Sales data for PANDA

IF t9mmclocmm-traw = 'P1'.

is_salesdata-sales_org = t9mmclocmm-vkorg.

is_salesdata-distr_chan = t9mmclocmm-vtweg.

is_salesdata-delyg_plnt = t9mmclocmm-dwerk.

is_salesdata-item_cat = t9mmclocmm-mtpos.

is_salesdatax-sales_org = t9mmclocmm-vkorg.

is_salesdatax-distr_chan = t9mmclocmm-vtweg.

is_salesdatax-delyg_plnt = co_mark.

is_salesdatax-item_cat = co_mark.

ENDIF.

  • Additional data

is_bapi_te_mara-material = matdata-cltprt.

is_clientdata-extmatlgrp = t9mmclocmm-extwg.

is_bapi_te_mara-kzkfg = t9mmclocmm-kzkfg.

is_bapi_te_marax-material = matdata-cltprt.

is_clientdatax-extmatlgrp = co_mark.

is_bapi_te_marax-kzkfg = co_mark.

it_extensionin-structure = 'BAPI_TE_MARA'.

it_extensionin-valuepart1+0(18) = matdata-cltprt.

it_extensionin-valuepart1+18(18) = 'NEW TEST'.

APPEND it_extensionin.

it_extensioninx-structure = 'BAPI_TE_MARAX'.

it_extensioninx-valuepart1+0(18) = matdata-cltprt.

it_extensioninx-valuepart1+18(1) = 'X'.

APPEND it_extensioninx.

  • Call BAPI

CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'

EXPORTING

headdata = is_headdata

clientdata = is_clientdata

clientdatax = is_clientdatax

plantdata = is_plantdata

plantdatax = is_plantdatax

forecastparameters = is_forecastparameters

forecastparametersx = is_forecastparametersx

planningdata = is_planningdata

planningdatax = is_planningdatax

storagelocationdata = is_storagelocationdata

storagelocationdatax = is_storagelocationdatax

valuationdata = is_valuationdata

valuationdatax = is_valuationdatax

warehousenumberdata = is_warehousenumberdata

warehousenumberdatax = is_warehousenumberdatax

salesdata = is_salesdata

salesdatax = is_salesdatax

storagetypedata = is_storagetypedata

storagetypedatax = is_storagetypedatax

IMPORTING

return = is_return

TABLES

materialdescription = it_materialdescription

unitsofmeasure = it_unitsofmeasure

unitsofmeasurex = it_unitsofmeasurex

internationalartnos = it_internationalartnos

materiallongtext = it_materiallongtext

taxclassifications = it_taxclassifications

returnmessages = it_returnmessages

prtdata = it_prtdata

prtdatax = it_prtdatax

extensionin = it_extensionin

extensioninx = it_extensioninx.

Message was edited by:

Tracy Tessendorf