cancel
Showing results for 
Search instead for 
Did you mean: 

passing internal table to sapscript form from sub routine pool

abhibrave2002
Explorer
0 Kudos

Hi experts,

I have to pass the data of an internal table into sap script form for printing and i am using subroutine pool program.this internal table is in subroutine pool program..

How can i do this ..?

Thanks in advance,

abhi

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

You can't pass the Internal Table from the subroutine pool to SAPSCRIPT; but you can pass the variable from the subroutine pool to the SAPSCRIPT using Table-out of ITCSY structure.

In subroutine Pool,

Using Perform statement.

read table_out with key name = 'G_TEXT' transporting no fields.

if sy-subrc = 0.

Move l_serial to Table_out-value.

Modify table_out using sy-tabix transporting value.

endif.

In SAP SCRIPT Perform <statement> Using <&delv&> changing <&G_text&>.

Note: The maximum number of variable that you can to the SAPSCRIPT from subroutine pool is 80 chars.

Hence, if you are passing the long text to SAPSCRIPT then use read_text fm; pass to internal table and then to a variable where using offset of 80 pass the entire text to different variables and the further populate them to SAPSCRIPT.

Former Member
0 Kudos

Hi Abhishek,

You can use a subroutine in your sapscript as well as in your subroutine pool program. Place a subroutine under a text-element in your sapscript (using PERFORM, END PERFORM). In the subroutine, create a subroutine and loop your internal table. Within the loop call the FM write_form and call the text element explicitly to transfer the values each time to the script.

Former Member
0 Kudos

Hi,

You can not pass on an internal table to a subroutine thru script, you can pass on required fields only.

Hope you know the format of calling a subroutine:

Say if you have to add the unit price (KOMVD-KBERT) then in the main window whereever tat value is picked write this routine

/: DEFINE &TOT_PRICE&

/: PERFORM F_GET_PRICE IN PROGRAM <subroutine prog name> /:USING &KOMVD-KBERT& /:CHANGING &TOT_PRICE& /:ENDPERFORM

Then write the variable where ever you want it to be printed (mostly it will be in footer window)

Then create subroutine pool program and you have to write the code.

FORM F_GET_PRICE tables int_cond structure itcsy

outt_cond structure itcsy.

data : value type kbert.

statics value1 type kbert.

Read int_cond table index 1.

value = int_cond-value.

value1 = value1 + value.

Read outt_cond table index 1.

outt_cond-value = value1.

Modify outt_cond index 1.

ENDFORM.

Regards,

Narendra.

Reward if helpful!!

Former Member
0 Kudos

Hi,

SAPscript does not work in this way, if you were to pass in internal table to the SAPscript it does not have the capability to loop around it.

In your subroutine write a loop that calls an element of your main window, here you can use fields of your internal table.

Regards,

Nick