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 code

Former Member
0 Likes
428

hello every one,

can anyone tell me how to write the code for .....I have one custom table called zxyz haveing matnr(model no:1) and having zmatnr(model no:2)...

so I need to write code for total items should not exceed 06....the combination must like matnr = 1 zmatnr =5

matnr = 2 zmatnr =4

matnr = 3 zmatnr =3

matnr = 4 zmatnr =2

matnr = 5 zmatnr =1

matnr = 6 zmatnr =0

I need to build this logic in code......i have fields in my table are........matnr, zmatnr, combination and quantity........and I need to relate with xvbap in mv45afzz and this table.........

Thanks in advance,

Madhu.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
389

Hi Madhu,

From the information you provide, it looks like you cannot filter at the select statement level.

YOu have to process at the internal table level.

select matnr zmatnr into table itab where...

loop at itab.

v_total = itab-matnr + itab-zmatnr.

if v_total <> 6.

delete itab index sy-tabix.

endif.

endloop.

Method 2)

Have a field total in the z table.

This total should hold the total of the matnr and zmatnr at the time of saving the data to this table.

then you can simpley write a select statement based on this field

select * from zabc into table itab where total = 06.

Regards,

Ravi

2 REPLIES 2
Read only

Former Member
0 Likes
390

Hi Madhu,

From the information you provide, it looks like you cannot filter at the select statement level.

YOu have to process at the internal table level.

select matnr zmatnr into table itab where...

loop at itab.

v_total = itab-matnr + itab-zmatnr.

if v_total <> 6.

delete itab index sy-tabix.

endif.

endloop.

Method 2)

Have a field total in the z table.

This total should hold the total of the matnr and zmatnr at the time of saving the data to this table.

then you can simpley write a select statement based on this field

select * from zabc into table itab where total = 06.

Regards,

Ravi

Read only

Former Member
0 Likes
389

Hi Madhu,

Both options given in previous answer are perfact. Please close the forum and reward point to him

Darshan