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

HOw can we Call Subroutine in Sap Script?

Former Member
0 Likes
732

HOw can we Call Subroutine in Sap Script?

HOw can we Call Subroutine in Sap Script?

3 REPLIES 3
Read only

Former Member
0 Likes
706

Hi

Go through the following link

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

<b>Rewards Point if Useful</b>

Regards

Saket Sharma

Read only

Former Member
0 Likes
706

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