2016 Jun 24 7:10 AM
Hallo,
I'm trying to run a generic function module call
like:
**Call of function module **************************
TRY.
CALL FUNCTION gv_function_module
PARAMETER-TABLE lt_parms[]
EXCEPTION-TABLE lt_exception[].
CATCH cx_sy_dyn_call_illegal_func.
CATCH cx_sy_dyn_call_error.
* MESSAGE ...
EXIT.
ENDTRY.
It works fine for importing and exporting parameters but I don't know how to read the
tables returned by the function module.
Thanks a lot for your help !
Volker
Example: If you see the signature of FM BAPI_MESSAGE_GETDETAIL below I can fill all importing parameters,
getting back the exporting parameters but how to get the tables parameters ?
FUNCTION BAPI_MESSAGE_GETDETAIL.
*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*" IMPORTING
*" VALUE(ID) LIKE BAPIRET2-ID
*" VALUE(NUMBER) LIKE BAPIRET2-NUMBER
*" VALUE(LANGUAGE) LIKE BAPITGA-LANGU DEFAULT SY-LANGU
*" VALUE(TEXTFORMAT) LIKE BAPITGA-TEXTFORMAT
*" VALUE(LINKPATTERN) LIKE BAPITGA-LINKMASK OPTIONAL
*" VALUE(MESSAGE_V1) LIKE BAPIRET2-MESSAGE_V1 OPTIONAL
*" VALUE(MESSAGE_V2) LIKE BAPIRET2-MESSAGE_V2 OPTIONAL
*" VALUE(MESSAGE_V3) LIKE BAPIRET2-MESSAGE_V3 OPTIONAL
*" VALUE(MESSAGE_V4) LIKE BAPIRET2-MESSAGE_V4 OPTIONAL
*" VALUE(LANGUAGE_ISO) TYPE BAPI_STAND-LANGU_ISO OPTIONAL
*" EXPORTING
*" VALUE(MESSAGE) LIKE BAPIRET2-MESSAGE
*" VALUE(RETURN) LIKE BAPIRET2 STRUCTURE BAPIRET2
*" TABLES
*" TEXT STRUCTURE BAPITGB OPTIONAL
*"----------------------------------------------------------------------
2016 Jun 24 7:27 AM
Hi,
In ABAP editor, there's an option 'Pattern'. Use that to call any FM/BAPI. Click on 'pattern' and enter FM. Un-comment required parameters under import/export/tables.
2016 Jun 24 8:53 AM
If you just read the documentation, you will have the answer -> http://help.sap.com/abapdocu_702/en/?url=ABAPCALL_FUNCTION_DYNAMIC.htm
Sorry, I understand your point. But it has been discussed many times in the forum :
First, see the answer of Tomas Buryanek about the required CREATE DATA before doing the CALL FUNCTION
Then the CALL FUNCTION
Then analyze the returned value of the internal table
FIELD-SYMBOLS <itab> TYPE standard table.
FIELD-SYMBOLS <line> TYPE any.
FIELD-SYMBOLS <field> TYPE any.
ASSIGN ref->* TO <ITAB>.
LOOP AT <itab> ASSIGNING <line>.
ASSIGN COMPONENT 1 OF STRUCTURE <line> TO <field>. " assuming line is a structure
ENDLOOP.
2016 Jun 24 8:57 AM
TABLES parameter works as both importing and exporting parameter.
So you need to prepare an entry in PARAMETER-TABLE for it:
DATA mara TYPE mara_tt.
DATA: lt_par_tab TYPE abap_func_parmbind_tab,
ls_par_tab LIKE LINE OF lt_par_tab,
lref_mara TYPE REF TO data.
CREATE DATA lref_mara LIKE mara.
ls_par_tab-name = 'MARA'.
ls_par_tab-kind = abap_func_tables. " = '30'
* ls_par_tab-value = lref_mara.
* EDIT: better this way, without lref_mara:
GET REFERENCE OF mara INTO ls_par_tab-value.
INSERT ls_par_tab INTO TABLE lt_par_tab.
CALL FUNCTION 'ZTEST_TABLE_RETURN'
PARAMETER-TABLE lt_par_tab.
"Interface:
* TABLES
* MARA = MARA.