2011 Aug 11 7:12 AM
Hi all,
can anybody suggest me how to handle import, export and tables parameters in a dynamic function module call if they are associated with TABLE types.
2011 Aug 11 8:36 AM
You might be interested in reading this [http://help.sap.com/abapdocu_702/en/abapcall_function_dynamic.htm].
Hi sam,
for the dynamic function call, you can create whatever data type you need: Define a varfiable, i.e. lr_any type ref to data and a field-symbol type any table.
Then, according to FM interface description, you can
CREATE DATA lr_any TYPE TABLE OF (<structure type>) or
CREATE DATA lr_any TYPE (<table type>) .Then
assign lr_any->* to <field-symbol>.and pass it to function module parameter.
For the pure-character data exchange with external system you may dynamically assign the components to field-symbol, put content into string and concatenate all the strings by tabulator, i.e.
FIELD-SYMBOLS:
<record> TYPE ANY,
<field> TYPE any.
DATA:
lv_field TYPE string
lv_record TYPE string,
lt_output TYPE TABLE of STRING.
LOOP AT <any> ASSIGNING <record>.
DO.
ASSIGN COMPONENT sy-index OF STRUCTURE <record> TO <field>.
IF sy-subrc = 0.
lv_field = <field>.
IF lv_record IS INITIAL.
lv_record = lv_field.
ELSE.
CONCATENATE lv_record lv_field INTO lv_record
SEPARATED BY cl_abap_char_utilities=>hoizontal_tab.
ENDIF
ELSE.
EXIT." DO
ENDIF.
ENDDO.
APPEND lv_record TO lt_output.
CLEAR lv_record.
ENDLOOP.This is the way to return data to external call. If you want to receive data from external system, it would be the other way round.
Regards
Clemens
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |