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

Table Display in SAP Script

Former Member
0 Likes
2,213

Hi All,

I have a requirement to display a table data in SAP Script.

The column details are as fiollows:

SlNo.

Desc,

Qty,

Amount.

Is there any specific way to display the table data in Script?

If I use a single window like MAIN window and try to separate the columns by TABS then if my Desc field is long enough then complete formatting is spoiled.

If I use a VAR window with a TEXT ELEMENT in that then system Overwrites the same data again and again so only last record in displayed at the display.

Please suggest....

Regards,

Prakash Pandey

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,605

You should declare the tabulators in the respecting sapscript window, and then use double commas to separate the values. Each double comma ( ,, ) means a tab jump to the nex available tab position.

You should iterate the itab in your program and call the same element for writing in your sapscript for each iteration of your loop.

6 REPLIES 6
Read only

Former Member
0 Likes
1,606

You should declare the tabulators in the respecting sapscript window, and then use double commas to separate the values. Each double comma ( ,, ) means a tab jump to the nex available tab position.

You should iterate the itab in your program and call the same element for writing in your sapscript for each iteration of your loop.

Read only

0 Likes
1,605

Hi Gustavo,

I have done the same. But every time the element and the window is called by FM WRITE_FORM the previous value is overwritten and as a result only the last loop value is shown on the script.

Regards,

Prakash Pandey

Read only

0 Likes
1,605

Hi,

try this .

In the driver program .....

loop at itab into fs.

call function write_from.

endloop.

In the text editor.

&fs-f1&,,&fs-f2&,,&fs-f3&

Read only

0 Likes
1,605

Hi Sudheer,

I am doing the same. Please note that I can not use a Single window because the length of the first field is more than column width and it is supposed to do a Word Wrap, so I have different window for every column I am using a VAR WINDOW and NOT A MAIN window.

In the main window when I call WRITE_FORM it prints the various loop values one below another. This is OK. But since I am using a VAR window the loop values are overwritten. And only the last entry of the loop is displayed.

Regards,

Prakash Pandey

Read only

0 Likes
1,605

Hi Prakash,

Try using FM WRITE_FORM_LINES.

This will work.

Anurita

Read only

Former Member
0 Likes
1,605

Hi Praksh

What you can do, if you are not sure about the lenght of the description field, is to first check it's length.

Then split it into parts (global variables) say v1 v2 v3 etc. (of course you can have a max number of parts here only so select a number beyond which you don't think the length of the field would go)

Then in the script where you write its value

do


PF ,,,,,,&v1&
IF v2 IS NOT INITIAL
PF ,,,,,,&v2&
IF v3 IS NOT INITIAL
PF ,,,,,,&v3&
.
.
.
ENDIF
ENDIF

Pushpraj