sample ABAP program to show how to use Sapscript PerForm Module in ABAP programs.
REPORT ZTEST0001. DATA W_LENGTH TYPE I. * GENERAL PURPOSE SUBROUTINES FOR CALLING FROM SAPSCRIPTS *———————————————————————– *———————————————————————- FORM DISPLAY_POUND TABLES IN_TAB STRUCTURE ITCSY OUT_TAB STRUCTURE ITCSY. DATA: COUNT TYPE P VALUE 16. DATA: W_VALUE(17) TYPE C. “defined as 7 chars to remove pence DATA: W_CHAR TYPE C. DATA: W_DUMMY TYPE C. DATA: W_CURR(3) TYPE C. * Get first parameter in input table. READ TABLE IN_TAB INDEX 1. WRITE IN_TAB-VALUE TO W_VALUE . * get second parameter in input table READ TABLE IN_TAB INDEX 2. MOVE IN_TAB-VALUE TO W_CURR. IF W_CURR = ‘GBP’. W_CURR = ‘£’. ENDIF. W_LENGTH = STRLEN( W_CURR ). * look for first space starting at right. WHILE COUNT > -1. W_CHAR = W_VALUE+COUNT(1). * W_CHAR = IN_TAB-VALUE+COUNT(1). IF W_CHAR = ‘ ‘. COUNT = COUNT – W_LENGTH + 1. W_VALUE+COUNT(W_LENGTH) = W_CURR. COUNT = -1. ELSE. * W_VALUE+COUNT(1) = W_CHAR. COUNT = COUNT – 1. ENDIF. ENDWHILE. * read only parameter in output table READ TABLE OUT_TAB INDEX 1. OUT_TAB-VALUE = W_VALUE. MODIFY OUT_TAB INDEX SY-TABIX. ENDFORM.
Serkan AKKAVAK Computer Engineer ABAP Developer & SAP MM SD Consultant Contact : serkurumsal@yandex.com
Social Plugin