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: 

Program

Former Member
0 Kudos

Hi to all

i want one program.

table VBAP

fields :1. vbeln

2. wmeng

3. -meng(this field also meng but starting letter confusing pls check this once)

wt i want is a report(output) that wmeng & -meng will equal values will display as output.

(in table some values r equal in this 2 fileds)

taht will display with ebeln.

i did i got total values into internal table, but i dont want taht total values will be in internal table

i want only that matching filed in internal table & display that fields only.

5 REPLIES 5

Former Member
0 Kudos

Hi

data: begin of itab occurs 0,

vbeln like vbap-vbeln,

posnr like vbap-posnr,

matnr like vbap-matnr,

kwmeng like vbap-kwmeng,

lsmeng like vbap-lsmeng,

end of itab.

select vbeln posnr matnr kwmeng lsmeng into table ITAB from VBAP.

sort ITAB by VBELN posnr.

delete ITAB where kwmeng <> lsmeng.

Now the ITAB will have the records where both the qty fields are equal.

loop at itab.

write: / itab-vbeln, itab-posnr, itab-matnr.

endloop.

<b>Reward points for useful Answers</b>

Regards

Anji

0 Kudos

thanks gud program

but in select statement only we wont get only equal values then into itab

0 Kudos

hi,

write this

select vbeln posnr matnr kwmeng lsmeng into table ITAB from VBAP

where kwmeng eq lsmeng.

Former Member
0 Kudos

Hi raj,

The third field is Zmeng(Target QTY in sales unit).

After selecting the entries from the table VBAP you have to sort out the internal table where wmeng eq zmeng.

this row you have to append to another internal table and you can use this internal table for dispaly.

code sample:

loop at i_vbap into wa_vbap.

IF wa_vbap-wmeng eq wa_vbap-zmeng.

append wa_vbap to i_vbap2.

endif.

endloop.

i hope this will solve your problem.

Thanks,

CS Reddy.

PS:Reward points if Helpful.

Former Member
0 Kudos

data: begin of fs_vbap,

vbeln like vbap-vbeln,

posnr like vbap-posnr,

matnr like vbap-matnr,

kwmeng like vbap-kwmeng,

lsmeng like vbap-lsmeng,

end of fs_vbap.

data t_vbap like standard table of fs_vbap.

select vbeln posnr matnr kwmeng lsmeng into table t_vbap from vbap.

sort t_vbap by vbeln posnr.

delete t_vbap where kwmeng ne lsmeng.

loop at t_vbap into fs_vbap.

write: / fs_vbap-vbeln, fs_vbap-posnr, fs_vbap-matnr, fs_vbap-kwmeng, fs_vbap-lsweng.

endloop.

We can't select the values directly in the select query where these two values are equal.

So we need to select all the records and then delete the records which doesn't satisfy the condition.

Regards,

Pavan P.