Application Development 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: 

HOw can we Call Subroutine in Sap Script?

Former Member
0 Kudos

HOw can we Call Subroutine in Sap Script?

3 REPLIES 3

Former Member
0 Kudos

Hi

Go through the following link

http://www.allinterview.com/showanswers/37425.html

<b>Rewards Point if Useful</b>

Regards

Saket Sharma

Former Member
0 Kudos

Hi 
*You have to call sub routine from script like this.

/:   PERFORM DATE_FORMAT IN PROGRAM &SY-REPID&
/:   USING &RM06P-LFDAT&
/:   USING &PEKKO-LFDAT&
/:   CHANGING &VALUE_OLD&
/:   CHANGING &VALUE_NEW&
/:   ENDPERFORM

*In print program write code.
FORM date_format TABLES in_tab STRUCTURE itcsy
out_tab STRUCTURE itcsy.

  DATA : date TYPE char10.
  DATA : date2 TYPE char10.
  DATA : l_dmbtr TYPE char10.

  READ TABLE in_tab WITH KEY 'RM06P-LFDAT'.
  IF sy-subrc = 0.
    "Your code goes here
    CLEAR l_dmbtr.
  ENDIF.

  READ TABLE in_tab WITH KEY 'PEKKO-LFDAT'.
  IF sy-subrc = 0.
    l_dmbtr = in_tab-value.
    "Your code goes here
    CLEAR l_dmbtr.
  ENDIF.

  READ TABLE out_tab WITH KEY 'VALUE_NEW'.
    IF sy-subrc EQ 0.
        out_tab-value = date2.
        MODIFY out_tab INDEX sy-tabix.
    ENDIF.
  READ TABLE out_tab WITH KEY 'VALUE_OLD'.
    IF sy-subrc = 0.
        out_tab-value = l_dmbtr.
        MODIFY out_tab INDEX sy-tabix.
    ENDIF.
ENDFORM.            "DATE_FORMAT