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

select query

Former Member
0 Likes
551

Hi All,

I have an internal table having document number values it_tab.

For the above documene numbers i need to select all items DKKOPK-BETRW value having similar tax code (DFKKOPK-MWSKZ) sum the values from field DKKOPK-BETRW of all line items and display.

Pls help..

Thanks,

Sai

3 REPLIES 3
Read only

Former Member
0 Likes
529

data : begin of itab occurs 0,

mblnr,

MWSKZ,

BETRW,

end of itab.

data : itab2 like itab occurs 0 with header line.

sort itab by mblnr mwskz betrw.

loop at itab.

itab2 = itab.

collect itab2.

clear itab.

endloop.

Hope it will work.

Regards,

madan.

Read only

Former Member
0 Likes
529
if it_itab[] is not initial.

select OPBEL OPUPK BETRW MWSKZ from DFKKOPK 
into itab for all entries in it_itab
where OPBEL = it_itab-doc_no.

endif.
Read only

Former Member
0 Likes
529

HI,

A LOCAL VARIABLE OF TYPE BETRW INITIALISED TO ZERO.

SELECT * FROM DFKKOPK INTO TABLE II_ITAB.

SORT IT_ITAB BY MWSKZ.

LOOP AT IT_ITAB INTO WA_ITAB.

LV_BETRW = WA_ITAB-BETRW + LV_BETRW.

ON CHANGEOF MWSKZ.

WRITE: LV_BETRW.

CLEAR LV_BETRW.

ENDON.

ENDLOOP.

NOTE: you must have the MWSKZ field as the first field of the internal table.

I think this is clear for you.

Reward points if helpful.

Thanks and regards,

Narayana.

Edited by: Ammavajjala Narayana on May 16, 2008 1:24 PM