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: 

Dynamic write statements

Former Member
0 Kudos

HI Experts,

Can anybody tell me following answers.

I have

select-options: p_date like Ztab1-date. (we can choose here till 15dates)

low =01/07/07 to high-15/07/07

output screen.

<b>items date1 date2 date3 date4 date5 date6 date7 date8 date9 ..date15 TotalQty</b>

<b>cat1</b> 1000 500 -


700 700 2900

<b>cate2</b> so on

<b>cate3</b>

In write statement: i want my program to decide total qty column should write just select-options range. like if i given in select options 17/07/07 to 18/07/07. my total column should come after next to 2columns, when i given 7 days its shud just next to 7th column,when i given 01st jul 07 to 15th july 07, total come just next to 15th column.

How to do that? Pls sugest.

Thanks in advance.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Anil,

Just do something like this.

Based on the entries in the select option calculate the number of days.

Then use

DO <no.of days> times.

<Write your all WRITE statements here except the TOTAL>

ENDO.

..<Now write total here>

Regards,

Atish

2 REPLIES 2

Former Member
0 Kudos

Hi Anil,

Just do something like this.

Based on the entries in the select option calculate the number of days.

Then use

DO <no.of days> times.

<Write your all WRITE statements here except the TOTAL>

ENDO.

..<Now write total here>

Regards,

Atish

Former Member
0 Kudos

You can use field-symbols:

field-symbols: <fvalue>.
Loop at itab.
 New-line. 
    DO .
      ASSIGN COMPONENT sy-index OF STRUCTURE itab TO <fvalue> .
      IF sy-subrc NE 0 .
        EXIT .
      ENDIF .
      write <fvalue>.
    ENDDO.
Endloop.

You will have to add the headings first and the row labels if needed.

Please reward points if helpful.

Minami