Commented CALL FUNCTION Pattern
Warning: Undefined variable $saptab in /customers/b/9/9/trailsap.com/httpd.www/page/loadpagefile.php on line 44This program provides a commented CALL FUNCTION Pattern. Simply execute this program, entering the desired function module name and it will place the commented pattern output into clipboard ready for pasting back.
Using standard pattern functionality:
CALL FUNCTION 'POPUP_WITH_TABLE_DISPLAY' EXPORTING endpos_col = endpos_row = startpos_col = startpos_row = titletext = * IMPORTING * CHOISE = tables valuetab = * EXCEPTIONS * BREAK_OFF = 1 * OTHERS = 2 .
Using below abap code pattern functionality:
CALL FUNCTION popup_with_table_display " IMPORTING choise = " sy-tabix Number of table entry EXPORTING endpos_col = " int4 Ending position of popup endpos_row = " int4 Ending position of popup startpos_col = " int4 Starting position of popup startpos_row = " int4 Starting position of popup titletext = " char80 Text in title bar of popup TABLES valuetab = " Table with possible values . " POPUP_WITH_TABLE_DISPLAY
A big thank you to Jayanta for submitting this program to the sapdevelopment.co.uk web community. If you have any queries or suggestions then please feel free to contact Jayanta or myself.
*&-------------------------------------------------------------* *& Beautiful Function Module Call via clipboard * *&-------------------------------------------------------------* * Author Jayanta Narayan Choudhuri * Flat 302 * 395 Jodhpur Park * Kolkata 700 068 * Email sss@cal.vsnl.net.in * URL: http://www.geocities.com/ojnc *--------------------------------------------------------------- * This program takes a parameter as a Function Module Name * and does a documented "pattern paste" * Returns pattern Code Via ClipBoard *--------------------------------------------------------------- PROGRAM zclip_pattern. PARAMETERS: p_func LIKE fupararef-funcname. " Name of Function Module DATA : BEGIN OF i_tab OCCURS 0, funcname LIKE fupararef-funcname, " Name of Function Module paramtype LIKE fupararef-paramtype, " Parameter type pposition LIKE fupararef-pposition, " Internal Table, Current Line Index optional LIKE fupararef-optional, " Optional parameters parameter LIKE fupararef-parameter, " Parameter name defaultval LIKE fupararef-defaultval, " Default value for import parameter structure LIKE fupararef-structure, " Associated Type of an Interface Parameter stext LIKE funct-stext, " Short text END OF i_tab. DATA: BEGIN OF mtab_new_prog OCCURS 0, line(172) TYPE c, END OF mtab_new_prog. DATA: funcdesc LIKE tftit-stext, " Short text for function module mylen TYPE i, myrc TYPE i. data: so_paramt type RANGE OF fupararef-paramtype, wa_paramt like line of so_paramt. CONSTANTS: myhats(40) VALUE '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^'. TRANSLATE p_func TO UPPER CASE. SELECT SINGLE tftit~stext " Short text for function module INTO funcdesc FROM tftit WHERE tftit~funcname = p_func AND tftit~spras = sy-langu. CONCATENATE 'CALL FUNCTION ''' p_func ''' "' funcdesc INTO mtab_new_prog-line. APPEND mtab_new_prog. SELECT fupararef~funcname " Name of Function Module fupararef~paramtype " Parameter type fupararef~pposition " Internal Table, Current Line Index fupararef~optional " Optional parameters fupararef~parameter " Parameter name fupararef~defaultval " Default value for import parameter fupararef~structure " Associated Type of an Interface Parameter funct~stext " Short text INTO TABLE i_tab FROM fupararef INNER JOIN funct ON fupararef~funcname = funct~funcname AND fupararef~parameter = funct~parameter AND funct~spras = sy-langu WHERE fupararef~funcname = p_func AND fupararef~r3state = 'A' ORDER BY fupararef~paramtype fupararef~pposition. do. "BEGIN - Added by SAPDev to ensure patteren is created in correct order refresh so_paramt. wa_paramt-sign = 'I'. wa_paramt-option = 'EQ'. case sy-index. when 1. wa_paramt-low = 'I'. when 2. wa_paramt-low = 'E'. when 3. wa_paramt-low = 'T'. when 4. wa_paramt-low = 'C'. when 5. wa_paramt-low = 'X'. when others. exit. endcase. append wa_paramt to so_paramt. "END LOOP AT i_tab where paramtype in so_paramt. AT NEW paramtype. "BEGIN - Modified by SAPDev to ensure correct statements are commented CASE i_tab-paramtype. WHEN 'C'. READ TABLE i_tab WITH KEY paramtype = 'C' optional = ' '. if sy-subrc eq 0. MOVE ' CHANGING' TO mtab_new_prog-line. else. MOVE '* CHANGING' TO mtab_new_prog-line. endif. WHEN 'E'. READ TABLE i_tab WITH KEY paramtype = 'E' optional = ' '. if sy-subrc eq 0. MOVE ' IMPORTING' TO mtab_new_prog-line. else. MOVE '* IMPORTING' TO mtab_new_prog-line. endif. WHEN 'I'. READ TABLE i_tab WITH KEY paramtype = 'I' optional = ' '. if sy-subrc eq 0. MOVE ' EXPORTING' TO mtab_new_prog-line. else. MOVE '* EXPORTING' TO mtab_new_prog-line. endif. WHEN 'T'. READ TABLE i_tab WITH KEY paramtype = 'T' optional = ' '. if sy-subrc eq 0. MOVE ' TABLES' TO mtab_new_prog-line. else. MOVE '* TABLES' TO mtab_new_prog-line. endif. WHEN 'X'. READ TABLE i_tab WITH KEY paramtype = 'X' optional = ' '. if sy-subrc eq 0. MOVE ' EXCEPTIONS' TO mtab_new_prog-line. else. MOVE '* EXCEPTIONS' TO mtab_new_prog-line. endif. ENDCASE. "END APPEND mtab_new_prog. ENDAT. IF i_tab-optional = 'X'. mtab_new_prog-line = `*^^^`. ELSE. mtab_new_prog-line = `^^^^`. ENDIF. IF i_tab-paramtype = 'X'. MOVE i_tab-pposition TO i_tab-defaultval. CONDENSE i_tab-defaultval. ELSE. TRANSLATE i_tab-parameter TO LOWER CASE. ENDIF. CONCATENATE mtab_new_prog-line i_tab-parameter '^=^' INTO mtab_new_prog-line. IF i_tab-defaultval IS NOT INITIAL. CONCATENATE mtab_new_prog-line i_tab-defaultval INTO mtab_new_prog-line. ENDIF. mylen = STRLEN( mtab_new_prog-line ). IF mylen < 31. COMPUTE mylen = 31 - mylen. ELSE. MOVE 1 TO mylen. ENDIF. TRANSLATE i_tab-structure TO LOWER CASE. CONCATENATE mtab_new_prog-line myhats+0(mylen) ` " ` i_tab-structure INTO mtab_new_prog-line. mylen = STRLEN( mtab_new_prog-line ). IF mylen < 47. COMPUTE mylen = 47 - mylen. ELSE. MOVE 1 TO mylen. ENDIF. CONCATENATE mtab_new_prog-line myhats+0(mylen) ` ` i_tab-stext INTO mtab_new_prog-line. APPEND mtab_new_prog. ENDLOOP. " LOOP AT I_TAB enddo. CONCATENATE ` . " ` p_func INTO mtab_new_prog-line. APPEND mtab_new_prog. LOOP AT mtab_new_prog. TRANSLATE mtab_new_prog-line USING `^ `. MODIFY mtab_new_prog. IF mtab_new_prog = space. SKIP 1. ENDIF. WRITE: / mtab_new_prog. ENDLOOP. " LOOP AT MTAB_NEW_PROG * Write the beautiful program code to ClipBoard from internal table CALL METHOD cl_gui_frontend_services=>clipboard_export IMPORTING data = mtab_new_prog[] CHANGING rc = myrc.
Return to bespoke ABAP programs
Related Articles
Improved ABAP Pretty Print program to beautify your code
Bespoke ABAP program (download employee data)
Most drawn lottery numbers ABAP program for SAP system
ABAP lottery numbers report for SAP system - User guide
Bespoke ABAP program (select staff by postcode)
Bespoke ABAP program (select staff by postcode)
Execute SQL statements on the fly in Open or Native SQL