Hi Experts,
I have a requirment , where when-ever a vendor is created it data is to be captured from table (LFA1).
i.e i just have to fetch the data from LFA1 table , But i an internal table where field name and field value are present.
Like :- Internal table
Component Field Name Field value
Mandt Mandt 020
LIFNR LIFNR 111111111
NAME1 NAME1 Prashant
NAME2 NAME2 Singh
I request you all to please help in developing a logic for the afore said requirment.
Thanks a lot
reagards
Prashant
Request clarification before answering.
hi,
use cl_abap_typedescr to get component names and use field symbol to get value.
-
PARAMETERS: p_lifnr type LIFNR.
data: l_wa type lfa1.
FIELD-SYMBOLS: <fs> type any.
DATA: ref_descr TYPE REF TO cl_abap_structdescr,
wa_comp TYPE abap_compdescr.
select SINGLE * from lfa1 into l_wa where lifnr = p_lifnr.
ref_descr ?= cl_abap_typedescr=>describe_by_data( l_wa ).
LOOP AT ref_descr->components INTO wa_comp.
assign COMPONENT wa_comp-name of STRUCTURE l_wa to <fs>.
write:/ wa_comp-name , ' value:', <fs>.
ENDLOOP.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 14 | |
| 13 | |
| 7 | |
| 7 | |
| 5 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.