Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

how to populate the data in custom table through an inbound idoc?

i have made the code according to that but it is populating the duplicate data .

idoc struct 1 header (A) with 2 child segments (B and C)

while populate one entry in each segment, it is making one entry in table as per the requirement.

but when i am giving 2 entries in child segment B it should populate 2 entries in Ztable

instead of that 2 entries it is populating 3 entries which the 3rd entry has no data.

LOOP AT idoc_contrl ASSIGNING FIELD-SYMBOL(<ls_idoc_contrl>).

    IF <ls_idoc_contrl>-mestyp NE 'mestyp'.

      RAISE wrong_function_called.

    ENDIF.

* Before reading a new entry, clear application buffer.

    LOOP AT idoc_data[] ASSIGNING FIELD-SYMBOL(<ls_idoc_data>)

                      WHERE docnum EQ idoc_contrl-docnum.

case segmname

when segA

ls_tablefield1 = ls_idocsegfield1,

ls_tablefield2 = ls_idocsegfield2,

ls_tablefield3 = ls_idocsegfield3,

ls_tablefield4 = ls_idocsegfield4,

when segB

ls_tablefield5 = ls_idocsegfield5,

ls_tablefield6 = ls_idocsegfield6,

when segC

ls_tablefield7 = ls_idocsegfield7,

ls_tablefield8 = ls_idocsegfield8,

endcase.

modify  Ztable from ls_idocsegfiled

commit work.

      IF sy-subrc EQ 0.

        lv_edi_status = '53'.

      ELSE.

        lv_edi_status = '51'.

      ENDIF.

endloop.

endloop.

can any one tell what wrong in this code.

Former Member

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question