‎2012 Jan 18 12:19 PM
Hi all,
I want to extract the parameters for a given function module. I found this FM RPY_FUNCTIONMODULE_READ_NEW is useful for that. But I want the parameter attributes in more detail, like whether the parameter is table or structure or variable. If structure, its components, component's dictionary type, etc. I want to know, is there any other function modules or methods, that return the parameters of FM in detail.
‎2012 Jan 18 5:56 PM
‎2012 Jan 18 12:29 PM
if the type has a '-' in it that means its for a structure or a table else its a data element.
now if '-' is there then pass the first part of it to dd02L. and pick the table category
TRANSP Transparent table
INTTAB Structure
please search a bit, we posted 3 threads for the same requirement today
‎2012 Jan 18 5:56 PM
‎2012 Jan 19 9:17 AM
hi ricardo,
that link was really useful.. i found RFC_GET_FUNCTION_INTERFACE_US very useful. Still have some problems. The changing, exporting parameters may contain, structures, tables, variables. Need to differentiate between that .
Thank you
‎2012 Jan 19 9:35 AM
Hi,
You can find the type in table TADIR, searching by field OBJ_NAME. Here you have the field OBJECT that indicates the object type. Or as said Soumyaprakash in table DD02L.
If it's a table or a structure you can find all its components in table DD03L.
Hope this help you.
‎2012 Jan 19 9:45 AM
The changing, exporting parameters may contain, structures, tables, variables. Need to differentiate between that .
aby,
that was the sole suppose of me telling you about DD02L
‎2012 Jan 19 9:46 AM
Hello ,
You will have to use the FM 'RFC_GET_STRUCTURE_DEFINITION' in conjunction with the FM RFC_GET_FUNCTION_INTERFACE_US to get the desired details.
Regards,
Rajesh
‎2012 Jan 19 9:51 AM
hi ricardo,
Finding all the components and their technical details, that I have already done using the help of RTTS classes. But the issue is, since the FM return only the structure type, i am not able to find dynamically whether its a structure or internal table. In my requirement the output table should mention whether its a structure or internal table.
Thank you
‎2012 Jan 19 10:02 AM
the out of RFC_GET_FUNCTION_INTERFACE_US is like this
PARAMCLASS I ==> i means import, E is export, T is table..
PARAMETER WAIT
TABNAME BAPITA
FIELDNAME WAIT
so a combination of paramclass and tabname can help you determine if its a table or a structure
if I or E and a tabname is not a 'table type' then its a structure
if I or E and a tabname is a 'table type' then its a table
if T then its a table
‎2012 Jan 19 10:05 AM
hi soumyaprakash,
for example, if the iput is BAPI_PO_CREATE...
In input parameter it has a structure po_header type BAPIEKKOC
and in Tables po_item type BAPIEKPOC.
Like that in changing and exporting parameter there could be tables and structures. Then how would i find whether that is a internal table or structure?
Thanks
‎2012 Jan 19 10:20 AM
I will give you an example
P PARAMETER TABNAME
I PO_HEADER BAPIEKKOC ==> PO_HEADER will be a structure as BAPIEKKOC is not in DD40L(so its not a table type)
E PURCHASEORDER BAPIEKKOC ==> same as above
T PO_ITEMS BAPIEKPOC ==>po_item is a internal table
T RETURN BAPIRETURN ==> return is a internal table
‎2012 Jan 30 10:08 AM
hi Soumyaprakash,
Thanks for your great help. Your method is ok. In my case, I have to loop the changing and export parameter table. So if I use your method I have to write the SELECT statements inside the loop, which I feel not as an optimized way. Instead, I have tried another way using the help of RTTI Classes and found helpful. Below am adding the sample code.
DATA: lo_tabledescr TYPE REF TO cl_abap_tabledescr,
lo_structdescr TYPE REF TO cl_abap_structdescr,
lo_elemdescr TYPE REF TO cl_abap_elemdescr,
lv_linetypename TYPE string,
t_tabdescr TYPE abap_compdescr_tab.
CALL FUNCTION 'RPY_FUNCTIONMODULE_READ_NEW'
EXPORTING
functionname = 'BAPI_PO_CREATE'
TABLES
import_parameter = t_imp_para
changing_parameter = t_cha_para
export_parameter = t_exp_para
tables_parameter = t_tab_para
exception_list = t_exc_list
documentation = t_docu
SOURCE = t_source.
LOOP AT t_cha_para INTO x_cha_para.
TRY.
**If this try is success then it is a table type. If its fails it goes to next TRY for Structure type.
**Note: To create a table in Changing Parameter, the type should be a dictionary table type.
lo_tabledescr ?= cl_abap_typedescr=>describe_by_name( x_cha_para-dbfield ).
lo_structdescr ?= lo_tabledescr->get_table_line_type( ).
lv_linetypename = lo_structdescr->get_relative_name( ).
lo_structdescr ?= cl_abap_typedescr=>describe_by_name( lv_linetypename ).
t_tabdescr[] = lo_structdescr->components[].
CATCH cx_root.
TRY.
**If this try is success then it is a structure type.
lo_structdescr ?= cl_abap_typedescr=>describe_by_data( x_cha_para-dbfield ).
t_tabdescr[] = lo_structdescr->components[].
CATCH cx_root.
**If both the above TRY throws exception, it means its a variable.
lo_elemdescr ?= cl_abap_typedescr=>describe_by_name( x_cha_para-dbfield ).
ENDTRY.
ENDTRY.
ENDLOOP.********************
There may be other solution for this requirement. Since my issue is solved, am closing this thread. Thanks all for your great support.