一次性读取发票数据的function:rv_invoice_document_read

2022-09-27 10:22发布

SAP applicatione developers or ABAP developers use rv_invoice_document_read to read SAP invoice details including billing header data, billing item data, partner data and price conditions data.
Generally rv_invoice_document_read can be used for printing SAP invoice data since this ABAP function module brings all required data for printing a specific invoice.

In order to read SAP billing document, first we need the billing document number:
lv_vbrk-vbeln is the document number.
We pass the target document number to the RV_INVOICE_DOCUMENT_READ ABAP function module using import parameter vbrk_i.

KOMV table is Pricing Communications-Condition Record table.
VBPAVB is reference structure for XVBPA/YVBPA. Includes sales document partner and sales document partner dynamic part.

VBRKVB is reference structure for XVBRK/YVBRP. Includes billing document header data and billing header dynamic part.
VBRPVB is reference structure for XVBRP/YVBRP. Includes billing document item data and billing item dynamic part.
Here is a sample ABAP program which can be used for selecting invoice data from SAP tables using ABAP function module rv_invoice_document_read.



DATA :
 lv_vbrk LIKE vbrk,
 gs_komv TYPE komv,
 gt_komv TYPE TABLE OF komv,
 gs_vbpa TYPE vbpavb,
 gt_vbpa TYPE TABLE OF vbpavb,
 gs_vbrk TYPE vbrkvb,
 gt_vbrk TYPE TABLE OF vbrkvb,
 gs_vbrp TYPE vbrpvb,
 gt_vbrp TYPE TABLE OF vbrpvb.

lv_vbrk-vbeln = '0019000999'.

CALL FUNCTION 'RV_INVOICE_DOCUMENT_READ'
 EXPORTING
* ACTIVITY = ' '
  KONV_READ = 'X'
* NO_NAST = ' '
  vbrk_i = lv_vbrk
* I_NO_AUTHORITY_CHECK = ' '
* OIA_UNZIP_FEES =
* IMPORTING
* VBRK_E =
* VBUK_E =
 tables
  xkomv = gt_komv
  xvbpa = gt_vbpa
  xvbrk = gt_vbrk
  xvbrp = gt_vbrp
* XKOMFK =
* XVBFS =
* XTHEAD =
* XVBSS =
* EXCEPTIONS
* NO_AUTHORITY = 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.
Code

ABAP developers can loop in return tables and create a SAPScript or SAP Smartforms application or a list page to display SAP invoice data or SAP billing document data that is read using rv_invoice_document_read.

赞赏支持