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 column position as variable

Former Member
0 Kudos

hello everybody,

kindly help me how to do this:

Vendor 2004 2005 2006

-


-


-


-


xxxxxxx xxx.xx xxx.xx xxx.xx

the year is select-option. the number of year depends on the on year range entered by the user.

how could i write this using the WRITE STATEMENT since the column year depends on the range entered by the user. if the user entered 2004-2007 meaning i have 4 year in the title of the report.

how could i write that the position of the column is VARIABLE.

thanks.

den

3 REPLIES 3

Former Member
0 Kudos

Hi donna,

1. Simple.

2. we have to use

<b>WRITE : at</b> pos year

where pos = position variable

year = year data.

3. just copy paste in new program

4.

report abc.

data : pos type i.

data : yr(4) type n.

yr = '2003'.

*----


do 5 times.

pos = pos + 6.

yr = yr + 1.

write : at pos yr.

enddo.

regards,

amit m.

former_member184569
Active Contributor
0 Kudos

Hi Donna,

Try the following code.

tables bkpf.

DATA pos type i.

data year(4) type n.

select-options s_year for bkpf-gjahr.

start-of-selection.

pos = 1.

loop at s_year.

if s_year-option = 'EQ'.

WRITE : at pos s_year-low.

pos = pos + 8.

elseif s_year-option = 'BT'.

year = s_year-low.

do .

year = year + 1.

write : at pos year.

pos = pos + 6.

if year = s_year-high.

exit.

endif.

enddo.

endif.

endloop.

Hope that it was helpful.

Thanks,

Susmitha

Former Member
0 Kudos

Hi

report zzztest.

tables pa9701.

select-options: syear for pa9701-aYEAR.

DATA: CNT(3) TYPE N.

DATA: CNT1(4) TYPE N.

DATA: CNT2(4) TYPE N.

break-point.

cnt2 = SYEAR-HIGH - SYEAR-LOW.

cnt2 = cnt2 + 1.

CNT1 = SYEAR-LOW.

do cnt2 times.

CNT = CNT + 10.

WRITE AT CNT CNT1.

CNT1 = cnt1 + 0001.

enddo.

try to code like this this will solved your problem

Regards,

Hiren Patel