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: 

TABLE-ISSUE

Former Member
0 Kudos

Hi,

Can anyone post the solution for given below requirement.

I need to update MARA,MARC(some Z fields) tables ,so that I have to first check if there is any record for Plant(werks) = 9700

in both of tables.

Then I have to update both of them based on entries in an internal table where the internal table contains data for both of zfields of mara, marc.

Thanks,

G Sandeep Kumar.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi sandeep ,

see this sample program to update the standard tables

data: itab type table of bseg WITH HEADER LINE.

select single * from bseg INTO itab WHERE belnr = '0051000004' and BSCHL = '93'.



itab-projk = '00000153'.

 modify bseg from itab.

in similar way u can apply to zfields also

3 REPLIES 3

Former Member
0 Kudos

Hi sandeep ,

see this sample program to update the standard tables

data: itab type table of bseg WITH HEADER LINE.

select single * from bseg INTO itab WHERE belnr = '0051000004' and BSCHL = '93'.



itab-projk = '00000153'.

 modify bseg from itab.

in similar way u can apply to zfields also

0 Kudos

Srinivasu - I notice that in this thread and at least one other today, you are showing people how to make direct updates to BSEG.

Modifying data in standard SAP tables and BSEG in particular is a very bad idea. There is a real danger of losing data integrety.

Rob

former_member156446
Active Contributor
0 Kudos

in mara you cannot check for werks.


select matnr werks 
from marc as a 
join mara as b
on a~matnr = b~matnr
into table it_marc
for all entries in itab_input
where matnr = itab_input-matnr
werks = '9700'.

if you donnot have a itab_input kind of table...


select matnr werks 
from marc as a 
join mara as b
on a~matnr = b~matnr
into table it_marc
where werks = '9700'.
"materials in it_marc have entries both in MARA and MARC.

you can loop on the it_marc..

loop at it_marc into wa_marc.
modify mara from...  transporting...
modify marc from..  transporting...
endloop.