*&---------------------------------------------------------------------*
* & Report z_get_func_des
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
Report zget_func_des.
Type-pools: slis.
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 'porting' 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.
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
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.