SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Add Comment to CALL FUNCTION Pattern via Clipboard



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ABAP Dictionary
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1640

PostPosted: Sun Nov 04, 2007 5:55 pm    Post subject: Add Comment to CALL FUNCTION Pattern via Clipboard Reply with quote

Commented CALL FUNCTION Pattern

This 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:

Code:

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:
Code:
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


Code:

*&---------------------------------------------------------------------*
*&     Beautiful Function Module Call via clipboard                    *
*&---------------------------------------------------------------------*

* Author Jayanta Narayan Choudhuri
*         Flat 302
*         395 Jodhpur Park
*         Kolkata 700 068
*       Email [email protected]
*       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.

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.

TRANSLATE p_func TO LOWER CASE.

CONCATENATE  `CALL FUNCTION ` p_func  `   " ` funcdesc
                                  INTO mtab_new_prog-line.
APPEND mtab_new_prog.

TRANSLATE p_func TO UPPER CASE.

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.


LOOP AT i_tab.
  AT NEW paramtype.
    CASE i_tab-paramtype.
      WHEN 'C'.
        MOVE '  CHANGING' TO mtab_new_prog-line.
      WHEN 'E'.
        MOVE '  IMPORTING' TO mtab_new_prog-line.
      WHEN 'I'.
        MOVE '  EXPORTING' TO mtab_new_prog-line.
      WHEN 'T'.
        MOVE '  TABLES' TO mtab_new_prog-line.
      WHEN 'X'.
        MOVE '  EXCEPTIONS' TO mtab_new_prog-line.
    ENDCASE.
    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>clipboard_export
  IMPORTING
    data = mtab_new_prog[]
  CHANGING
    rc   = myrc.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ABAP Dictionary All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.