Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

generating report logic

Hi All

I am using an internal table with fields

Estimator order Lost Open

A 1 0 0

A 0 1 0

B 1 0 0

C 0 0 1

which shows estimator, order field which shows the quote converted to order, similarly lost and open.

Now I want to summarize this into anoter internal table where output should be like

Estimator Total_quotes Converted_to_order Lost Open

A 2 1 1 0

B 1 1 0 0

C 1 0 0 1

the total no of quotes is the total number of records with that estimator,

converted to order is the total number of quotes converted to order and similary with lost and open.

can any one provide with th logic please

regards

AJ

Tags:
Former Member
Former Member replied

Please refer this program...it exactly solves ur problem.....

just change field names and add fields which u want......

var1 is estimator

var2 is converted to order/lost/open " u can use 3 fields here......

var3 " extra field in my case......

var4 total quotes

data : begin of itab occurs 0,

var1 type c,

var2 type i,

var3 type i,

end of itab.

data : begin of itab1 occurs 0,

var1 type c,

var2 type i,

var3 type i,

var4 type i,

end of itab1.

data : v_cnt type i.

itab-var1 = 'A'.

itab-var2 = 1.

itab-var3 = 0.

append itab.

clear itab.

itab-var1 = 'A'.

itab-var2 = 2.

itab-var3 = 5.

append itab.

clear itab.

itab-var1 = 'B'.

itab-var2 = 1.

itab-var3 = 0.

append itab.

clear itab.

itab-var1 = 'C'.

itab-var2 = 1.

itab-var3 = 0.

append itab.

clear itab.

loop at itab.

at new var1.

itab1-var1 = itab-var1.

clear v_cnt.

endat.

v_cnt = v_cnt + 1.

at end of var1.

sum.

itab1-var2 = itab-var2.

itab1-var4 = v_cnt.

append itab1.

clear itab1.

endat.

endloop.

loop at itab1.

write :/ itab1-var1, itab1-var2,itab1-var3,itab1-var4.

endloop.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question