cancel
Showing results for 
Search instead for 
Did you mean: 

DB between subroutines used in reports and scripts

Former Member
0 Kudos

Hi,

Pls let me know the difference between subroutines used in scripts and the subroutines used in reports

regards

Saravan

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos
Former Member
0 Kudos

not much of a difference except as folows:

You can call an ABAP subroutine from SapScript using the PERFORM statment. You can use this to get data without havning to cnahge the print program. In the examole below NAME is retreived from table SCUSTOM.

SapScript

/:DEFINE &CUST& = '00000021'.

/:PERFORM GET_NAME IN PROGRAM Z_BC460_EX4_HF

/: USING &CUST&

/: CHANGING &NAME&

/:ENDPERFORM.

Dear &NAME&

The ABAP routine

The ABAP routine could be defined as follows:

IMPORTANT: The structure itcsy must be used for the parameters.

REPORT Z_HENRIKF_SCRIPT_FORM .

TABLES scustom.

FORM get_name tables in_tab structure itcsy out_tab structure itcsy.

read table in_tab index 1.

select single * from scustom

where id = in_tab-value.

if sy-subrc = 0.

read table out_tab index 1.

move scustom-name to out_tab-value.

modify out_tab index sy-tabix.

else.

read table out_tab index 1.

move 'No name' to out_tab-value.

modify out_tab index sy-tabix.

endif.

ENDFORM.

Note that if you use more than one parameter you must use Using or Changing before every parameter !

/: PERFORM <form> IN PROGRAM <prog>

/: USING &INVAR1&

/: USING &INVAR2&

......

/: CHANGING &OUTVAR1&

/: CHANGING &OUTVAR2&

......

/: ENDPERFORM

Former Member
0 Kudos

Hi,

The subroutines in scripts are called dynamic subroutines because you don't have a perform statement in the program

where as in reports you need to use perform statement to call the subroutine.

regards

padma