Skip to Content
avatar image
Former Member

IDOC: table relating

Hi!

Does anyone know how which table/structure gives me a relation between a message from a SD-delivery (that creates an IDOC) and the IDOC number created?

In an SD-delivery a message is determined. The message creates an IDOC. I need a table/structure that gives me the relation between delivery number and IDOC created.

Thanks in advance,

F

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Aug 21, 2007 at 04:54 PM

    Hi Felix,

    Based on IDoc's we can get Delivery No.

    1 First Select all the IDoc from EDIDC table

    for the Message type INVOIC and Basic type INVOIC01

    *DATA: IT_EDIDC LIKE EDIDC OCCURS 0.

    SELECT DOCNUM

    FROM EDIDC

    INTO CORRESPONDING FIELDS OF TABLE IT_EDIDC

    WHERE MESTYP = 'INVOIC'

    AND IDOCTP = 'INVOIC01'.

    2 Then Select SDATA from EDID4 table

    *DATA: IT_E1EDK01 LIKE E1EDK01 OCCURS 0.

    SELECT SDATA FROM EDID4

    INTO TABLE IT_E1EDK01

    FOR ALL ENTRIES IN IT_EDIDC

    WHERE DOCNUM = IT_EDIDC-DOCNUM

    AND SEGNAM = 'E1EDK01'.

    Entries in Table IT_E1EDK01-BELNR contains Delivery No.

    Hope this help you

    Ali

    Add comment
    10|10000 characters needed characters exceeded

  • Aug 22, 2007 at 04:23 AM

    Hi..

    This program will server ur Req: Slight changes may be needed...

    REPORT ZSELIDOCS .

    tables:edid4,edidc,likp.

    *likp

    types:begin of ty_likp,

    vbeln type VBELN_VL,

    end of ty_likp.

    data:it_likp type table of ty_likp,

    wa_likp type ty_likp.

    *edid4

    types:begin of ty_edid4,

    DOCNUM type EDI_DOCNUM,

    SEGNAM type EDI_SEGNAM,

    sdata type EDI_SDATA,

    end of ty_edid4.

    data:it_edid4 type table of ty_edid4,

    wa_edid4 type ty_edid4.

    *edidc

    types:begin of ty_edidc,

    DOCNUM type EDI_DOCNUM,

    MESTYP type EDI_MESTYP,

    IDOCTP type EDI_IDOCTP,

    end of ty_edidc.

    data:it_edidc type table of ty_edidc,

    wa_edidc type ty_edidc.

    *final

    types:begin of ty_final,

    vbeln type vbeln_va,

    docnum type edi_docnum,

    sdata(10) Type C,

    • MESTYP type EDI_MESTYP,

    • IDOCTP type EDI_IDOCTP,

    end of ty_final.

    data:it_final type table of ty_final,

    wa_final type ty_final.

    parameters:s_vbeln like likp-vbeln.

    start-of-selection.

    select vbeln from likp into table it_likp where vbeln = s_vbeln.

    if sy-subrc = 0.

    select DOCNUM

    mestyp

    idoctp

    from

    edidc into table it_edidc

    where mestyp = 'DESADV'

    AND IDOCTP = 'DELVRY03'.

    if not it_edidc is initial.

    SELECT DOCNUM SEGNAM sdata from edid4 into table it_edid4 for all

    entries in it_edidc where docnum = it_edidc-docnum

    AND SEGNAM = 'E1EDL20'.

    endif.

    endif.

    clear it_final.

    loop at it_likp into wa_likp.

    read table it_edid4 into wa_edid4 with key sdata+0(10) = wa_likp-vbeln.

    IF SY-SUBRC = 0.

    move: wa_edid4-sdata+0(10) to wa_final-sdata,

    wa_edid4-docnum to wa_final-docnum.

    move wa_likp-vbeln to wa_final-vbeln.

    append wa_final to it_final.

    CLEAR WA_FINAL.

    ENDIF.

    endloop.

    loop at it_final into wa_final.

    write:/ wa_final-vbeln,

    wa_final-docnum,'|',

    wa_final-sdata.

    endloop.

    <b>Reward if Helpful</b>

    Add comment
    10|10000 characters needed characters exceeded