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.




CRM Companies List
Web Based CRM Software




SAP Smartforms Tutorial - Table Calculations using Count


In this SAP Smartforms tutorial, I want to show how can SAP Smart Forms developers can use Table Calculations using Count function.

Assume that you have a SAP Smartform sample report listing a list of SAP Smartform documents created on your ABAP development system. In this Smartform tutorial, We will add a new column and which will be an auto number field, numbering the table rows beginning from 1, 2, and goes on incrementing by 1.





Define the following global variables in the Global Data tab in Global Definitions screen on your SAP Smartform.
The first global variable GV_COUNTER is the numeric variable that will be used in the table calculations with count function. The second global variable GV_ORDERNO is the string variable to display as text value on the Sort Order column.

Variable NameType AssignmentAssociated TypeDefault Value
GV_COUNTERTYPEINTEGER1
GV_ORDERNOTYPECHAR3

After the global variables are defined, now ABAP developers can go to Smartform table screen Calculations tab as seen in the below screenshot. Choose the CNT Number Operation from the dropdown list. Possible operation types are ; AVG Mean Value, CNT Number and SUM Total operations.
Target Field Name will be GV_COUNTER numeric global variable we have already defined.
In the Time column, I'll choose A After Loop. After Loop option will assign the new value to the counter right after each table row is processed by Smartform.
With GV_COUNTER default value equal to 1, the first data row will have counter value 1 in the table cell. Then After Loop option selection will increase the counter by 1. So the next table row will have 2 in the counter cell.
The possible Time options are A After Loop, B Before Loop, R Before Sorting, T After Sorting.
If when the GV_COUNTER default value is 1, we choose Before Loop option, then before printing the first data row the counter value will be increased by 1 so the table cell will display 2 for the first row.

sap-smartforms-tutorial-table-calculations-count-number

Now Smartform developer can create Program Lines object and Text object within a table line cell in the Main Area of the table.

sap-smartforms-tutorial-table-calculations-for-count-code-text

Place the following code in the Program Lines.

CLEAR GV_ORDERNO.
WRITE GV_COUNTER TO GV_ORDERNO.

This code will convert the numeric GV_COUNTER variable to string value and writes to GV_ORDERNO global variable.
In the Input Parameters windows add GV_ORDERNO and GV_COUNTER to the table.
In the Output Parameters windows add GV_ORDERNO.

smarforms-table-calculations-code-data-type-conversion

We will now print the GV_ORDERNO string variable in the table cell using Text object.

display-global-variable-using-text-in-smartform

After all is completed, activate Smartform then execute Smartform with F8.
The final output will be as follows :

sap-smartforms-tutorial-table-calculations-counter-after-loop

I hope ABAP developers will like this SAP Smartforms tutorial which focus how to deal with table calculations.







SAP Resources

SAP Tutorial

SAP Forums

SAP Tools

SAP Transaction Codes Table






Related Articles and Tutorials(http://www.kodyaz.com/articles/sap-smartforms-tutorial-table-calculations-using-count.aspx)
Email Spool Request using SAPOffice - Spool to PDF
How to Debug SmartForms - Debugging SAP SmartForm in ABAP ?
SAP Invoice Output Determination Analysis for Not Created Output Message
SAP Smartforms - How to Call Smartform within ABAP Program
SAP Smartforms Table for Sales Order and Invoice Outputs
SAP Smartforms Tutorial - How to Create Smartform
SAP Smartforms Tutorial - Create Smartforms Example
SAP Smartforms Tutorial - Table Calculations using Count
SAP Smartforms Tutorial - Table Calculations using Sum Total
SAPScript Transaction Codes
Change Output Condition Records
Adobe Forms Table Header is Missing After Second Page
Free Adobe LiveCycle Designer Download
Message no XS826: Cannot process message; no node determined for 76550052
Complex Conditions in SAP Smartform with AND/OR
How to Spell Numbers using ABAP Spell_Amount Function Module
Convert Smartform to PDF in Print Preview Mode
Delete Entries in NAST Table using RSCLNAST ABAP Program
How to Export IDOC as Excel and Save as Local File from WE02 Transaction
Export SAP Spool Requests as PDF using SP01 Transaction
How to Find Output Determination Procedure for a Billing Document
Export SAP Data to Fixed Length Text File
How to Disable Word Editor in SAP Smartform Text
Import and Export SO10 Standard Text using RSTXSCRP ABAP Program
Move Minus Sign from Right to Left of Negative Number in SAP Smartform
Print SAP Outputs From Two Printers at the Same Time
Get Proforma Invoice from Commercial Invoice in ABAP
SAP Invoice Output ZZZZ is not Defined
SAP Output Management - Create New SAP Output Type
SAP Purchase Order Tables, Transaction Codes and Output
Graphics White Background Displayed Grey on SAP Smartform Output
SE63 Smartform Translation and Export using SLXT Program
SAP Smartform Runtime Error CX_SY_CONVERSION_NO_NUMBER
Window MAIN does not fit onto page PAGE (height)
SAP Smartforms Table Parameter in Form Routine
Trigger Output Re-Determination for Billing Documents
VF31 SAP Transaction to Reprocess Billing Output Messages
Web DynPro Tutorial - Display Spool Requests using Web DynPro Table


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