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

Write Statement...........

Former Member
0 Likes
525

Hi Experts,

I have data in itab like :

Off. Prod. Qty. Value.

MUM A 13 1200

MUM C 14 1300

MUM B 9 990

DEL A 6 550

DEL E 21 1350

DEL B 125 9389

DEL C 35 7890

I am writting a classical reports and i want to print like

Prod. A B C D E F G

MUM 13 9 14

DEL 6 125 35 21

How to Loop the itab and how to write ? Pl. guide me....

Yusuf

4 REPLIES 4
Read only

Former Member
0 Likes
498

sort itab by off,prod.

write prod,space.

loop at itab.

write itab-prod ,space.

endloop.

write:/ mum,space .

loop at itab.

write itab-qty ,space.

endloop.

write:/ del ,space.

loop at itab.

write itab-value ,space.

endloop.

there may be some syntax error. But hope You got the logic.

please reward and close the thread.

Read only

Former Member
0 Likes
498

Dear Yusuf,,

Try out following logic,

data : begin of itab occurs 0,

a type str,

b type c,

c(2) type n,

end of itab.

data: wf_data.

itab-a = 'MUM'.

itab-b = 'A'.

itab-c = '1'.

append itab.

itab-a = 'MUM'.

itab-b = 'B'.

itab-c = '2'.

append itab.

itab-a = 'MUM'.

itab-b = 'C'.

itab-c = '3'.

append itab.

itab-a = 'DEL'.

itab-b = 'B'.

itab-c = '4'.

append itab.

itab-a = 'DEL'.

itab-b = 'A'.

itab-c = '5'.

append itab.

write : 10 'A', 20 'B', 30 'C'.

sort itab by a.

loop at itab.

at new a.

write /.

endat.

if itab-b = 'A'.

write : itab-c under 'A'.

elseif itab-b = 'B'.

write : itab-c under 'B'.

elseif itab-b = 'C'.

write : itab-c under 'C'.

endif.

endloop.

Please check and revert,

Regards,

Talwinder

Read only

Former Member
0 Likes
498

hi,

this is the prog u wanted.

data: begin of itab occurs 0,

matnr like mara-matnr,

meins like mara-meins,

mtart like mara-mtart,

end of itab.

select matnr

meins

mtart

from mara

into table itab

up to 5 rows.

loop at itab.

write: itab-matnr.

endloop.

write:/ .

loop at itab.

write at (18) itab-meins.

endloop.

write:/ .

loop at itab.

write at (18) itab-mtart.

endloop.

rewards,

venkat.

Read only

Former Member
0 Likes
498

hi,

write 😕 ,30 'A',60 'B', 90 'C' , 120 'D', .

LOOP AT int.

AT new office.

WRITE : / int-office.

endat.

CASE int-qty.

WHEN 'A'.

WRITE : 30 int-qty.

WHEN 'B'.

WRITE : 60 int-qty.

WHEN 'C'.

WRITE : 90 int-qty.

when 'D'.

write : 150 int-qty.

ENDCASE.

ENDLOOP.