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

Update MARC table

Former Member
0 Likes
5,251

Hi, in my cutom Tcode I'll be making a changes in MRP values in Alt UOM but at the database level it will be stored in Base UoM.

I want to update MARC.

Can anybody please tell me how to use FM 'MATERIAL_MAINTAIN_DARK'?

I want to know what all the parameters needs to pass? Do I need to pass Tcode MM02 anywhere? What will be the mode of transfer?

I heard BAPI 'BAPI_MATERIAL_SAVEDATA' is also there. Will you please provide info of either one?

It's urgent...Thanks

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,817

Hi,

Please find the corresponding field names in the BAPI

PLANTDATA-REORDER_PT - MINBE

PLANTDATA-SAFETY_STK - EISBE

PLANTDATA-MINLOTSIZE - bstmi

PLANTDATA-MAXLOTSIZE - bstma

PLANTDATA-FIXED_LOT - bstfe

PLANTDATA-ROUND_VAL - bstrf

PLANTDATA-MAX_STOCK - mabst

PLANTDATA-MIN_SAFETY_STK - eislo

<b>Populate the following parameters..</b>

HEADDATA-MATERIAL = 'Material number'.

HEADDATA-MRP_VIEW = 'X'.

Populate the PLANTDATA as mentioned above..

Populate the corresponding X in the PLANTDATAX structure.

PLANTDATAX-REORDER_PT = 'X'

PLANTDATAX-SAFETY_STK = 'X'

PLANTDATAX-MINLOTSIZE = 'X'

PLANTDATAX-MAXLOTSIZE = 'X'

PLANTDATAX-FIXED_LOT = 'X'

PLANTDATAX-ROUND_VAL = 'X'

PLANTDATAX-MAX_STOCK = 'X'

PLANTDATAX-MIN_SAFETY_STK = 'X'

Call the BAPI.

Give COMMIT WORK.

Hope this works..

Thanks

Naren

8 REPLIES 8
Read only

Former Member
0 Likes
2,817

I believe if you just search SDN on MATERIAL_MAINTAIN_DARK - you'll find example on how to use it.

Read only

0 Likes
2,817

I want to update MRP values,

Please find a piece of code.

DATA: g_t_mara_ueb LIKE mara_ueb OCCURS 0 WITH HEADER LINE,

g_t_marc_ueb LIKE marc_ueb OCCURS 0 WITH HEADER LINE.

DATA: l_tranc TYPE transcount,

l_amerrdat LIKE merrdat OCCURS 0 WITH HEADER LINE.

l_tranc = 1.

SELECT * INTO CORRESPONDING FIELDS OF TABLE g_t_mara_ueb

FROM mara WHERE matnr = g_mat.

Then I am updating fields tcode and tranc of g_t_mara_ueb as MM02 and 1 respectively

Then I select the records from MARC

SELECT * INTO CORRESPONDING FIELDS OF TABLE g_t_marc_ueb

FROM marc WHERE matnr = g_mat

AND werks = g_plant.

New MRP values are then updated to g_t_marc_ueb. Then I call FM

CALL FUNCTION 'MATERIAL_MAINTAIN_DARK'

EXPORTING

flag_muss_pruefen = 'X'

p_kz_no_warn = 'N'

kz_prf = space

kz_verw = 'X'

kz_aend = 'X'

kz_dispo = 'X'

kz_test = ' '

TABLES

amara_ueb = g_t_mara_ueb

amarc_ueb = g_t_marc_ueb

amerrdat = l_amerrdat

EXCEPTIONS

kstatus_empty = 1

tkstatus_empty = 2

t130m_error = 3

internal_error = 4

too_many_errors = 5

update_error = 6

OTHERS = 7.

IF sy-subrc NE 0.

ROLLBACK WORK.

ELSE.

CALL FUNCTION 'DB_COMMIT'.

ENDIF.

System does not give any error when FM is executed but table MARC is not getting updated.

Need your help

Read only

Former Member
0 Likes
2,817

Hi,

You can use the BAPI_MATERIAL_SAVEDATA

Pass the parameters PLANTDATA & PLANTDATAX

With the values that you need to update.

Which fields do you want to update in the MRP view??

I will let you know which fields to be populated in the BAPI parameter..

Thanks,

Naren

Read only

0 Likes
2,817

I tried using BAPI_MATERIAL_SAVEDATA also but I was facing same problem.

Fields to be updated are

minbe

eisbe

bstmi

bstma

bstfe

bstrf

mabst

eislo

It would be great if you tell me what all the fields to be populated.

If I use FM 'MATERIAL_MAINTAIN_DARK', I can make the use of direct assignment but in BAPI it was difficult to make every assignment cause I dont know mandatory fields.

Waiting for your reply

Thanks,

Mahesh

Read only

Former Member
0 Likes
2,817

Hi,

Are you populating the field d_ind in the marc_ueb structure..

Thanks,

Naren

Read only

0 Likes
2,817

I could not find any such field

Read only

Former Member
0 Likes
2,818

Hi,

Please find the corresponding field names in the BAPI

PLANTDATA-REORDER_PT - MINBE

PLANTDATA-SAFETY_STK - EISBE

PLANTDATA-MINLOTSIZE - bstmi

PLANTDATA-MAXLOTSIZE - bstma

PLANTDATA-FIXED_LOT - bstfe

PLANTDATA-ROUND_VAL - bstrf

PLANTDATA-MAX_STOCK - mabst

PLANTDATA-MIN_SAFETY_STK - eislo

<b>Populate the following parameters..</b>

HEADDATA-MATERIAL = 'Material number'.

HEADDATA-MRP_VIEW = 'X'.

Populate the PLANTDATA as mentioned above..

Populate the corresponding X in the PLANTDATAX structure.

PLANTDATAX-REORDER_PT = 'X'

PLANTDATAX-SAFETY_STK = 'X'

PLANTDATAX-MINLOTSIZE = 'X'

PLANTDATAX-MAXLOTSIZE = 'X'

PLANTDATAX-FIXED_LOT = 'X'

PLANTDATAX-ROUND_VAL = 'X'

PLANTDATAX-MAX_STOCK = 'X'

PLANTDATAX-MIN_SAFETY_STK = 'X'

Call the BAPI.

Give COMMIT WORK.

Hope this works..

Thanks

Naren

Read only

0 Likes
2,817

Hey Naren, Thanks man I could save the entries.

I'll disturb you again If I face any prb

Thanks,

Mahesh