2007 Jul 11 8:43 AM
Hi,
for an sales order i found some entries in the VBFA and have will fill this
data in an internal table. I have to select only delivery, goods movement and Invoice for an sales order. Finding this data is no problem but i have problems
to fill the internal table.
DATA: begin of itab occurs 0,
vbeln_s like vbfa-vbelv, "Sales Order
vbeln_j like vbfa-vbeln, "Delivery
vbeln_r like vbfa-vbeln, "Goods movement
vbeln_m like vbfa-vbeln, "Invoice.
end of itab.
the itab shell be filled like this with 3 Deliveries and 5 invoices:
vbeln_s vbeln_j vbeln_r vbeln_m
2121 80000001 4900000001 90000001
2121 80000002 4900000002 90000002
2121 80000003 4900000003 90000003
2121 90000004
2121 90000005
Any idea? Thanks.
Regards, Dieter
The values 90000004 and 90000005 shell be under vbeln_M
Dieter
Message was edited by:
Dieter Gröhn
2007 Jul 11 9:13 AM
HI,
data : begin of itemp occurs 0,
vbeln_r like vbfa-vbeln, "Goods movement
vbeln_m like vbfa-vbeln, "Invoice.
end of itemp.
DATA: begin of itab occurs 0,
vbeln_s like vbfa-vbelv, "Sales Order
vbeln_j like vbfa-vbeln, "Delivery
<b>---> Include table i_temp here</b>
end of itab.
Best regards,
Prashant
2007 Jul 11 8:46 AM
Use FM - 'RV_ORDER_FLOW_INFORMATION'
Call the FM RV_ORDER_FLOW_INFORMATION to get the subsequent document for the corresponding sales document.
Reward points if helpful
Message was edited by:
Mayank Agarwal
2007 Jul 11 9:07 AM
Hi Mayak,
the problem is not to get the data. My problem is to fill the internal
table like i have shown.
Regards, Dieter
2007 Jul 11 9:13 AM
HI,
data : begin of itemp occurs 0,
vbeln_r like vbfa-vbeln, "Goods movement
vbeln_m like vbfa-vbeln, "Invoice.
end of itemp.
DATA: begin of itab occurs 0,
vbeln_s like vbfa-vbelv, "Sales Order
vbeln_j like vbfa-vbeln, "Delivery
<b>---> Include table i_temp here</b>
end of itab.
Best regards,
Prashant
2007 Jul 11 9:31 AM
Hi Prashant,
here my code
TABLES: VBFA. "Vertriebsbelegfluß
*
TYPES: BEGIN OF S_ITAB,
VBELN LIKE VBAK-VBELN,
VBELL LIKE LIKP-VBELN,
VBELM LIKE MKPF-MBLNR,
VBELF LIKE VBRK-VBELN,
END OF S_ITAB.
*
DATA: ITAB TYPE TABLE OF S_ITAB.
DATA: WA_ITAB TYPE S_ITAB.
*
DATA: VBELN LIKE VBFA-VBELN VALUE '0000001499'.
*
SELECT * FROM VBFA WHERE VBELV = VBELN.
WA_ITAB-VBELN = VBFA-VBELV.
CASE VBFA-VBTYP_N.
WHEN 'J'. "Lieferung
WA_ITAB-VBELL = VBFA-VBELN.
COLLECT WA_ITAB INTO ITAB.
WHEN 'R'. "Warenbewegung
WA_ITAB-VBELM = VBFA-VBELN.
COLLECT WA_ITAB INTO ITAB.
WHEN 'M'. "Faktura
WA_ITAB-VBELF = VBFA-VBELN.
COLLECT WA_ITAB INTO ITAB.
ENDCASE.
ENDSELECT.
*
SORT ITAB.
*
LOOP AT ITAB INTO WA_ITAB.
WRITE: / WA_ITAB-VBELN,
WA_ITAB-VBELL,
WA_ITAB-VBELM,
WA_ITAB-VBELF.
ENDLOOP.
I get this:
but i whant this in itab:
1499 80001484 4900045286 90001971
1499 80001674 4900049657 90002222
1499 80001691 4900050223 90002244
1499 80001698 4900050453 90002245
1499 80001708 4900050809 90002255
1499 80001713 4900051111 90002268
1499 80001731 4900051530 90002276
1499 80001743 4900052390 90002299
1499 90002325
Regards, Dieter
2007 Jul 11 9:54 AM
delete itab where VBELM is initial.
delete itab where VBELF is initial.
loop at itab.
at first VBELL.
read table itab with key VBELL = itab-VBELL.
write: itab.
endat.
endloop.
Sorry AT NEW VBELL. not at first
Message was edited by:
Sumi Vasu
2007 Jul 11 9:34 AM
TABLES: VBFA. "Vertriebsbelegfluß
*
TYPES: BEGIN OF S_ITAB,
VBELN LIKE VBAK-VBELN,
VBELL LIKE LIKP-VBELN,
VBELM LIKE MKPF-MBLNR,
VBELF LIKE VBRK-VBELN,
END OF S_ITAB.
*
DATA: ITAB TYPE TABLE OF S_ITAB.
DATA: WA_ITAB TYPE S_ITAB.
*
DATA: VBELN LIKE VBFA-VBELN VALUE '0000001499'.
*
SELECT * FROM VBFA WHERE VBELV = VBELN.
WA_ITAB-VBELN = VBFA-VBELV.
CASE VBFA-VBTYP_N.
WHEN 'J'. "Lieferung
WA_ITAB-VBELL = VBFA-VBELN.
COLLECT WA_ITAB INTO ITAB.
WHEN 'R'. "Warenbewegung
WA_ITAB-VBELM = VBFA-VBELN.
COLLECT WA_ITAB INTO ITAB.
WHEN 'M'. "Faktura
WA_ITAB-VBELF = VBFA-VBELN.
COLLECT WA_ITAB INTO ITAB.
ENDCASE.
ENDSELECT.
*
SORT ITAB.
*
LOOP AT ITAB INTO WA_ITAB.
if l_vbeln ne wa_itab-vbeln.
l_vbeln = wa_itab-vebln.
ENDLOOP.
Message was edited by:
Prashant Patil
2007 Jul 11 3:49 PM
Hi,
thanks for answers!
i solve in anoter way by reading VBFA
2 times and fill 2 itabs.
After this i put this 2 itabs
to one itab.
Regards, Dieter