‎2009 Aug 03 6:07 AM
Hello Experts,
Im trying to use a dynamic internal table for mapping data from VBRK & VBRP into a single final structure, without creating a 'Z' structure or a final table defining all the fields.
my code looks like this:
FORM format_data .
DATA: new_line TYPE REF TO data.
FIELD-SYMBOLS: <fs> type any.
CREATE DATA new_line LIKE LINE OF <dyntable>.
ASSIGN new_line->* TO <fs>.
LOOP AT t_vbrk ASSIGNING <fs_vbrk>.
ASSIGN COMPONENT sy-index OF STRUCTURE <fs_vbrk> TO <fs>.
INSERT <fs> INTO TABLE <dyntable>.
ENDLOOP.
ENDFORM. " FORMAT_DATA
Here <dyntable> is the table containing fields combined from VBRK & VBRP, exclusing those which are common for both.
Moreover <fs> also has the same structure as <dyntable>. Even then im getting a dump in the insert statement.
DUMP ERROR:
Line types of an internal table and a work area not compatible.
In this case, the condition is not satisfied because the internal table
"<DYNTABLE>" has the line type "u" and the length 1672, but the work area " wa"
has the type "IT_VBRK" and the length 1672.
im passing the following into lt structure:
DATA: lt TYPE lvc_t_fcat.
DATA: ls TYPE lvc_s_fcat.
LOOP AT ddfields.
READ TABLE lt INTO ls WITH KEY fieldname = ddfields-fieldname.
IF sy-subrc <> 0.
ls-fieldname = ddfields-fieldname.
ls-ref_field = ddfields-fieldname.
ls-ref_table = iname-low.
APPEND ls TO lt.
ENDIF.
ENDLOOP.
ENDLOOP.
Do i need to pass anything more?
Please help.
‎2009 Aug 03 6:12 AM
HI.
I think so you are getting DUMP by fields symbol.better clear all field symbol after reassign it
Regards.
jay
‎2009 Aug 03 6:12 AM
HI.
I think so you are getting DUMP by fields symbol.better clear all field symbol after reassign it
Regards.
jay
‎2009 Aug 03 6:45 AM
Hi Jay,
all field symbols are initial & cleared.
i've tried everything
Regards,
Amit
‎2009 Aug 03 10:22 AM
Hello all,
my problem is solved. closing this thread.
FYI.
im using move-corresponding which solved my problem
LOOP AT t_vbrk ASSIGNING <fs_vbrk>.
MOVE-CORRESPONDING <fs_vbrk> TO <fs>.
INSERT <fs> INTO TABLE <dyntable>.
ENDLOOP.
Regards,
Amit