2007 Dec 04 6:23 PM
2007 Dec 04 6:45 PM
Hi,
You can specify the name of a subroutine and, in the case of external calls, the name of the program in which it occurs, dynamically as follows:
PERFORM (<fsubr>)[IN PROGRAM (<fprog>)][USING ... <pi>... ]
[CHANGING... <pi>... ]
[IF FOUND].
The names of the subroutine and the external program are the contents of the fields <fsubr> and <fprog> respectively. By using the option IF FOUND, you can prevent a runtime error from being triggered if <fprog> does not contain a subroutine with the name <fsubr>. If you omit the parentheses, this variant of the PERFORM statement behaves like the static variant.
Regards,
Ferry Lianto
2007 Dec 04 6:45 PM
Hi,
You can specify the name of a subroutine and, in the case of external calls, the name of the program in which it occurs, dynamically as follows:
PERFORM (<fsubr>)[IN PROGRAM (<fprog>)][USING ... <pi>... ]
[CHANGING... <pi>... ]
[IF FOUND].
The names of the subroutine and the external program are the contents of the fields <fsubr> and <fprog> respectively. By using the option IF FOUND, you can prevent a runtime error from being triggered if <fprog> does not contain a subroutine with the name <fsubr>. If you omit the parentheses, this variant of the PERFORM statement behaves like the static variant.
Regards,
Ferry Lianto
2007 Dec 04 6:52 PM
Check the below example :
PERFORM write_2_server TABLES hire_emp_tab.
PERFORM write_2_server TABLES entrance_tab.
PERFORM write_2_server TABLES integration_tab.
PERFORM write_2_server TABLES duty_tab .
PERFORM write_2_server TABLES type_emp_tab.
PERFORM write_2_server TABLES job_part_tab .
PERFORM write_2_server TABLES free_days_tab.
PERFORM write_2_server TABLES status_tab.
PERFORM write_2_server TABLES bank_detailes_tab.
FORM write_2_server TABLES p_tab_data.
FIELD-SYMBOLS: <wa> TYPE ANY.
" MOVE 'D:_pa_test_mmsk_pa1.txt' TO adress.
OPEN DATASET adress IN TEXT MODE
ENCODING DEFAULT FOR OUTPUT.
IF sy-subrc = 0.
no_file = ' '.
LOOP AT p_tab_data ASSIGNING <wa>.
TRANSFER <wa> TO adress.
ENDLOOP.
CLOSE DATASET adress.
ELSE.
no_file = 'X'.
ENDIF.
endform.
you get reusability.
Thanks
Seshu