Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

PERFORM FUNCTION_MODULE IN PROGRAM SUBROUTINE_POOL

Former Member
0 Likes
618

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
585

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 &REGUH-HBKID&

USING &REGUH-HKTID&

USING &REGUD-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

2 REPLIES 2
Read only

Former Member
0 Likes
586

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 &REGUH-HBKID&

USING &REGUH-HKTID&

USING &REGUD-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

Read only

Former Member
0 Likes
585

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