08-21-2007 4:48 PM
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
08-21-2007 5: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
08-21-2007 5: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
08-21-2007 6:34 PM
Hi Ali,
Surely it would help, but I would need the opposite: starting with the delivery number.
Thanks,
F
08-22-2007 4:31 AM
For reporting purpose use function module:SREL_GET_NEXT_RELATIONS
In import parameter OBJECT, fill following information
OBJKEY-->Your Delivery number.
Object Type--->LIKP
LOGSYS-->Logical system(If you are not sure simply execute function module:OWN_LOGICAL_SYSTEM_GET)
and execute.
You will see idoc in LINKS tables.
Use above logic in loop for report.
"REWARD point if useful".
Thanks,
Narayan
08-22-2007 10:12 AM
Hello Narayan,
just before you get the 10 points: I have executed the module and it worked ok with outbound deliveries, but not with inbound deliveries.
Do you know why this could be?
Regards (and thank you)
F
08-22-2007 10:07 PM
For reporting purpose use function module:SREL_GET_NEXT_RELATIONS
In import parameter OBJECT, fill following information
OBJKEY-->Your Delivery number.
Object Type--->LIKP(Outbound)
Object Type--->BUS2015(Inbound)
LOGSYS-->Logical system(If you are not sure simply execute function module:OWN_LOGICAL_SYSTEM_GET)
and execute.
You will see idoc in LINKS tables.
Use above logic in loop for report.
"REWARD point if useful".
Thanks,
Narayan
08-23-2007 9:19 AM
Hello Narayanan,
Thanks, it worked correctly.
You have been rewarded as deserved.
F
08-22-2007 5: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>