09-16-2014 12:11 PM
Hi.
i am struggling to pass the field sybol of type any table To the Function module in Tables parameter.
I have a dynamic internal table which i need to pass to function module F4IF_INT_TABLE_VALUE_REQUEST but i cannot pass dynamic itab to this FM. It will accept only static Itab .
Please suggest the Solution.
My code:
FIELD-SYMBOLS: <my_fs> TYPE ANY TABLE.
FIELD-SYMBOLS: <l_line3> TYPE ANY,
<ls_wa> TYPE ANY,
<ls_wa2> TYPE ANY,
<fs1> type any,
<fs2> type any.
FIELD-SYMBOLS: <my_table> TYPE STANDARD TABLE.
FIELD-SYMBOLS: <fld_f4table> TYPE STANDARD TABLE.
DATA:
i_retab TYPE TABLE OF ddshretval,
r_field TYPE dfies-fieldname,
r_dynprofield TYPE help_info-dynprofld.
DATA:
go_struct TYPE REF TO cl_abap_structdescr,
go_table TYPE REF TO cl_abap_tabledescr,
gt_comp TYPE abap_compdescr_tab,
wa_gt_comp like LINE OF gt_comp,
gs_comp_a LIKE LINE OF gt_comp,
gdo_data type ref to data,
gr TYPE REF TO data,
grf4 TYPE REF TO data.
data: dyn_table type ref to data,
dyn_line type ref to data,
wa_fcat type lvc_s_fcat,
it_fcat type lvc_t_fcat,
d_table type ref to data.
DATA: lt_fcat_lvc TYPE lvc_t_fcat,
lt_filter_lvc TYPE lvc_t_filt.
DATA: ls_row_id TYPE lvc_s_row.
DATA: ls_col_id TYPE lvc_s_col.
DATA: l_value TYPE lvc_s_data-value.
DATA gt TYPE i.
**********************************************************************
CALL METHOD gt_grid-grid->get_current_cell
IMPORTING
es_row_id = ls_row_id
es_col_id = ls_col_id
e_value = l_value.
IF <my_fs> IS NOT ASSIGNED.
ASSIGN ('T_OUTTAB[]') TO <my_fs>.
ENDIF.
IF <my_table> IS NOT ASSIGNED.
GET REFERENCE OF <my_fs> INTO gdo_data.
go_table ?= cl_abap_structdescr=>describe_by_data_ref( gdo_data ).
go_struct ?= go_table->get_table_line_type( ).
gt_comp = go_struct->components.
CREATE DATA gr TYPE HANDLE go_table.
ASSIGN gr->* TO <my_table>.
<my_table>[] = <my_fs>[].
ENDIF.
r_field = ls_col_id.
r_dynprofield = ls_col_id.
IF <fld_f4table> IS NOT ASSIGNED.
READ TABLE gt_comp INTO wa_gt_comp WITH KEY name = ls_col_id.
wa_fcat-fieldname = wa_gt_comp-name .
wa_fcat-datatype = wa_gt_comp-type_kind.
wa_fcat-inttype = wa_gt_comp-type_kind.
wa_fcat-intlen = wa_gt_comp-length.
wa_fcat-decimals = wa_gt_comp-decimals.
APPEND wa_fcat TO it_fcat.
* Create dynamic internal table and assign to Field-Symbol
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = it_fcat
IMPORTING
ep_table = d_table.
ASSIGN d_table->* TO <fld_f4table>.
ENDIF.
refresh <fld_f4table>.
ASSIGN COMPONENT r_field OF STRUCTURE <fld_f4table> TO <fs2>.
LOOP AT <my_table> ASSIGNING <ls_wa>.
ASSIGN COMPONENT r_field OF STRUCTURE <ls_wa> TO <fs1>.
append <fs1> to <fld_f4table>.
ENDLOOP.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = r_field "<---Return field column name
dynpprog = sy-repid
dynpnr = sy-dynnr
value_org = 'S'
MULTIPLE_CHOICE = 'X'
TABLES
value_tab = <fld_f4table>
return_tab = i_retab.
IF sy-subrc EQ 0.
ENDIF.
09-16-2014 7:00 PM
09-17-2014 6:41 AM
This is all the code. The fact that I had put in the processing of a button in a standard ALV SAPLSLVC_FULLSCREEN.
Table T_OUTTAB [] - a dynamic table displayed in ALV_GRID.
09-17-2014 6:57 AM
By the by - what's the point of the fld_ prefix in your field symbols. Isn't the fact that it is surrounded by < and > sufficient?
Anyway - what do you mean "cannot pass"? What error message do you get?
I suggest you use RTTS to produce your dynamic table. It doesn't have the limitations of create_dynamic_table and allows more precise typing - which may prevent the error (whatever it is) that you're getting.
09-17-2014 7:08 AM
I guess I incorrectly put about his problemmy.
The essence of the matter is, as having a dynamic table <fld_f4table> and field r_field (column) to display it to the user to select through the FM F4IF_INT_TABLE_VALUE_REQUEST.