‎2005 Jun 21 2:54 PM
hello everyone..
culd u plz tell how to move vbeln from vbak and vbeln from vbrk to an internal table..as both the vbeln's are different.and primary key is vbeln.
‎2005 Jun 21 2:59 PM
Hi Madhu,
Is this what you're looking for ?
DATA LT_VBELN TYPE TABLE OF VBELN .
SELECT VBELN
FROM VBAK
INTO TABLE LT_VBELN.
SELECT VBELN
FROM VBAK
APPENDING TABLE LT_VBELN.Regards,
Anand Mandalika.
‎2005 Jun 21 2:59 PM
Hi Madhu,
Is this what you're looking for ?
DATA LT_VBELN TYPE TABLE OF VBELN .
SELECT VBELN
FROM VBAK
INTO TABLE LT_VBELN.
SELECT VBELN
FROM VBAK
APPENDING TABLE LT_VBELN.Regards,
Anand Mandalika.
‎2005 Jun 21 3:13 PM
Hello Madhu,
I guess your are looking for Billing Documnet for a given sales order.
If you just need the Billing Documnet number , Go to table VBFA fetch the data passing Sales order number .
select VBELN
POSNR
into table it_coll_bill
from vbfa
where vbelv = salesorder number and
posnr = sales item and
vbtyp_n = 'M'. " Invoice doc
If need some more information for the document you could always go to VBRK and fecth the data for all entries of VBELN of it_coll_bill.
Let us know if you need anythign else.
Rgds,
Mano Sri
‎2005 Jun 21 3:50 PM
hi mano sri..
yes i am looking for billing document number for an sales order number, i want to display vbeln, kunnr from vbak, netwr zmeng from vbap and vbeln from vbrk.
so i have taken 4 internal tables, i have selected data from from vbak and vbap and placed in 2 different internal tables, for 3rd one i mean vbrk-vbeln i am facing a problem. and one more thng i am not able to declare the vbeln twice in an internal table. i want to display vbak-vbeln and vbrk-vbeln. so i want all the data into an single internal table.
‎2005 Jun 21 3:55 PM
Hi Madhu,
2 doc number ( vbeln )It is not a problem, you can declare your final table like this :
Data : begin of t_sales occurs 0,
vbeln like vbak-vbeln,
kunnr ....
zmeng ....
vbel2 like vbrk-vbeln, "This one for invoice N°
‎2005 Jun 21 4:10 PM
Hello Madhu,
Types : begin of t_tab,
vbeln type vbak-vbeln,
kunnr type vbak-kunnr,
netwr type vbap-netwr,
zmeng type vbap-zmeng,
Billvbeln type vbrk-vbeln,
end of t_tab.
data : it_tab type standard table of t_tab with header line.
select vbak~vbeln
vbak~kunnr
vbap~netwr
vbap~zmeng
vbfa~vbeln as billvbeln
into table it_tab
from vbak
inner join vbfa on
vbakvbeln = vbfavbelv
inner join vbap on
vbakvbeln = vbapvbeln
where vbfa~vbtyp_n = 'M'.
This should help you.
Let me knwo if it works.
Mano Sri
‎2005 Jun 21 3:03 PM
Hi madhu,
One way is to populate them first into 2 different internal tables and then append one into the other using append statement. For further problem, plz revert back.
Thanks & Regds,
Ravikiran.
‎2005 Jun 21 3:03 PM
I'm pretty sure that VBRK-XBLNR (billing reference document) refers back to the sales document VBAK-VBELN.
If not, there are some document history tables that should help.
Rob
‎2005 Jun 21 4:30 PM
If you are looking for billing document number for sales orders (I.E. you have a sales order and want the billing documents), you have to use table VBFA (Sales Document Flow). Use the sales order number VBAK-VBELN to get rows from this table.
VBFA-VBELV is the sales order document and VBFA-VBELN is the billing document. You will have to check VBFA-VBTYP_N (Subsequent document category) to make sure you get billing documents (probably M and N). So you then go back to VBRK to get the billing documents.
Also be aware that a sales document may ahve many billing documents.
Rob
‎2005 Jun 21 4:33 PM
You may also find this function module (BAPI) useful: 'BAPI_BILLINGDOC_GETLIST'. Even if the BAPI itself does not fit your needs, you can examine the source code to see how SAP decided to get the billing documents for a given set of preceding documents (including sales order).
Regards,
James Gaddis