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
Development resources, articles, tutorials, code samples, tools and downloads for SAP HANA and ABAP, HANA Database, SQLScript, SAP UI5, Screen Personas, Web Dynpro, Workflow


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 Smartforms table for sales order output





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.

<FS> TYPE VBDPA
Code

SAP Smartforms field symbols

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.

create table in SAP Smartforms window

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.

SAP Smartforms table data definition

This definition is equal to following ABAP report example in function.

DATA ZTVBDPA TYPE TABLE OF VBDPA.
FIELD-SYMBOLS <FS> TYPE VBDPA.

LOOP AT ZTVBDPA ASSIGNING <FS>.
* ABAP Code
ENDLOOP.
Code

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.

SAP Smartforms invoice items table data from VBRP

Smartform developers can create GS_IT_GEN structure in Global Definitions > Global Data tab as follows.

GS_IT_GEN TYPE LBBIL_IT_GEN
Code

lbbil_it_gen structure in SAP Smartforms global data

The table data definition creates ABAP code similar to shown below.

DATA :
 GS_IT_GEN TYPE LBBIL_IT_GEN,
 IS_BIL_INVOICE TYPE LBBIL_INVOICE.

LOOP AT IS_BIL_INVOICE-IT_GEN INTO GS_IT_GEN.
* ABAP Code
ENDLOOP.
Code

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.

folder control in Smartforms table

Then the trick is to mark the checkbox Page Protection as seen in the below screenshot.

SAP Smartforms folder page protection



SAP HANA and ABAP

Install SAP Free
CRM Companies List
Web Based CRM Software


Copyright © 2004 - 2021 Eralper YILMAZ. All rights reserved.