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

sap scripts

Former Member
0 Likes
647

Hi ,

How to use tables in sap scripts ?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
631

Hi,

Give me your mail id.

So that i ll send some attachments, which may be useful for you.

Regards,

Archana

5 REPLIES 5
Read only

Former Member
0 Likes
632

Hi,

Give me your mail id.

So that i ll send some attachments, which may be useful for you.

Regards,

Archana

Read only

0 Likes
631

Hi ,

This is BHAGAVAN BOPPA

email : bhagavan411@yahoo.com

Read only

0 Likes
631

Hi Archana,

can u send me the processor for this question,

How touse the tables in scripts?

Read only

Former Member
0 Likes
631

HI,

We can access structures and the tables tat are updated during runtime. Else you have to pass the structure values to the table in the print program.

<b>For more info check this URL.</b>

http://www.sap-img.com/sapscripts/faq-for-sap-scripts.htm

Reward if it useful.

Thanks.

Read only

Former Member
0 Likes
631

Hi,

It is not a problem to print table data in the main window of the script. Here is an example code snippet.

  • Populate internal table

SELECT * FROM <dbtab>

INTO TABLE itab

WHERE.................

CALL FUNCTION 'OPEN_FORM'

...............................................

...............................................

LOOP AT ITAB.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = ' '

FUNCTION = 'SET'

TYPE = 'BODY'

WINDOW = 'MAIN'

EXCEPTIONS

ELEMENT = 1

FUNCTION = 2

TYPE = 3

UNOPENED = 4

UNSTARTED = 5

WINDOW = 6

BAD_PAGEFORMAT_FOR_PRINT = 7

SPOOL_ERROR = 8

CODEPAGE = 9

OTHERS = 10

.

ENDLOOP

CALL FUNCTION 'CLOSE_FORM'

.................................................

.................................................

In the script you can refer to this itab.

However the same process will not work for a variable window in script. This is because unlike the main window, whenever we call write_form FM for variable window, values are not mapped to script from print program immediately, but when

close_form/end_form FM is called. This means if we loop at an internal table from print progeam and call a variable window inside the loop, only the last row of internal table will be mapped to that variable window of the script.

Award points if found useful.

Regards

Indrajit