‎2008 Feb 27 4:35 AM
HI EXPERTS,
I need to fetch the Billing Doc No. (VBRP-VBELN) on the base of Dilevery Doc. No. ( MSEG-XBLNR). I am passing XBLNR into VGEBL of VBRP. But it takes lots of time coz its not a PK. Is there any alternative to this.
Urgent.
Thanks.
Khan....
‎2008 Feb 27 5:43 AM
Hi Khan,
Considering getting the relation from Sales Document Flow (Table VBFA). Querying VBFA is not recommended for performance reasons, however there are function modules which optimize the query to VBFA like READ_VBFA.
Cheers.
‎2008 Feb 27 5:43 AM
Hi Khan,
Considering getting the relation from Sales Document Flow (Table VBFA). Querying VBFA is not recommended for performance reasons, however there are function modules which optimize the query to VBFA like READ_VBFA.
Cheers.
‎2008 Feb 27 5:55 AM
hi Aditya,
Ok if I use Read_VBFA FM. I only need to fetch VBELN from it while passing my XBLNR into VBELV. Hoz do I only fetch my desired field in below FM. My code shows Runtime error. Plz help
CALL FUNCTION 'READ_VBFA'
EXPORTING
I_VBELV = VXBLNR
I_POSNV =
I_VBTYP_V =
I_VBTYP_N = 'M'
I_FKTYP =
I_BYPASSING_BUFFER =
I_REFRESH_BUFFER =
TABLES
E_VBFA =
EXCEPTIONS
NO_RECORD_FOUND = 1
OTHERS = 2
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
***********************************
Thanks.
Khan
‎2008 Feb 27 7:28 AM
Hi, You have to pass the item number as well for the FM to retreive the documents. Should you not have the Item number, make a direct select. But this can correspond to multiple Invoice documents. Also you have to consider if the billing document is cancelled. You can check the status of the cancellation with field VBRK-FKSTO.
‎2008 Feb 27 7:48 AM
HI Eswar
How v get the VBRK-FKSTO status. coz V dont want to go VBRP as it taks long time. Plz help.
Thanks.
Khan
‎2008 Feb 27 7:56 AM
Check below example:
Here parameter P_VBELV is you delivery number. Execute above code in a temporary program to check the results and use it as per your requirement.
PARAMETERS: p_vbelv TYPE vbeln_vl.
DATA: l_vbeln TYPE vbeln,
l_fkdat TYPE fkdat.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = p_vbelv
IMPORTING
OUTPUT = p_vbelv.
SELECT SINGLE a~vbeln b~fkdat INTO (l_vbeln, l_fkdat)
FROM vbfa AS a
INNER JOIN vbrk AS b
ON a~vbeln = b~vbeln
WHERE a~vbelv = p_vbelv
AND a~vbtyp_n = 'M' " Billing
AND a~vbtyp_v = 'J' " Delivery
AND b~fksto NE 'X'. " Billing document not cancelled
IF sy-subrc EQ 0.
WRITE:/ 'Billing Document:', l_vbeln,
/ 'Date:', l_fkdat.
ENDIF.
‎2008 Feb 27 8:04 AM