Skip to Content
0
Former Member
Nov 09, 2012 at 03:51 PM

How to get BKPF-BELNR from VF01 / RV_INVOICE_DOCUMMENT_ADD

219 Views

Hi:

i have a z enhancement of RV_INVOICE_DOCUMENT_ADD in VF01 that is working fine, but there is an issue every day with the VERY FIRST INVOICE that is created, the problem is that we can't reach the BELNR field from BKPF table, but, with second invoice and the nexts there is no problem.

i've tryied in 3 different ways with a WAIT UP TO 3 SECONDS before the:

1) a SELECT SINGLE sentense pointing to BKPF table

2) a FM AC_DOCUMENT_RECORD to get the record from BKPF

CALL FUNCTION 'AC_DOCUMENT_RECORD'

EXPORTING

i_awtyp = p_awtyp

i_awref = p_awref

X_DIALOG = P_DIALOG

TABLES

T_DOCUMENTS = t_docs

EXCEPTIONS

NO_REFERENCE = 1

NO_DOCUMENT = 2

OTHERS = 3.

3) a home made Z FM to read the BKPF table

CALL FUNCTION 'ZBELNR'

EXPORTING

PAWREF = awref

IMPORTING

PBELNR = zz_belnr

Allways, in the fist invoice i can't reach the BKPF table with AWREF value, but if i run TCODE SE16 and place in XBLNR the AWREF value it returns a record.

so why inside the enhacenment i cant reach that record an outside of it i can..? it seems like the enhacenment is sleeping....then awake.

Any help.

David Fúnez

Tegucigalpa, Honduras