Code: Alles auswählen.
TYPES: BEGIN OF lin_data_alvgrid,
carrid TYPE sflight-carrid,
connid TYPE sflight-connid,
fldate TYPE sflight-fldate,
price TYPE sflight-price,
currency TYPE sflight-currency,
planetype TYPE sflight-planetype,
seatsmax TYPE sflight-seatsmax,
seatsocc TYPE sflight-seatsocc,
paymentsum TYPE sflight-paymentsum,
END OF lin_data_alvgrid.
DATA: g_it_out_original TYPE TABLE OF lin_output_alvgrid,
wa_data_original TYPE lin_data_alvgrid.
START-OF-SELECTION.
SELECT SINGLE *
FROM sflight
INTO CORRESPONDING FIELDS OF wa_data_original.
PERFORM move_wa_2_it USING wa_data_original
CHANGING g_it_out_original.
*&---------------------------------------------------------------------*
*& Form move_wa_2_it
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_WA_SFLIGHT text
* <--P_G_IT_OUT_ORIGINAL text
*----------------------------------------------------------------------*
FORM move_wa_2_it USING p_wa_in
CHANGING p_it_out LIKE g_it_out_original.
DATA:struct_ref TYPE REF TO cl_abap_structdescr.
struct_ref ?= cl_abap_structdescr=>describe_by_data( p_wa_in )
.
* <hier die Freldbezeichner ermitteln>
Code: Alles auswählen.
FORM move_wa_2_it USING p_wa_in TYPE lin_data_alvgrid
CHANGING p_it_out LIKE g_it_out_original.
DATA:data_ref TYPE REF TO cl_abap_datadescr.
DATA wa_out TYPE lin_output_alvgrid.
FIELD-SYMBOLS: <fs> TYPE ANY.
DO.
ASSIGN COMPONENT sy-index OF STRUCTURE p_wa_in TO <fs>.
IF sy-subrc = 0.
data_ref ?= cl_abap_datadescr=>describe_by_data( <fs> ).
SELECT SINGLE scrtext_m
FROM dd04t
INTO wa_out-fieldname
WHERE rollname = data_ref->absolute_name+6
AND as4local = 'A'
AND ddlanguage = sy-langu.
wa_out-fieldvalue = <fs>.
APPEND wa_out TO p_it_out.
ELSE.
EXIT.
ENDIF.
ENDDO.
ENDFORM. " move_wa_2_it