cancel
Showing results for 
Search instead for 
Did you mean: 
Subscribe

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

0 Likes
View Entire Topic
Former Member
0 Likes

Hello,

Please find below code :

FIELD-SYMBOLS: <fl_table> TYPE table,

<fl_value> TYPE ANY,

<fl_temp> TYPE ANY.

data : it_stru TYPE STANDARD TABLE OF dd03p.

select * from lfa1 into table it_lfa1 where ....some condition.

              • here u will get some vendors data in it_lfa1 table

assign (it_lfa1) TO <fl_table>.

CREATE DATA dref LIKE LINE OF <fl_table>.

ASSIGN dref->* TO <fl_temp>.

*Get field details of table

CALL FUNCTION 'DDIF_TABL_GET'

EXPORTING

name = ufl_str

TABLES

dd03p_tab = it_stru.

**************U will get all field names in table it_stru

LOOP AT <fl_table> ASSIGNING <fl_temp>.

LOOP AT it_stru INTO wa_stru.

ASSIGN COMPONENT wa_stru-fieldname OF STRUCTURE <fl_temp> TO

<fl_value>.

wa_output-feildname_name = wa_stru-fieldname.

wa_output-feildname_value = <fl_temp>.

append wa_output to it_output.

endloop.

endloop.

            • finally in it_output u will get field name and field value. Declare it's structure with 2 fields field_name (char50) field_value(char200).

Hope it works.....

Regards,

Yogesh.