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

abap

Former Member
0 Likes
571

i have selected labst from mard based on matnr and charg from mchb based on for all entries in it_mard.and looping both internal tabels is it correct

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
540

Hi Rakhee,

Is your Code something similar to this?

select matnr

werks

lgort

labst

from mard

into table it_mard

where matnr in s_matnr.

if not it_mard[] is initial.

select matnr

werks

lgort

charg

from MCHB

into table it_mchb

for all entries in it_mard

where matnr = it_mard-matnr

and werks = it_mard-werks

and lgort = it_mard-lgort.

endif.

loop at it_mchb.

move-corrsponding it_mchb to it_final.

read table it_mard with key matnr = it_mchb-matnr

werks = it_mchb-werks

lgort = it_mchb-lgort.

if sy-subrc = 0.

move-corresponding it_mard to it_final.

append it_final.

clear it_final.

endif.

endloop.

Regards,

ravi

3 REPLIES 3
Read only

Former Member
0 Likes
540

Yes it is correct...if you refer to my code in your earlier post you can replace the code in second select to get the data from MARD..the rest can remain the same to give you the percentage.

Please note to reward points for all helpful answers...

Thanks and Regards

Anurag

Read only

venkata_ramisetti
Active Contributor
0 Likes
540

Hi,

YOu can write lik e below also,

SELECT MARDMATNR MARDLABST MCHB~CHARG

INTO TABLE IT_MARD_MCHB

FROM MARD INNER JOIN MCHB

ON MARDMATNR = MCHBMATNR AND

MARDWERKS = MCHBWERKS AND

MARDLGORT = MCHBLGORT.

Thanks,

Ramakrishna

Read only

Former Member
0 Likes
541

Hi Rakhee,

Is your Code something similar to this?

select matnr

werks

lgort

labst

from mard

into table it_mard

where matnr in s_matnr.

if not it_mard[] is initial.

select matnr

werks

lgort

charg

from MCHB

into table it_mchb

for all entries in it_mard

where matnr = it_mard-matnr

and werks = it_mard-werks

and lgort = it_mard-lgort.

endif.

loop at it_mchb.

move-corrsponding it_mchb to it_final.

read table it_mard with key matnr = it_mchb-matnr

werks = it_mchb-werks

lgort = it_mchb-lgort.

if sy-subrc = 0.

move-corresponding it_mard to it_final.

append it_final.

clear it_final.

endif.

endloop.

Regards,

ravi