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

How to write fields dynamically using "Write command"

Former Member
0 Likes
497

Hi all.

Help me in displaying fields dynamically using "Write Command".I have declared n internal table it_consistancy with fields like

0_tym,1_tym,2_tym.......so on so forth 12_tym.But in the display part somaetyms it may have only 4 fields n sometyms it may have 6 fields.How I can display it using simaple write command.

Plz help me out in solving the problem.

thanx in advance.

Prashant Tiwari

5 REPLIES 5
Read only

Former Member
0 Likes
481

Hi,

In Loop, just before the write statment, put one condition(depends on you requirement) so that it will print what ever you need.

Regards

CS.

Read only

Former Member
0 Likes
481

Hi,

You do like this.

loop at it_consistancy. "it_consistancy is table with header line.

write: / it_consistancy.

endloop.

What ever be the fields in the it_consistancy, you have to display.

Reward.

Read only

Former Member
0 Likes
481

Hi Prashant,

Just loop at the internal table and incase if you have something you ll get that in the report output otherwise a blank line

loop at it_consistency. "if it_consistency is an internal table with header line

write: / it_consistency.

endloop.

If you dont want the blank line then put a condition

loop at it_consistency. "if it_consistency is an internal table with header line

if not it_consistency is initial.

write: / it_consistency.

endif.

endloop.

Hope this helps a bit ...

reward if useful ..

Cheers

Kripa Rangachari.

Read only

0 Likes
481

Hi Kripa, CSY,kamala,bharathi vipparthi.

Thanx u all for yr suggestion.

Bt agn i have a doubt.Plz clear it.

1) if the output has all 12 fileds

Plant 0_tym 1_tym 2_tym 3_tym 4_tym 5_tym...12_ty

pb01 1 2 0 2 1 3 2

pb01 3 2 1 5 4 2 2

2) if the output has only 3 fields

Plant 0_tym 1_tym 2_tym 3_tym 4_tym 5_tym...12_ty

pb01 1 2 0 2 -


-


---

pb01 3 2 1 5 -


-


---

In this case i need to display like:-

Plant 0_tym 1_tym 2_tym 3_tym

pb01 1 2 0 2

pb01 3 2 1 5

So nw plz tell me how to do this.

thnx in advance.

Read only

Former Member
0 Likes
481

hi,

Just loop the internal table with a condition before loop which solves the problem

if not it_consistency is initial.

write: / it_consistency.

endif.

endloop.

reward if found useful,