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

at new :)

Former Member
0 Likes
807

TABLES : SPFLI.

DATA : GT_TABLE TYPE TABLE OF SPFLI with header line.

DATA : GS_TABLE TYPE TABLE OF SPFLI with header line.

DATA : GX_TABLE TYPE TABLE OF SPFLI with header line.

DATA : GV_T TYPE CHAR2.

select * from Spfli into table GT_TABLE.

sort GT_TABLE by connid.

LOOP AT GT_TABLE .

at end of connid(2).

sum.

read table gt_table index sy-tabix.

move-corresponding gt_Table to gs_table.

append gs_table.

write : / gs_table-carrid ,

gs_table-distance.

endat.

endloop.

-


hi everybody ı want to grouping and sum price connid(2) only to rows

can anybody help me?

TABLES : SPFLI.

DATA : GT_TABLE TYPE TABLE OF SPFLI with header line.

DATA : GS_TABLE TYPE TABLE OF SPFLI with header line.

DATA : GX_TABLE TYPE TABLE OF SPFLI with header line.

DATA : GV_T TYPE CHAR2.

select * from Spfli into table GT_TABLE.

sort GT_TABLE by connid.

LOOP AT GT_TABLE .

at end of connid(2).

sum.

read table gt_table index sy-tabix.

move-corresponding gt_Table to gs_table.

append gs_table.

write : / gs_table-carrid ,

gs_table-distance.

endat.

endloop.

-


hi everybody ı want to grouping and sum price connid(2) only to rows

can anybody help me?

2 REPLIES 2
Read only

Former Member
0 Likes
753

Hi,

I believe that CONNID is 4 characters long and you want the sum for each CONNID's first 2 characters -

If this is correct, then populate a new column CON in your internal table GT_TABLE.

LOOP AT GT_TABLE.

GT_TABLE-CON = GT_tABLE-CONNID+0(2).

MODIFY GT_TABLE SY-YABIX TRANSPORTING CON.

ENDLOOP.

SORT GT_TABLE.

Make sure that CON is the first field in your internal table.

Then you can use AT END OF CON, to get the desired values.

ashish

Then you can use control break statements

Read only

Former Member
0 Likes
753

See the modified program :

REPORT Ztest no standard page heading.

TABLES : SPFLI.

DATA : GT_TABLE TYPE TABLE OF SPFLI with header line.

DATA : GS_TABLE TYPE TABLE OF SPFLI with header line.

DATA : GX_TABLE TYPE TABLE OF SPFLI with header line.

DATA : GV_T TYPE CHAR2.

data : begin of i_data occurs 0.

data : coni(2) type c.

include structure SPFLI.

data : end of i_data.

data wa_table like i_data.

select * from Spfli into table GT_TABLE.

sort GT_TABLE by connid.

loop at gt_table .

i_data-coni = gt_table-connid+0(2).

move-corresponding gt_table to i_data.

append i_data.

endloop.

sort i_data by coni connid carrid .

loop at i_data into wa_table.

write 😕 wa_table-carrid,wa_table-distance.

at end of coni.

sum.

write 😕 i_data-carrid , i_data-distance.

endat.

endloop.

See the example program for control break statements :

&----


*& Report ZTEST_IEVENTS

*&

&----


*&

*&

&----


REPORT ZTEST_IEVENTS no standard page heading

line-count 40(2).

tables : vbap.

data : begin of i_vbap occurs 0,

vbeln like vbap-vbeln,

posnr like vbap-posnr,

matnr like vbap-matnr,

kwmeng like vbap-kwmeng,

netpr like vbap-netpr,

end of i_vbap.

data wa_vbap like line of i_vbap.

data v_flag type c.

select-options s_vbeln for vbap-vbeln obligatory.

start-of-selection.

select vbeln

posnr

matnr

kwmeng

netpr from vbap

into table i_vbap

where vbeln in s_vbeln.

sort i_vbap by vbeln posnr.

end-of-selection.

loop at i_vbap.

move i_vbap to wa_vbap.

at first.

write:/2 'Order #',15 'Item #',28 'Material #',50 'Qty', 70 'Net value'.

skip 1.

endat.

at new vbeln.

write:/2 wa_vbap-vbeln,15 wa_vbap-posnr,28 wa_vbap-matnr,

47 wa_vbap-kwmeng,65 wa_vbap-netpr.

v_flag = 'X'.

endat.

if v_flag ne 'X'.

write:/15 wa_vbap-posnr,28 wa_vbap-matnr,

47 wa_vbap-kwmeng,65 wa_vbap-netpr.

endif.

at end of vbeln.

sum.

skip 1.

write:/5 'Sub totals', 47 i_vbap-kwmeng,65 i_vbap-netpr.

skip 1.

endat.

at last .

skip 1.

sum.

write:/5 'Grand Totals',47 i_vbap-kwmeng,65 i_vbap-netpr.

skip 1.

write:/ 'end of page', 'Footer'.

endat.

clear v_flag.

endloop.

Thanks

Seshu