SAP ABAP Scripts Question and Answers Part 3
1. Calling a form from SapScript (*****)
/:DEFINE &CUST& = '00000021'.
/:PERFORM GET_NAME IN PROGRAM Z_BC460_EX4_HF
/: USING &CUST&
/: CHANGING &NAME&
/:ENDPERFORM.
Dear &NAME&
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.
** You could also fill the ouput parameter table this way
READ TABLE out_par WITH KEY 'NAME1'.
out_par-value = l_name1.
MODIFY out_par INDEX sy-tabix.
endform.
Note that if you use more than one parameter you must use Using or Changing before every parameter !
/: PERFORM