SAP Smartforms Table for Sales Order and Invoice Outputs
Smartforms table is used to display a list of data table rows on SAP Smartforms output documents.
These data rows are generally Sales Order items for a Sales Order Confirmation output.
Or item lines for a SAP Sales Invoice document.
In this Smart Forms tutorial we'll display invoice data from SAP Sales Invoice table VBRK and VBRP, and sales order data from SAP Sales Order table VBAK and VBAP
Just as seen in below SAP Smartform structure, a Smartform table has Header section, Main Area section and Footer section.
In general, header section is used to display table column headers.
Main area is used for listing table item lines.
The footer is generally used for subtotals.
SAP Sales Order Confirmation Order Items Table
In a Sales Order Confirmation Smartform output, there is a table parameter named ZTVBDPA which imports Sales Order items.
The ZTVBDPA view has the structure VBDPA - Document Item View for Inquiries,Quotation,Order
In the Smartform, in Main window section, Smartform developers can add a Table and display order items using this Smartforms table.
Create the following field symbol definition in Global Definitions > Field Symbols tab.
Then goto Main window where you want to display sales order details as a table.
Right click on the window node, select Create > Table menu options.
Goto Data tab.
In the first line, write the internal table ZTVBDPA which stores table data.
Then choose A ASSIGNING from dropdown list since we will be using a field symbol variable <FS> for this SAP Smartforms tutorial.
This definition is equal to following ABAP report example in function.
Then using Table Painter and Details buton on Table tab, row types can be defined which will be used within Smartforms table.
Then to display POSNR position number of a sales order item, <FS>-POSNR can be used.
In oder to show the order item material number, <FS>-MATNR can be used.
SAP Sales Invoice Items Table
For a Sales Invoice SAP Smartform output, all invoice data is transferred from Smartform print program to the SAP Smartforms using import variable named IS_BIL_INVOICE
IS_BIL_INVOICE is defined using the LBBIL_INVOICE (Billing Data: Transfer Structure to Smart Forms) structure type.
IT_GEN component of the LBBIL_INVOICE stores Billing Item: General Data details which is used as base table to display invoice items on a SAP Smartforms document.
Here is how invoice items table Data tab can be configured to list Sales invoice items.
Smartform developers can create GS_IT_GEN structure in Global Definitions > Global Data tab as follows.
The table data definition creates ABAP code similar to shown below.
SAP Smartforms Table Tips
ABAP developers can use Smartform Folder control to keep together a group of lines.
For example, for a sales order item or for an invoice item you want to display 3 lines of data.
But it is important to keep together these three lines on the same page.
This is not easy if Smartforms Folder control is not used.
Insert a Folder structure into the Table Main Area, move the item lines into the Folder control.
Then the trick is to mark the checkbox Page Protection as seen in the below screenshot.