cancel
Showing results for 
Search instead for 
Did you mean: 

Passing an internal table through a PERFORM and printing that table.

Former Member
0 Kudos

Hi Experts,

I have a requierement to develop a sap script for the transaction LSO_PP40.

The req. includes data to be printed in table format( Note: All the data is not in table format )

Below is the simplified version of script template.

Dear <<field1>> <<field2>>:

Some text

Course Title: <<field3>> *

Duration: << field4>>

Table:--->

Date Venue Start Time Finish Time

The fields 1,2,3 and 4 are automatically populated by the standard driver programme of the transaction LSO_PP40 in some standard structures ,but the Table with fields Date,Venue, Start time and Endtime , I need to populate using an external perform . How can i pass this whole table into the script so that it can be printed.

Thanks.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Mukul,

You cant do this in SAP Script.

You should have control on Print Program to achieve this functionality.

Regards,

Sandeep.

Former Member
0 Kudos

Hi Mukul,

You cant pass the internal table from your subroutine to the SAP Script, as you are passing here.

CHANGING&I_TABLE&.

This will not work.

Instead pass field by field.

CHANGING&IFIELD1&.

CHANGING&FIELD2&.

CHANGING&FIELD3&.....

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

Regards,

Sandeep.

Former Member
0 Kudos

Guys ,

I am not calling the perform inside a loop.

For that i need to change the driver programme which is standard.

I need to pass the whole internal table at one go.

Any Ideas.

Former Member
0 Kudos

Hi,

In your script and the progarm maintain the same internal table name.. .

In the program write the following code:



 PERFORM write_window_e USING 'ITEM_NM_COVERAGE'.

Inside the form :

FORM write_window_e USING    value(p_element).
  CALL FUNCTION 'WRITE_FORM'
       EXPORTING
            element = p_element.
  IF sy-subrc NE 0.
    PERFORM protocol_update.
  ENDIF.
ENDFORM.                    " write_window_e

In the sap script :

maintain the text element with the same name i.e. 'ITEM_NM_COVERAGE'.

and paas the value like this : &T_BRANCH_ADDRESS&.

Former Member
0 Kudos

Hi ,

I have incorporated the above code in the PERFORM ,but the internal table which i want to print

is not being printed. please have a look at the below code snippet which i have written.

Script:--->

I want to populate/print I_SOBID internal table.

I_SOBID is a table with three entries and only one field 'sobid'.

/: PERFORM GET_INTERNAL_TABLE IN PROGRAM Z_TEST_FORM

/: USING &PPVAR-KOBJD&

/: USING &PPVAR-KBGDA&

/: USING &PPVAR-KNDDA&

/: USING &PPVAR-KOBJD&

/: CHANGING &I_SOBID&.

/: ENDPERFORM.

ST

ST &T_BRANCH_ADDRESS& &I_SOBID& &I_SOBID-SOBID&

ST is a standard paragraph.

Please let know whether i am passing the values in script in an incorrect manner.

I am passing it as shown above to check if any of the three passing methods(&T_BRANCH_ADDRESS&, &I_SOBID& , and &I_SOBID-SOBID&) work.

Programme:--->

I_SOBID is being populated in the follw=owing manner.

FORM GET_INTERNAL_TABLE.

wa_sobid-sobid = 'ese'.

APPEND wa_sobid to i_sobid.

wa_sobid-sobid = 'sse'.

APPEND wa_sobid to i_sobid.

wa_sobid-sobid = 'jse'.

APPEND wa_sobid to i_sobid.

PERFORM write_window_e USING 'I_SOBID'.

Inside the perform:

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = p_ELEMENT

WINDOW = 'MAIN'

.

IF sy-subrc <> 0.

PERFORM protocol_update.

ENDIF.

ENDFORM.

Is it necessary to write the functions OPEN_FORM , ClOSE_FORM also

as these functions are already taken care of in the standard driver programme of the Script.

Thanks.

Edited by: mukul Kamat on Jun 15, 2009 12:07 PM

Edited by: mukul Kamat on Jun 15, 2009 12:30 PM

Edited by: mukul Kamat on Jun 15, 2009 12:39 PM

Former Member
0 Kudos

Hi,

For to get the required data in the form. the code you written is

: PERFORM GET_INTERNAL_TABLE IN PROGRAM Z_TEST_FORM

/: USING &PPVAR-KOBJD&

/: USING &PPVAR-KBGDA&

/: USING &PPVAR-KNDDA&

/: USING &PPVAR-KOBJD&

/: CHANGING &I_SOBID&.

/: ENDPERFORM.

here the problem is you are doing /: CHANGING &I_SOBID&., this will not work, for that you have to use fields only in changing. you are calling the perform in main window. So no problem, it will call the form for three times as per mentioned logic.

EX: PERFORM GET_INTERNAL_TABLE IN PROGRAM Z_TEST_FORM

/: USING &PPVAR-KOBJD&

/: USING &PPVAR-KBGDA&

/: USING &PPVAR-KNDDA&

/: USING &PPVAR-KOBJD&

/: CHANGING &1&.

/: CHANGING &2&.

/: CHANGING &3&.

/: ENDPERFORM.

print the variables 1,2,3 where ever you want.

regards

Hari Reddy.