03-09-2009 9:57 AM
Please use an informative subject in future
Hi all,
How to find bill no against invoice no..?
please help me..
Edited by: Matt on Mar 9, 2009 11:05 AM
03-09-2009 10:03 AM
03-09-2009 10:03 AM
03-09-2009 10:04 AM
Use this.
[Diff between invoice and billing|https://forums.sdn.sap.com/click.jspa?searchID=23253536&messageID=3357751]
03-09-2009 10:06 AM
03-09-2009 10:07 AM
HI Ankita
tables for Bill :VBRK ,VBRP
For invoice :BKPF,BSEG
Explore both the tables .
s@chin
03-09-2009 10:32 AM
Hello Ankita,
Go for function module 'AC_DOCUMENT_RECORD'.
See this piece of code ,i also use for the same req in my report.
data it_accdoc type table of acc_doc.
loop at main_table. *table in which u capture Invoice No
call function 'AC_DOCUMENT_RECORD'
exporting
i_awtyp = 'VBRK'
i_awref = main_table-vbeln
i_aworg = wrk_aworg
i_bukrs = main_table-bukrs
x_dialog = ''
tables
t_documents = it_accdoc
exceptions
no_reference = 1
no_document = 2
others = 3.
if sy-subrc <> 0.
endif.
loop at it_accdoc into is_accdoc where awtyp = 'BKPF'.
select single bukrs belnr gjahr koart mwskz
into i_bseg from bseg
where bukrs = is_accdoc-bukrs and
belnr = is_accdoc-docnr and
gjahr = is_accdoc-ac_gjahr and koart = 'D'.
if sy-subrc = 0 .
main_table-ac_doc = is_accdoc-docnr.
modify main_table .
else.
select single bukrs belnr gjahr koart mwskz
into i_bseg from bseg
where bukrs = is_accdoc-bukrs and
belnr = is_accdoc-docnr and
gjahr = is_accdoc-ac_gjahr
and koart = 'S'.
if sy-subrc = 0.
main_table-belnr = is_accdoc-docnr.
modify main_table .
endif.
endif.
endloop.
free it_accdoc.
endif.
endloop.
Hope it helps.
In case of query revert back.
Aastha