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

Delcare Internal Table in SAP script

Former Member
0 Likes
1,347

Hi all.

Can i declare an internal table in SAP script and update it tru subroutines. i have a specific requirements so.

Thanks in Advance.

Hi all.

Can i declare an internal table in SAP script and update it tru subroutines. i have a specific requirements so.

Thanks in Advance.

7 REPLIES 7
Read only

Former Member
0 Likes
1,069

Hi Diwakar,

I don't think so.

But there is one more way to do so as to meet ur requirement as far as my understanding is concerned,

1)declare the internal table in driver program only

2)Pass the same in subroutine and let it get modified, the values will get reflected.

Hope this will help u in some way..

Read only

Former Member
0 Likes
1,069

Hi Diwakar,

You can not declare an internal table in SAP Scripts. For this you will have to use smartforms. You have to create internal table in the print program and pass it to the script. You can access the variable by putting it in between '&', say &itab-matnr& .

Regards,

Navneeth

PS: Please reward point to all helpful answers

Read only

Clemenss
Active Contributor
0 Likes
1,069

Hi,

just to point out the conceptual difference between SAPSCRIPT and SMARTFORMS:

Using SAPSCRIPT, you will declare the internal table in the program calling the SAPSCRIPT form.

After open and start of form, you will loop at the internal table and trigger a forms element (in window MAIN) in the form using function module WRITE_FORM for each loop.

Using SMARTFORMS, you will pass the internal table in the SMARTFORMS function interface. In the SMARTFORM, where ever you want, you declare a TABLE knot and loop at the table.

In SAPSCRIPT, you will use TABS to let the output look table-like, in SMARTFORMS you define the cell structure of an output line.

The result is comparable if not the same because SMARTFORMS internally do nothing really different from SAPSCRIPT.

The (near) future will be ADOBE-interactive forms anyway but I doubt that this is the end of the line.

Regards,

Clemens

Read only

Former Member
0 Likes
1,069

Hi Diwakar,

try using the FM WRITE_FORM_LINES this has an internal table and it can be passed to the sap script for writing the contents of the internal table.

I have used this many times and it helps to pass an internal table contenet to the sap acript.

There is no other way to pass an internal ttable to a sapscript as it is not supported. You can alternatively use SMARTFORMS as described in above post.

Cheers

VJ

Read only

Former Member
0 Likes
1,069

HI

GOOD

I DONT THINK YOU CAN DECLARE AN INTERAL TABLE IN THE SAP SCRIPT AND CAN UPDATE IT.

THANKS

MRUTYUN

Read only

0 Likes
1,069

u can't do that...

but if u don't want to change ur driver program than u can use perform in sap script.

ex-

:PERFORM get_date IN PROGRAM zreport

/:USING &SALESORDER&

/:CHANGING &S_DATE&

/:ENDPERFORM

Now you can print S_DATE.

Write this code in the new ABAP program would be

REPORT zreport.

FORM get_date TABLES in_tab STRUCTURE ITCSY

out_tab STRUCTURE ITCSY .

READ TABLE in_tab INDEX 1.

SELECT some_date FROM ztab

WHERE salesorder = in_tab-value.

IF sy-subrc EQ 0.

READ TABLE out-tab INDEX 1.

MOVE ztab-somedate TO out_tab-value

MODIFY out_tab INDEX 1.

ENDIF.

ENDFORM.

Read only

0 Likes
1,069

nice try. But this is not at all related to internal tables.

Regards,

Clemens