SQL Server administration and T-SQL development, Web Programming with ASP.NET, HTML5 and Javascript, Windows Phone 8 app development, SAP Smartforms and ABAP Programming, Windows 7, Visual Studio and MS Office software SAP ABAP Programming and HANA Database Tutorials
Development resources, articles, tutorials, samples, codes and tools for .Net, SQL Server, Windows, Windows Phone, SAP and ABAP, like SAP UI5, Screen Personas, etc.




Install SAP Free




ABAP Function Module RV_DOCUMENT_PRINT_VIEW in SAP Smartforms


ABAP Function Module RV_DOCUMENT_PRINT_VIEW is used to get data for SAP sales order confirmation outputs created by SAP Smartform.

The vbdka parameter which is used to return document header data by ABAP function module RV_DOCUMENT_PRINT_VIEW can be used to print customer and address data for partner on the Order Confirmation smartform output.

The item details of the SAP sales order can be found in tvbdpa table.
ABAP function module rv_document_print_view returns the position data for all items in the sales order using the pos table parameter, tvbdpa here in this case.





If sales document number is passed to the function module RV_DOCUMENT_PRINT_VIEW, the order items are returned to the ABAP report in tvbdpa table (pos table parameter).

If partner function is passed to the function module rv_document_print_view using vbco3-parvw, the vbdka document header data is return in FM parameter kopf.

If Sold-to Party AG, Bill-to Party RE, Payer RG is passed as partner funtion then first customer name and address data will be of that sales order partner.
And the vbco3 structure fields whose name ends with "_WE" will return Ship-to Party partner data.

If Ship-to Party WE partner function is used in comwa parameter vbco3, the first customer data will be of Ship-to party partner.
On the other hand structure fields whose names ending with "_WE" will return empty data.

Here is a ABAP report partial codes for managing Smartform call and report data.
The NAST data is used to run the required ABAP function call RV_DOCUMENT_PRINT_VIEW.

TABLES:
 vbco3, "Communicationarea for conditions "#EC *
 vbdka. "Communicationarea for view "#EC *

DATA: BEGIN OF tvbdpa OCCURS 0. "Internal table for items
 INCLUDE STRUCTURE vbdpa.
DATA: END OF tvbdpa.

DATA: da_mess LIKE vbfs OCCURS 0 WITH HEADER LINE.

vbco3-mandt = sy-mandt.
vbco3-spras = nast-spras. " Message language
vbco3-vbeln = nast-objky. " Object key (Sales document number)
vbco3-kunde = nast-parnr. " Message partner
vbco3-parvw = nast-parvw. " Partner function (ie SH for ship-to party)

CALL FUNCTION 'RV_DOCUMENT_PRINT_VIEW'
EXPORTING
 comwa = vbco3 "Transfer of key fields
IMPORTING
 kopf = vbdka "Document header data
TABLES
 pos = tvbdpa
 mess = da_mess "Error log collection path
EXCEPTIONS
 fehler_bei_datenbeschaffung = 1.

ABAP developers can also test RV_DOCUMENT_PRINT_VIEW function module using SE37 as shown in below screenshot.

test-abap-function-module







SAP Resources

SAP Tutorial

SAP Forums

SAP Tools

SAP Transaction Codes Table








Copyright © 2004 - 2018 Eralper YILMAZ. All rights reserved.
Community Server by Telligent Systems