‎2009 Apr 02 5:28 AM
Hi Expert,
I want to print a customise script form in F110, I have created the script form (a cheque), however I need to call the function module 'HR_IN_CHG_INR_WRDS' in the form. Then I find out the method to call the function is by "PERFORM FUNCTION_MODULE IN PROGRAM SUBROUTINE_POOL".
How to do that ? Where should I create this subroutine_pool ? In user exit ?
Kindly brief the detail step to do so or any other solution are welcome.
Thanks in advance.
Janice
‎2009 Apr 02 5:35 AM
create one subroutine pool.
in that write one subroutine.
inside the subroutine call the FM.
call the perform in the below format.
PERFORM CHECK_NUMBER IN PROGRAM zxyz
USING &T001-BUKRS&
USING ®UH-HBKID&
USING ®UH-HKTID&
USING ®UD-CHECT&
CHANGING &L_CHECT&
ENDPERFORM
FORM check_number TABLES in_tab STRUCTURE itcsy
out_tab STRUCTURE itcsy.
READ TABLE in_tab INDEX 1.
IF sy-subrc EQ 0.
l_chect = in_tab-value.
ENDIF.
READ TABLE out_tab INDEX 1.
IF sy-subrc EQ 0.
out_tab-value = l_chect.
MODIFY out_tab INDEX 1.
ENDIF.
endform
Edited by: Phanindra Annaparthi on Apr 2, 2009 6:35 AM
‎2009 Apr 02 5:35 AM
create one subroutine pool.
in that write one subroutine.
inside the subroutine call the FM.
call the perform in the below format.
PERFORM CHECK_NUMBER IN PROGRAM zxyz
USING &T001-BUKRS&
USING ®UH-HBKID&
USING ®UH-HKTID&
USING ®UD-CHECT&
CHANGING &L_CHECT&
ENDPERFORM
FORM check_number TABLES in_tab STRUCTURE itcsy
out_tab STRUCTURE itcsy.
READ TABLE in_tab INDEX 1.
IF sy-subrc EQ 0.
l_chect = in_tab-value.
ENDIF.
READ TABLE out_tab INDEX 1.
IF sy-subrc EQ 0.
out_tab-value = l_chect.
MODIFY out_tab INDEX 1.
ENDIF.
endform
Edited by: Phanindra Annaparthi on Apr 2, 2009 6:35 AM
‎2009 Apr 02 7:02 AM
Hi Chong,
Here is a Example which clear you how to Use Subroutines in Scripts
Definition in the SAPscript form:
/: PERFORM GET_BARCODE IN PROGRAM QCJPERFO
/: USING &PAGE&
/: USING &NEXTPAGE&
/: CHANGING &BARCODE&
/: ENDPERFORM
/
/ &BARCODE&
Coding of the calling ABAP program:
REPORT QCJPERFO.
FORM GET_BARCODE TABLES IN_PAR STUCTURE ITCSY
OUT_PAR STRUCTURE ITCSY.
*Call Your Function module Anywhere in this form *
DATA: PAGNUM LIKE SY-TABIX, "page number
NEXTPAGE LIKE SY-TABIX. "number of next page
READ TABLE IN_PAR WITH KEY u2018PAGEu2019.
CHECK SY-SUBRC = 0.
PAGNUM = IN_PAR-VALUE.
READ TABLE IN_PAR WITH KEY u2018NEXTPAGEu2019.
CHECK SY-SUBRC = 0.
NEXTPAGE = IN_PAR-VALUE.
READ TABLE IN_PAR WITH KEY u2018BARCODEu2019.
CHECK SY-SUBRC = 0.
IF PAGNUM = 1.
OUT_PAR-VALUE = u2018|u2019. "First page
ELSE.
OUT_PAR-VALUE = u2018||u2019. "Next page
ENDIF.
IF NEXTPAGE = 0.
OUT_PAR-VALUE+2 = u2018Lu2019. "Flag: last page
ENDIF.
MODIFY OUT_PAR INDEX SY-TABIX.
ENDFORM.
If any doubts plese revert back,
Thanks & regards,
Dileep .C