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: 

Write statement

Former Member
0 Kudos

Hi,

I need to display the output of report in the following format...

................................. sy-datum.......sy-datum+1

forcast:............................ XX..............YY

demand: .......................... X1............. Y1

total demand: .................. X2..............Y2

net requirement: ............... X3...............Y3

I am having an internal table which contain (XX,X1..X3 and YY,..Y3) values along with dates (i.e sy-datum ,sy-datum+1).

I have created above layout but was not able to populate values(XX,X1..X3 and YY,..Y3).

can any tell me how can i populate these XX,X1..X3 and YY,..Y3 values ?

Thanks,

Shilpa

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi

Do Like This........

Data: Begin Of Itab Occurs 0,

c(10) (u didnt mention the field)

date1 type sy-datum,

date2 type sy-datum,

end of itab.

select f1 f2 f3 from desired table to itab where<cond> .

top-of-page.

Write:/1 heading,

15 sy-datum,

25 sy-datum1.

.

Loop at itab.

write:/ 1 heading,

15 sy-datum,

25 sy-datum1.

endloop.

Chane the code according to the fields..Get back if still you are getting error.

Reward ALL helpfull Answers.......

8 REPLIES 8

Former Member
0 Kudos

HI,

check this simple code.

data:itab like mara occurs 0 WITH HEADER LINE.

select * from mara into table itab up to 10 rows.

write:/10 'material',20 'created by'.

loop at itab.

write:/ itab-matnr under 'material',itab-ernam under 'created by'.

endloop.

rgds,

bharat.

former_member223537
Active Contributor
0 Kudos

write 😕 15 'sy-datum' , 25 'sy-datum + 1'.

loop at itab.

write :/0 'Forecast', 15 itab-xx, 25 itab-yy.

write :/0 'Deman', 15 itab-x1, 25 itab-y1.

write :/0 'Total Demand', 15 itab-x2, 25 itab-y2.

write :/0 'Net Requirement', 15 itab-x3, 25 itab-y3.

endloop.

Former Member
0 Kudos

Hi

Do Like This........

Data: Begin Of Itab Occurs 0,

c(10) (u didnt mention the field)

date1 type sy-datum,

date2 type sy-datum,

end of itab.

select f1 f2 f3 from desired table to itab where<cond> .

top-of-page.

Write:/1 heading,

15 sy-datum,

25 sy-datum1.

.

Loop at itab.

write:/ 1 heading,

15 sy-datum,

25 sy-datum1.

endloop.

Chane the code according to the fields..Get back if still you are getting error.

Reward ALL helpfull Answers.......

Former Member
0 Kudos

hi,

write 😕 15 'sy-datum' , 25 'sy-datum + 1'.

loop at itab.

write :/0 'Forecast', 15 itab-xx, 25 itab-yy.

write :/0 'Deman', 15 itab-x1, 25 itab-y1.

write :/0 'Total Demand', 15 itab-x2, 25 itab-y2.

write :/0 'Net Requirement', 15 itab-x3, 25 itab-y3.

endloop.

if helpful reward some points.

with regards,

suresh babu aluri.

Former Member
0 Kudos

Hi,

First of all, are XX, X1..X3, YY, Y1..Y3 of type DATS? If both sy-daum and xx...x3 are in the same column ensure that there are of the same data type. If they are different, then change the date field to C or N type and try to fill the data in the internal table.

Former Member
0 Kudos

Hi Shilpa,

From your requirement, what I understood is there is an internal table and you want to display the values from this table in output using WRITE statement. The kind of output you want to display is as follows -

................................. sy-datum.......sy-datum+1

forcast:............................ XX..............YY

demand: .......................... X1............. Y1

total demand: .................. X2..............Y2

net requirement: ............... X3...............Y3

If above is the requirement then there are different options of output display -

1. Verify there is some data in the internal table for output display.

2. Generally the output display contains only column heading and values below it. This is very well possible and very easy using WRITE statement.

But If the layout is fixed as you have asked for then there will be repetitive, labels display in the output. Also there has to be some unique value against which the other columns will be displayed like either the combination of XX & YY is unique for each row in you table.

Find the following code to get the output result -

WRITE /10(100) SY-ULINE.
LOOP AT IT_TAB INTO WA_TAB.
WRITE: /60 'SY-DATUM',  90'SY-DATUM+1'.
WRITE: /10 'FORCAST:', 60 WA-XX, 90 WA-YY.
WRITE: /10 'DEMAND:' ,60 WA-X1, 90 WA-Y1.
WRITE: /10 'TOTAL DEMAND:',60 WA-X2, 90 WA-Y2.
WRITE: /10 'NET REQU:' ,60 WA-X3, 90 WA-Y3.
WRITE /10(100) SY-ULINE.
ENDLOOP.

Hope this helps.

PS If the answer solves your query, plz close the thread by rewarding each reply.

Regards

former_member196280
Active Contributor
0 Kudos

Hi Shilpa,

This is how you can populate internal table.

If this is not your case send me your code

itab-xx = sy-datum'.

itab-yy = sy-datum + 1

Similarly..........

Append itab.

Former Member
0 Kudos

try this 1....

Suppose the name of your internal table is "itab" havin itab-xx and itab-yy which contains values ....

write 😕 15 'sy-datum' , 25 'sy-datum + 1'.

data :begin of another_itab occurs 4 with header line,

c(16),

xx type n,

yy type n,

end of another_itab.

another_itab-c = 'forcast:'.append another_itab.

another_itab-c = 'demand:'. append another_itab.

another_itab-c = 'total demand:'. append another_itab.

another_itab-c = 'net requirement: '. append another_itab.

select * from itab into corresponding fields of another_itab.

append another_itab.

endselect.

loop at another_itab.

write:/ another_itab-c , 15 another_itab-xx , 25 another_itab-yy.

endloop.

Edited by: Noman Hussain on Jan 10, 2008 8:14 PM