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

problem with BAPI_MATERIAL_MAINTAINDATA_RT

Former Member
0 Likes
5,434

Hi everybody,

I need to create new material (plant data) from reference Material(Plant).

I selected all the data and passed to the BAPI BAPI_MATERIAL_MAINTAINDATA_RT to create NEW site material.

Material getting created in MARC , out of 14 fields 3 fields are not getting created in the system .the fields are mentioned below.

wa_bapie1marcrt-d_to_ref_m = it_mara_marc-vrbdt.

wa_bapie1marcrt-mult_ref_m = it_mara_marc-vrbfk.

wa_bapie1marcrt-refpltcons = it_mara_marc-vrbwk.

The code i had written is as follows.

LOOP AT it_mara_marc.

CLEAR wa_bapie1marcrt.

wa_bapie1mathead-material = it_mara_marc-matnr.

wa_bapie1mathead-matl_type = it_mara_marc-mtart.

wa_bapie1mathead-matl_group = it_mara_marc-matkl.

wa_bapie1mathead-matl_cat = it_mara_marc-attyp.

wa_bapie1mathead-logst_view = 'X'.

wa_bapie1mathead-no_appl_log = 'X'.

wa_bapie1mathead-ref_matl = it_mara_marc-vrbmt.

  • APPEND wa_bapie1mathead.

CLEAR wa_bapie1marcrt.

REFRESH gi_bapie1marcrt.

wa_bapie1marcrt-material = it_mara_marc-matnr.

wa_bapie1marcrt-plant = p_nsite.

wa_bapie1marcrt-abc_id = it_mara_marc-maabc.

wa_bapie1marcrt-mrp_type = it_mara_marc-dismm.

wa_bapie1marcrt-mrp_ctrler = it_mara_marc-dispo.

wa_bapie1marcrt-plnd_delry = it_mara_marc-plifz.

wa_bapie1marcrt-sup_source = it_mara_marc-bwscl.

wa_bapie1marcrt-round_prof = it_mara_marc-rdprf.

wa_bapie1marcrt-pur_status = it_mara_marc-mmsta.

wa_bapie1marcrt-pvalidfrom = it_mara_marc-mmstd.

wa_bapie1marcrt-refmatcons = it_mara_marc-vrbmt.

wa_bapie1marcrt-d_to_ref_m = it_mara_marc-vrbdt.

wa_bapie1marcrt-mult_ref_m = it_mara_marc-vrbfk.

wa_bapie1marcrt-refpltcons = it_mara_marc-vrbwk.

APPEND wa_bapie1marcrt TO gi_bapie1marcrt.

CLEAR wa_bapie1marcrtx.

REFRESH gi_bapie1marcrtx.

wa_bapie1marcrtx-material = 'X'.

wa_bapie1marcrtx-plant = 'X'.

wa_bapie1marcrtx-abc_id = 'X'.

wa_bapie1marcrtx-mrp_type = 'X'.

wa_bapie1marcrtx-mrp_ctrler = 'X'.

wa_bapie1marcrtx-plnd_delry = 'X'.

wa_bapie1marcrtx-sup_source = 'X'.

wa_bapie1marcrtx-round_prof = 'X'.

wa_bapie1marcrtx-pur_status = 'X'.

wa_bapie1marcrtx-pvalidfrom = 'X'.

wa_bapie1marcrtx-refmatcons = 'X'.

wa_bapie1marcrtx-refpltcons = 'X'.

wa_bapie1marcrtx-d_to_ref_m = 'X'.

wa_bapie1marcrtx-mult_ref_m = 'X'.

APPEND wa_bapie1marcrtx TO gi_bapie1marcrtx.

CALL FUNCTION 'BAPI_MATERIAL_MAINTAINDATA_RT'

EXPORTING

headdata = wa_bapie1mathead

IMPORTING

return = bapi_return1

TABLES

    • VARIANTSKEYS =

    • CHARACTERISTICVALUE =

    • CHARACTERISTICVALUEX =

    • CLIENTDATA =

    • CLIENTDATAX =

    • CLIENTEXT =

    • CLIENTEXTX =

    • ADDNLCLIENTDATA =

    • ADDNLCLIENTDATAX =

    • MATERIALDESCRIPTION =

plantdata = gi_bapie1marcrt

plantdatax = gi_bapie1marcrtx

    • PLANTEXT =

    • PLANTEXTX =

.

IF bapi_return1-type = 'S'.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = ' '

IMPORTING

return = bapi_return2.

  • CLEAR BAPI_RETURN2.

IF sy-subrc NE 0.

WRITE: 'Article', it_mara_marc-matnr, 'already existed.'.

lv_flag = 'X'.

ENDIF.

ELSE.

WRITE: bapi_return1-message.

lv_flag = 'X'.

ENDIF.

ENDLOOP.

IF lv_flag EQ ' '.

MESSAGE 'Articles create/change successfully.' TYPE 'S'.

ENDIF.

Please let me help why this three fields (MARC-vrbdt,MARC-vrbfk,MARC-vrbwk.) in Marc is not getting created trough this BAPI.

Thanks

E.Ravishankar

5 REPLIES 5
Read only

Former Member
0 Likes
2,070

Hi

<b>I hope you must have read the documentation of this BAPI.</b>

<u>Here is the documentation.</u>

 BAPI_MATERIAL_MAINTAINDATA_RT
____________________________________________________
Short Text
Create and Change Material Master Data (Retail)

Functionality
You use this method to create new material master data or to change existing material master data.

Besides creating and changing material master data, you can also delete data for the following structures:

MATERIALDESCRIPTION
UNITSOFMEASURE
INTERNATIONALARTNOS
VENDOREAN
UNITOFMEASURETEXTS
LAYOUTMODULEASSGMT
MATERIALLONGTEXT
For the system to recognize that a data record is to be deleted, the field FUNCTION must contain the value 003 in the corresponding structure. This field is of no relevance when creating or changing data.

If the material specified in structure HEADDATA is a generic material, you can specify data on the generic material and also on the variants in the structures concerned (CLIENTDATA, and so on). Normally, this is of use only if you want to maintain special data on the variant differently from the data on the generic material. If no explicit data on the variants exists, it is created automatically on the basis of the data on the generic material.

If a variant is created, an entry must be defined in structure VARIANTSKEYS for this variant. This makes it possible to also create new variants for an existing generic material.

If a structure contains fields for units of measurement (such as structure CLIENTDATA, field BASE_UOM), language indicators (such as structure MATERIALDESCRIPTION, field LANGU), or country indicators (such as structure TAXCLASSIFICATIONS, field DEPCOUNTRY), there is always a field of the same name with the ending _ISO. This makes it possible to transfer either the internally used SAP code or a standardized ISO code for the units of measurement, language indicators, or country indicators. ISO codes are converted to an SAP code internally for further processing. The ISO code is used only if the SAP code is not transferred. If you use ISO codes, you must ensure that the SAP code can be uniquely determined from the ISO code in Customizing for units of measurement, language indicators, and country indicators.

The data transferred is updated synchronously; that is, not using an update task. This is necessary because this method is also used in distribution by Application Link Enabling (ALE), where asynchronous updating cannot be supported in inbound processing because the processing status of the assigned IDocs cannot otherwise be set reliably.

If a serious database error occurs during synchronous updating of the application data, a rollback for all database changes made so far is triggered in the method. If the method is called in a commit unit together with other methods, the database changes of the previously executed method calls are also rolled back as a result. The rollback is necessary to prevent database inconsistencies due to only part of the application data being updated correctly.

Any information or error messages that are issued while the data is being processed are recorded in the application log. If you want to view these messages, a commit must be performed after this method is called so that the data in the application log is written to the database. Even if the structure RETURN returns an E-type (error) message in field TYPE, a commit must be performed so that the application log is written. In the event of an error, the method itself ensures that the data is reset correctly. The commit is also necessary to trigger the updating of the classification data because the update module for the classification data is registered by means of PERFORM ON COMMIT and is started only by a COMMIT WORK.


Notes
To create or change data, you require the necessary authorizations for maintaining the corresponding material master data.

Further information
As of Release 4.5A, this method can also be used to distribute deletion flags correctly. Deletion flags are only set in retail for client-specific material data (parameter CLIENTDATA) and plant-specific material data (parameter PLANTDATA). If deletion flags (field DEL_FLAG) are transferred for one of these two parameters, a corresponding workflow is generated during updating. Depending on the value of the deletion indicator, this workflow triggers the discontinuation of the material for the client or for a specific plant, or the cancelling of an existing deletion flag.

For more information, see the SAP library documentation LO SAP Retail -> Articles: Article Discontinuation.

Parameters
HEADDATA
RETURN
VARIANTSKEYS
CHARACTERISTICVALUE
CHARACTERISTICVALUEX
CLIENTDATA
CLIENTDATAX
CLIENTEXT
CLIENTEXTX
ADDNLCLIENTDATA
ADDNLCLIENTDATAX
MATERIALDESCRIPTION
PLANTDATA
PLANTDATAX
PLANTEXT
PLANTEXTX
FORECASTPARAMETERS
FORECASTPARAMETERSX
FORECASTVALUES
TOTALCONSUMPTION
UNPLNDCONSUMPTION
PLANNINGDATA
PLANNINGDATAX
STORAGELOCATIONDATA
STORAGELOCATIONDATAX
STORAGELOCATIONEXT
STORAGELOCATIONEXTX
UNITSOFMEASURE
UNITSOFMEASUREX
UNITOFMEASURETEXTS
INTERNATIONALARTNOS
VENDOREAN
LAYOUTMODULEASSGMT
LAYOUTMODULEASSGMTX
TAXCLASSIFICATIONS
VALUATIONDATA
VALUATIONDATAX
VALUATIONEXT
VALUATIONEXTX
WAREHOUSENUMBERDATA
WAREHOUSENUMBERDATAX
WAREHOUSENUMBEREXT
WAREHOUSENUMBEREXTX
STORAGETYPEDATA
STORAGETYPEDATAX
STORAGETYPEEXT
STORAGETYPEEXTX
SALESDATA
SALESDATAX
SALESEXT
SALESEXTX
POSDATA
POSDATAX
POSEXT
POSEXTX
MATERIALLONGTEXT
PLANTKEYS
STORAGELOCATIONKEYS
DISTRCHAINKEYS
WAREHOUSENOKEYS
STORAGETYPEKEYS
VALUATIONTYPEKEYS

Exceptions
Function Group
1001

Hope this will help.

Please reward suitable points.

Regards

- Atul

Read only

Former Member
0 Likes
2,070

hi atul,

I gone trough the help.my question is why the mentioned three fields is not getting created in the system.

Thanks

E.Ravishankar.

Read only

Former Member
0 Likes
2,070

Hi

<b>Inside the BAPI Call, the

Header - BAPIE1MATHEAD, there are few other fields which are required to be passed in this case.

Also inside the BAPIE1MARCRT structure are to specified according to the values possible there.

(E.g.,

REFPLTCONS = Plant

D_TO_REF_M accepts a date field, which can be equal to sy-datum, etc)</b>


REFPLTCONS	VRBWK	CHAR	4	0	Reference plant for consumption
D_TO_REF_M	VRBDT	DATS	8	0	To date of the material to be copied for consumption
MULT_REF_M	VRBFK	DEC	4	2	Multiplier for reference material for consumption

<b>Please try to pass data to those fields, before BAPI Call.</b>

Hope this will help.

Please reward suitable points.

Regards

- Atul

Read only

Former Member
0 Likes
2,070

Hi Atul,

Pls refer my code ,I already passed the value in the respcetive strucure what you had metioned.out of 14 fields 3 fields are not getting created in the system.

Thanks

E.ravishankar

Read only

0 Likes
2,070

Hi Suresh.

Even we are facing the same problem. Were you able to resolve the problem. Please help if you did.

Thanks in advance