Tuesday, March 29, 2011
IDOCS OUTBOUND TRIGGER PART TWO
SAP BASIS (BC) Security Components
SAP R/3 for IBM dummies – First Edition.
About ABAP
ABAP (Advanced Business Application Programming, originally Allgemeiner Berichts-Aufbereitungs-Prozessor, German for “general report creation processor”) is a very high level programming language created by the German software company SAP.
It is currently positioned, alongside the more recently introduced Java, as the language for programming SAP’s Web Application Server, part of its NetWeaver platform for building business applications. Its syntax is somewhat similar to COBOL.
Introduction
ABAP is one of the many application-specific fourth-generation languages (4GLs) first developed in the 1980s. It was originally the report language for SAP R/2, a platform that enabled large corporations to build mainframe business applications for materials management and financial and management accounting.
ABAP used to be an abbreviation of Allgemeiner Berichtsaufbereitungsprozessor, the German meaning of “generic report preparation processor”, but was later renamed toAdvanced Business Application Programming. ABAP was one of the first languages to include the concept of Logical Databases (LDBs), which provides a high level of abstraction from the basic database level.
The ABAP programming language was originally used by developers to develop theSAP R/3platform. It was also intended to be used by SAP customers to enhance SAP applications – customers can develop custom reports and interfaces with ABAP programming.The language is fairly easy to learn for programmers but it is not a tool for direct use by non-programmers. Good programming skills, including knowledge of relational database design and preferably also of object-oriented concepts, are required to create ABAP programs.
ABAP remains the language for creating programs for the client-server R/3 system, which SAP first released in 1992. As computer hardware evolved through the 1990s, more and more of SAP’s applications and systems were written in ABAP. By 2001, all but the most basic functions were written in ABAP. In 1999, SAP released an object-oriented extension to ABAP called ABAP Objects, along with R/3 release 4.6.
LSMW in SAP ABAP
SAP MDM Training-SAP MDM Tutorials,SAP MDM Jobs,SAP MDM Resumes-SAP MDM
Prologue:
The B2B bust never happened. It’s a return of ideas. MDM 5.5 could potentially bring the concept back to life. It is the strategic decision that SAP would take in the future with MDM that would prove to be the trigger for a B2B resurrection. There exists today a substantial gap between the promise and the reality of collaborative commerce unlike what was touted in the late 90s. Visionaries always wanted us to believe that we will all soon be connected to vast, virtual, paradigm-changing digital public marketplaces & start collaborating. Like the X-Files, these marketplaces were supposed to be “somewhere out there”, we were never supposed to know where or when. From these initial thoughts are derived a set of key capabilities and requirements which may be used in the evaluation of specific collaborative commerce implementation technologies.
And more importantly, understanding the space or having a single platform vendor address business needs, not just technological, and not looking at MDM 5.5 as a lone, disconnected product as is seen by many today. Well connected and making sense. Virtual collaboration that allows the business processes of a customer’s value chain partners who are linked through the Internet, and the knowledge that is available would be exchanged throughout the value chain for a specific industry vertical with universally accepted identification numbers. Virtual collaboration is a means to increase efficiency while maintaining or even reinforcing uniqueness, a solution that now seems to be within reach with the integration of MDM in the SAP NetWeaver platform. And thus, the improvement scope for an organization broadens from reducing costs to increasing revenues, accelerating time-to-market and enhancing customer satisfaction.
A new form of virtual interaction is added to our comprehensive platform model: collaboration. Naturally, this will increase the complexity of the partners’ interactions, which are now mostly limited to informational and transactional interactions with customers who are attempting this initiative with MDM 5.5 today. At first, collaborative interactions between organizations need to focus on the operational level - upon establishing virtual links between the business processes involved. With EP as the front-end and a little bit of flexibility with SP02 proves this. Let us call this the e-Integration stage. SP02 will at least assuage MDM 5.5 users with its display abilities through the enterprise portal. This may be followed by a second collaboration stage: e-Partnering, in which the value chain partners would extend their collaborative interactions to tactical and maybe, even strategic levels. For this, the interaction with BI 3.5 would make sense. The opportunities created by such virtual collaboration are immense, especially in the area of composites. Let us try to see how MDM 5.5 in conjunction with GDS and industry specific needs will shape the vertical nets of the future as an integral part of the netweaver stack and help us define a case for MDM to carve a road ahead with ESA for an organization that is exploring such a possibility towards collaborative commerce.
Blast from the past:
An eMarketplace could be a business destination, which provides a broad offering of products, services and content as well as a venue for business transactions electronically including exchanges and an eProcurement is purchasing of materials, mainly indirect materials or services through an electronic Exchange. MDM 5.5 would be a great solution for catalog management and syndication for the same. In the past, these used to be advanced excel based tools to create .cif files for catalog management.
Buying and Selling of direct materials, finished goods, services come under eMarketplaces. eMarketplaces most often include an exchange as part of their services. For example, a marketplace might offer catalogs, Negotiations, and an exchange in addition to a number of supply chain services. (A combined digital marketplace of Ariba Marketplace and Ariba Dynamic trade) The core engine for the same is an advanced catalog management engine – something like the MDM 5.5 solution.
Name calling: Exchanges, eHubs, iHubs, e-Markets, Trading Networks, e-MarketPlaces, NetMarkets etc. etc. etc.
Resurrection of the e-marketplaces?
Early adopters across the value chain had experimented with a variety of new business-to-business commerce models, technologies and application designs. At the same time, there was always a growing demand for new standards to facilitate the exchange of information, catalog content and transactions between buyers and sellers. While the methods have been numerous and complex, the underlying goal has remained the same: to bring buyers and sellers together with an automated flow of information and transactions, while still supporting individual business and contractual relationships between trading partners, but for small collaborative chains and inherent players as depicted in our storyboard. The essence of the B2B boom now gets carried forward, except now there is a promise of reality.
The Extended Enterprise Concept now gets stretched to become an Extended Collaborative Enterprise. And the case of logical composites become:
1. Design: Product conception and design for New Product Introduction (NPI)
2. Planning: Determine product mix and quantities based on demand forecast and manufacturing capacity
3. Sourcing and reverse auction: Identify and select suppliers and negotiate and establish purchase contracts with suppliers
4. Marketing & Sales: Market and create demand for new and existing products
5. Manufacturing & Inventory Management: Work with sourcing to maintain low inventory levels and manage an efficient just-in-time (JIT) process
All these have one element in common – master data. A virtually connected extended collaborative enterprise, which the original initial players could not manage owing to a myriad of technological platform with no master data management backbone.
The Matrix Evolution:
First-generation digital e-marketplaces with the sell-side as one supplier and many buyers and the second-generation ones with the Buy-side with one buyer and many suppliers had vendors like CommerceOne, Ariba (ex-tradex), FreeMarkets (now Ariba) and others commerce solutions had fallen short of this goal with the top down approach they had, compared to the bottom-up approach with SAP NetWeaver. They had limited their focus to either the buy-side or sell-side of the equation, without truly understanding how to bring buyers and sellers together into small collaborative chains. The other shortcoming was, despite the concept of Vertical marketplaces having taken shape then, the industry backing behind the key standard bodies was disparate. A stance SAP has changed completely.
This lopsided view of the commerce process resulted in one participant (the buyer or seller) inappropriately dictating proprietary solutions or standards to the other. And, in most cases, this strategy did not scale. The next-generation of commerce solutions saw the birth of eMarketplaces. They were specifically designed to enable multi-buyer/multi-seller interaction and collaboration. They provide a common trading hub, where multiple buyers and sellers could come together and conduct commerce without compromising individual processes and relationships among the participants which is best understood by the pictorial depiction of the evolution as below:
The Matrix Revolution: MDM could be the cup of life for e-marketplaces
E-marketplaces and Vertical exchanges never died, it was only a shakeout of the incompetent and a result of nascent technology . E-procurement systems, e-marketplaces and exchanged always rode on catalog management systems. With MDM 5.5 (xCat), it would have ideally provided the perfect catalog management solution to the same. For those who been through the B2B boom and bust, it would not be completely wrong to say that these concepts existed at that point in time, they set the foundation in place. Catalog syndication is not a new concept when we were consolidating MRO items and finished goods to be hosted on the exchanges, marketplaces and e-procurement solutions. Where the B2B bubble failed was the disjoint way in which these solutions with the backend ERP systems. Again, this is only ONE factor. Today, MDM 5.5 (some call it a regression from the MDM 3.0 solution), on the ABAP stack. MDM 5.5 is a standalone application, nothing to do with WAS – pure xCat application, does not hold much promise. But what is important is the vision that one may want to decipher that SAP may be taking with the same. One would presume that the next version (MDM 7.0?) would be on a WAS (Java +ABAP) stack, fully integrated with EP in the true sense using XI and BI (and beyond) for a complete solution.
Some solution architecture thoughts on MDM in your landscape:
(a) Acting as the online hub for catalog management, syndication across the landscape, the master being the source of truth, flexibility for an organization would be rendered to create online stores with ease through the enterprise portal – specific and business partner driven.
(b) Business partner-specific product catalogs published online to help organizations wired exchanges and e-marketplaces providing community specific information like pricing and specifications to create a network of coherent business partners where the data is harmonized within the organization and extended to the partner community.
(c) Synchronization of trading item catalogs with vertical-specific hubs like Transora or UCCNet data pools, using GDS to create a meta-directory of items facilitating the use of industry-specific standards. An Industry specific yellow pages for all materials to be synchronized and used for trading. (This would necessitate the need for XI and BI leading to Analytics and CAF)
(d) Extended Supplier extranets to facilitate reverse auctions, linked up with the e-marketplaces to be considered as xAPPs extended from what pure-play vendors set out towards. These composites need to switch between intranets and extranets to address various processes.
This is where composites need to seamlessly address processes to complete process loops over the extended value chain and this is the culmination of all our efforts with ESA.
MDM 5.5 – Old wine in a new bottle, and it tastes good!
Before we get into the MDM mould and explore some of the details it is important to understand a little on the background on the product evolution. The MDM product was available for the last few years and its last version was MDM 3.0 this product was ABAP based tool with decent capabilities in large scale data integration and consolidation between SAP systems. The problem with this application was that it was way too complicated for a quick implementation and lacked the feel-good factor on the front-end. SAP may have had to decide whether to invest more on development efforts or to buy off another application from a vendor that would be able to provide the missing capabilities. The quest for this tool led SAP towards A2I and their product called xCat(Of course, there would be other strategic thought processes).
Even though the xCat product was intended for product catalog management, it seems to have the potential - both from a conceptual and a technical standpoint – to fit snugly under the SAP NetWeaver umbrella. At first this product was called MDME (MDM Extension) but now it was announced as the MDM official tool by SAP. The MDM5.5 application can help in providing data Modeling , data consolidation, fast data extraction , and decent search capabilities, and it seems realatively simple for installation and implementation (both from infrastructure standpoint and end user experience). Add to this a good experience in business scenario handling for MDM, as it was captured during the years in the “old” MDM development team and the technology which enables one to do complex things with little effort.
Product Catalog Management, doesn’t it sound familiar?
A PCM product would help the catalog manager of a product company manage the different aspects of information about the product. It could be complex with a lot of information to be handled. Every product oriented company has to have its product catalog in order to use it both internally (for manufacturing, purchasing, etc) and externally (customers, suppliers, etc). Complexity could be owing to a product that can be built from several parts, of various configurations, and can be connected to other associated products. In most companies the product information comes from different places in the organization (manufacturing, purchasing, operations, etc) derived from that it is stored in different IT systems to help in:
a. Extracting product information from different source systems
b. Consolidating information and convert different terminology of the same product
c. Providing ways of organizing the information depending on the user group for specific information
d. Providing fast and intuitive search
e. Providing different ways of displaying the catalog – especially, quick publishing online via EP using Java APIs
The Online Laundromat - MDM
Here we need to answer what is Master Data, well if I will try to define it in a simple way I can say that Master Data is descriptive data regarding specific entity. The Master Data is fairly Static and it is not contains transactional information
So Master Data Management systems came to solve those issues, by providing tools for extracting master data from different IT systems, consolidating master data coming from different sources, central Management crosses IT systems and master Data Provisioning from and to the different IT systems in the organization. The PCM is just a private case of MDM with some extensions like printing catalogs or image management.To ensure that we progress towards the b2b vision, the MDM 5.5 comes in useful when you need to define a generic/flexible data model that is able to pull in data from different sources to have a consolidated source for all master data. Then comes the job of cleansing the data across organization (find duplicates , find similarities ,define transformation rules, etc) in the master server and finally create slaves to help use the data and uses personalized access to Master Data according to end user profile (progress is already up for review with SP2 and finally synchronize the Master Data with different systems holding equivalent information (something that may not be possible today) However, the speed of accessing the data with MDM 5.5 is nothing short of phenomenal, especially when it comes to large number of records.
The Plug Ins (QuarkXPress and Adobe InDesign) come in very handy in publishing catalogs are part of the PCM scenario’s supported by this tool, the Image Manager is for handling Images usually kept in products context and the Plug Ins are meant for publishing the product catalog in different ways. Customers without an MDM solution till date have been trying out all possibilities to handle this. Sample third party applications containing this data which needs to be integrated via the enterprise portal as part of a POC. Add to the the java APIs which can be used by organizations to create their own storefronts. Now, this is an area which has to be put in place by SAP very fast. Imagine customers with an MDM solution in place creating web applications in IBM Websphere or any other application server to create their on static web-stores. Of coursem this is a technological solution, but if falls completely out of sync with the bigger picture with SAP. It is debatable whether this approach is good or not.
The Management Console
The console is primarily intended for two roles – The MDM administrator which deals with connectivity, accessibility, security, etc and the other, The MDM modeler, for creation and maintenance of the object/data model as defined according to business needs.
An Stop-gap arrangement for XI – Bring on the Import Manager
With limited data sources to deal with, the Import Manger is today meant for importing data from several data-sources (can be relation DB, can be excel-sheet) in order to define and population of the data model. With this, one can define the rules for importing data into the model according to the source structure. To assist in aggregation of data from electronically format (the source), transforming the same using rules, rationalizing and normalizing the data to finally have a clean set of data without having to do any coding is where the punch lies.
Of course, it has always been a point of debate on the usage of XI 3.0 for the same. But if it is a one-time load (which is not the idea here), it makes no sense. It is like using a Cadillac for buying groceries. Once the entire landscape is in perspective with the master and the slaves defined, along with data upload and distribution strategies in place, XI starts making sense. It has to come in sooner or later as the landscape will move towards GDS (it the vertical is retail) with 1SYNC today, along with the mandate for the usage of BI and Solution Manager in the landscape. But it is the need today that should define the IT strategy. Maybe not stop-gap at all.
A Stepping stone towards ESA – The Syndication Manager
The Syndication Manager is the component that knows how to exchange data with other systems, meaning this tool will be the one that will handle the synchronization between the MDM storage and the source systems. The syndication manager will not do it alone but it will warrant the use of XI in order to provide a robust way for interacting with the myriad systems the client would have in the landscape. Then again, this is an area which will have explored in detail before an solution can be proposed.
Content Manager
The content manager is what the end user needs to maintain and work with Master Data. Also known as “the client”, it finds its use in fetching data in the most intuitive way across users working on the same data model. In reality, the workflow feature for adding, changing and flagging for deletion the master data is not something that The workflow to manage the master date stored in the MDM (add, change, flag for delete), supposedly to be with workflows (a .exe file available with SP02, which is currently being explored in-house) should really set the ball rolling.) may work. If it doesn’t provide the desired results, there are options to get this in place – create customized iViews for changing and deleting records, create a custom workflow engine integrated with EP to handle this or use webflow, or use a third party workflow engine. MDM being deployed on WAS would be very useful indeed from an integration standpoint.
The invisible men - MDM Java APIs
The MDM5.5 server exposes API both for java and Microsoft applications (.Net and previous) that enables your applications to use the data and functionality provided by it. Due to the fact that most of the MDM5.5 functionality is done in the server, every thing that you can do from one of the clients above you can do from your applications via the API. API for ABAP is being developed as we speak and will be available in the near future. Now, the point that needs to be kept in mind is – how does one, as a Solution Architect, influence the decision of having this on-line web-store within the boundaries of SAP Applications?
GDS and Vertical Nets:
The next step of the solution makes sense when we bring in the vertical industry specific nets into the picture. And this is the area when XI and BI start making sense in the big scheme of things. Leading one to believe that MDM 7.0 (Or whatever), would be an application deployed on WAS (Java and ABAP) soon and xCat would soon be a thing of the past. When we extend our solution as an on-line marketplace with or without SRM/EBP with MDM to publish catalogs on an online store with the Java APIs on an application on or not on WAS, it may not help an organization derive the true business benefits of collaborative commerce with what SAP has on the anvil. Extend this with GDS and the RFID concept and that is leads one to the concept of resurrecting B2B exchanges.
Epilogue:
This is something that may or may not happen in toto. But it is logically possible. And with the SAP NetWeaver platform in place, MDM 5.5 does become the backbone for these c-chains in the future. Conservative companies will be in a position to reach out to their business partners in a collaborative manner with minimal investment. The emergence of 1SYNC, the transition of Transora from a B2B marketplace running Ariba Marketplace, an e2open with Dynamic trace…..the new IT landscape layout and the orchestration of the various elements that would render the usefulness of ESA. Afterall, wasn’t SOA a core concept with the B2B boom? This is where ESA begins. More on this topic on my next blog
Wednesday, March 16, 2011
How to Upload Data to SAP from Excel File using alsm_excel_to_internal_table Function Module
Frequently, ABAP developers and SAP users require data upload from Excel to SAP.
Data upload to SAP systems can be managed using third-party SAP tools or using built-in ABAP function modules like alsm_excel_to_internal_table.
alsm_excel_to_internal_table function module help ABAP developers to upload Excel to SAP internal tables in their ABAP codes.
In this ABAP tutorial, I'll try to show how data from Excel files can be upload to SAP internal tables with a sample ABAP report.
Here is a sample Excel data file which contains currency codes and currency names in two columns in an Excel spreadsheet as shown in the below screenhot.
Using ABAP function module alsm_excel_to_internal_table, we will upload Excel to SAP internal table and then list the contents of the ABAP internal table as an ABAP list.
Below ABAP programmers will see the output of the sample ABAP report.
Here is the ABAP source codes of the sample program ZUploadExcelData which reads an Excel file from a given path "C:\currency.xls"
ABAP ALSM_EXCEL_TO_INTERNAL_TABLE function module upload Excel to SAP internal table gt_exceldata.
Please note that gt_exceldata is a type table of alsmex_tabline.
After Excel data is uploaded from Excel to ABAP internal table of type alsmex_tabline, by using ABAP Loop command each column value is assigned to the desired work-area structure.
And after data assignment to work area structures are completed each structure or workarea is added to the desired ABAP internal table using APPEND command.
REPORT ZUploadExcelData .
TYPES :
BEGIN OF gty_currency,
currencycode(5) TYPE c,
currencyname(50) TYPE c,
END OF gty_currency.
DATA :
currline TYPE i,
gs_exceldata TYPE alsmex_tabline,
gt_exceldata TYPE TABLE OF alsmex_tabline,
gs_currency TYPE gty_currency,
gt_currency TYPE TABLE OF gty_currency.
* Import data from Excel
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = 'C:\currency.xls'
i_begin_col = 1
i_begin_row = 1
i_end_col = 2
i_end_row = 1000
TABLES
intern = gt_exceldata
* EXCEPTIONS
* INCONSISTENT_PARAMETERS = 1
* UPLOAD_OLE = 2
* OTHERS = 3
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Load data into internal table
currline = 0.
SORT gt_exceldata BY row value.
LOOP AT gt_exceldata INTO gs_exceldata.
IF currline = 0.
currline = gs_exceldata-row.
ENDIF.
IF currline <> gs_exceldata-row.
currline = gs_exceldata-row.
APPEND gs_currency TO gt_currency.
ENDIF.
CASE gs_exceldata-col.
WHEN 1.
gs_currency-currencycode = gs_exceldata-value.
WHEN 2.
gs_currency-currencyname = gs_exceldata-value.
WHEN OTHERS.
ENDCASE.
ENDLOOP.
* Display data
WRITE : /
'Code',
10 'Currency'.
LOOP AT gt_currency INTO gs_currency.
WRITE : /
gs_currency-currencycode UNDER 'Code',
gs_currency-currencyname UNDER 'Currency'.
ENDLOOP.
For ABAP developers who want to execute the given sample ABAP report for data upload from Excel to SAP, sample Excel source file currency.xls can be download from Download currency.xls
ABAP Tutorial - ABAP String Split Example Code
ABAP Tutorial - ABAP String Split Example Code
ABAP developers frequently work with ABAP string functions and operators in order to deal with string variables and text operations.
Splitting string operations is one of ABAP split string tasks frequently faced with.
Although when SPLIT is the topic of a conversation in ABAP, the ABAP SPLIT function comes to mind first. If there is a seperator character like comma (,) or space, ABAP SPLIT function will work great.
But recently a friend came to me, and asked me how to divide a string variable in fixed length pieces and store them in an internal table.
Then this requirement is somehow different then the SPLIT function offers.
In fact the solution is as simple as illustrated in the given sample ABAP code with using str_var+10(10) like usage.
REPORT Z_ABAP_SPLIT_EXAMPLE.
TYPES :
BEGIN OF lty_stringArray,
str TYPE CHAR15,
END OF lty_stringArray.
DATA :
ls_stringArray TYPE lty_stringArray,
lt_stringArray TYPE TABLE OF lty_stringArray.
DATA :
gv_str TYPE string,
lv_strlength TYPE i,
lv_currentpos TYPE i,
lv_remaining TYPE i,
lv_testpos TYPE i,
lv_linesize TYPE i.
lv_linesize = 15.
gv_str = 'This is an ABAP split string example demonstrating how string is splitted by a given length and stored in an internal table'.
lv_currentpos = 0.
lv_strlength = STRLEN( gv_str ).
WHILE lv_currentpos < lv_strlength.
CLEAR ls_stringArray.
lv_testpos = lv_currentpos + lv_linesize.
IF lv_testpos > lv_strlength.
lv_remaining = lv_strlength - lv_currentpos.
ls_stringArray-str = gv_str+lv_currentpos(lv_remaining).
WRITE :/ gv_str+lv_currentpos(lv_remaining).
ELSE.
ls_stringArray-str = gv_str+lv_currentpos(lv_linesize).
WRITE :/ gv_str+lv_currentpos(lv_linesize).
ENDIF.
lv_currentpos = lv_currentpos + lv_linesize.
APPEND ls_stringArray TO lt_stringArray.
ENDWHILE.
LOOP AT lt_stringArray INTO ls_stringArray.
WRITE :/ ls_stringArray-str.
ENDLOOP.
The output of this example ABAP report is as follows :
SAP NetWeaver Installation Guide using installshield wizard
In this SAP tutorial, ABAP developers and SAP users will find step by step SAP Netweaver installation guide using installshield wizard.
After SAP and ABAP professionals download SAP Netweaver 7.01 ABAP Trial version from SAP, the installation can be started using the start.htm in the setup folder.
Here is the first screen from the SAP Netweaver installshield wizard for SAP Netweaver 7.01 ABAP trial version.
The following screen is the SAP Evaluation Licence Agreement screen where developers can continue setup SAP Netweaver process by marking the "I accept the terms of the license agreement."
The next installshield wizard screen is used to configure the SAP Netweaver ABAP trial version installation folder.
You can set the SAP Netweaver installation path using the Browse buton.
Next screen is used to define master password for SAP MaxDB database.
Define Master Password
The master password is the password for the MaxDB database user and can be 2-9 characters (letters, numbers, or '#@$'). It is also valid for the MaxDB database manager.
This step in installshield wizard is displaying summary information.
As seen the SAP Netweaver 7.01 ABAP Trial Version will install the:
MaxDB component in C:\SAPDB folder, and
Application Server component in C:\SAP\NSP folder
The total size for the SAP Netweaver setup is 21360.8 MB more than 2GB.
This step will take a long time until the SAP Netweaver installation complete message is displayed as seen below.
You can mark the Start Application Server checkbox in order to start using SAP Netweaver 7 ABAP trial version immediately.
The last screen is informing that Installshield wizard has completed the SAP Netweaver installation successfully.
http://www.kodyaz.com/articles/sap-netweaver-installation-guide-installshield-wizard.aspx
SAP Smartforms Tutorial - Table Calculations using Count
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 Name | Type Assignment | Associated Type | Default Value |
GV_COUNTER | TYPE | INTEGER | 1 |
GV_ORDERNO | TYPE | CHAR3 | |
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.
Now Smartform developer can create Program Lines object and Text object within a table line cell in the Main Area of the table.
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.
We will now print the GV_ORDERNO string variable in the table cell using Text object.
After all is completed, activate Smartform then execute Smartform with F8.
The final output will be as follows :
SAP R/3 on DB2 UDB for OS/390: Application Servers on OS/390
A large portion of the redbook is devoted to installation of the SAP product when application servers are to be on OS/390; how to use CDs from another platform to install, how to configure the software, and how to migrate from an SAP R/3 system that is using the 4.5B release.
The focus of the operations section of the redbook is on the usages of the S/390 application server in the following areas:
As an SAP R/3 central instance: We concentrate on how the central instance is placed on OS/390 and how to achieve operations, availability, and performance benefits in that configuration.
Executing SAP R/3 batch and update processes: We mainly concentrate on configuring batch application servers on OS/390. We also examine how OS/390 can provide asynchronous update processing and allow SAP R/3 installations to obtain general OS/390 benefits, as well as the benefits of being on the same processor as the database server.
Performing SAP R/3 printing functions on OS/390. We examine how to take advantage of OS/390 printing and spooling capabilities from SAP R/3.
http://sapebook.blogspot.com/2007/01/sap-r3-on-db2-udb-for-os390-application.html
100 ABAP Interview Questions
ANS:-
HEADER ,BODY,FOOTER.
2. What are field symbols and field groups.?
Have you used "component idx of structure" clause with field groups?
ANS:-
Field symbols:-
Field groups :-
3. What should be the approach for writing a BDC program?
ANS:-
STEP 1: CONVERTING THE LEGACY SYSTEM DATA TO A FLAT FILE to internal table CALLED "CONVERSION".
STEP 2: TRANSFERING THE FLAT FILE INTO SAP SYSTEM CALLED "SAP DATA TRANSFER".
STEP 3: DEPENDING UPON THE BDC TYPE i)call transaction(Write the program explicity)
ii) create sessions (sessions are created and processed.if success data will transfer).
4. What is a batch input session?
ANS:-
BATCH INPUT SESSION is an intermediate step between internal table and database table.
Data along with the action is stored in session ie data for screen fields, to which screen it is passed,program name behind it, and how next screen is processed.
5. What is the alternative to batch input session?
ANS:-
Call transaction.
6. A situation: An ABAP program creates a batch input session.
We need to submit the program and the batch session in back ground. How to do it?
ANS:-
go to SM36 and create background job by giving
job name,job class and job steps (JOB SCHEDULING)
8. What are the problems in processing batch input sessions?
How is batch input process different from processing online?
ANS:-
PROBLEMS:-
i) If the user forgets to opt for keep session then the session will be automatically removed from the session queue(log remains). However if session is processed we may delete it manually.
ii)if session processing fails data will not be transferred to SAP database table.
10. What are the different types of data dictionary objects?
ans:-
tables, structures, views, domains, data elements, lock objects, Matchcode objects.
11. How many types of tables exists and what are they in data dictionary?
ans :-
4 types of tables
i)Transparent tables - Exists with the same structure both in dictionary as well as in database exactly with the same data and fields. Both Opensql and Nativesql can be used.
ii)Pool tables & iii)Cluster tables -
These are logical tables that are arranged as records of transparent tables.one cannot use native sql on these tables
(only opensql).They are not managable directly using database system tools.
iv)Internal tables - .
12. What is the step by step process to create a table in data dictionary?
ans:-
step 1: creating domains(data type,field length,range).
step 2: creating data elements(properties and type for a table
field).
step 3: creating tables(SE11).
13. Can a transparent table exist in data dictionary but not in the data base physically?
ANS:- NO.
TRANSPARENT TABLE DO EXIST WITH THE SAME STRUCTURE BOTH IN THE DICTIONARY AS WELL AS IN THE DATABASE,EXACTLY WITH THE SAME DATA AND FIELDS.
14. What are the domains and data elements?
ANS:-
DOMAINS : FORMAL DEFINITION OF THE DATA TYPES.THEY SET ATTRIBUTES SUCH AS DATA TYPE,LENGTH,RANGE.
DATA ELEMENT : A FIELD IN R/3 SYSTEM IS A DATA ELEMENT.
15. Can you create a table with fields not referring to data elements?
ANS:-
YES. eg:- ITAB LIKE SPFLI.here we are referening to a data object(SPFLI) not data element.
16. What is the advantage of structures? How do you use them in the ABAP programs?
ANS:-
Adv:- GLOBAL EXISTANCE(these could be used by any other program without creating it again).
17. What does an extract statement do in the ABAP program?
ANS:-
Once you have declared the possible record types as field groups and defined their structure, you can fill the extract dataset using the following statements:
EXTRACT
When the first EXTRACT statement occurs in a program, the system creates the extract dataset and adds the first extract record to it. In each subsequent EXTRACT statement, the new extract record is added to the dataset
EXTRACT HEADER.
When you extract the data, the record is filled with the current values of the corresponding fields.
As soon as the system has processed the first EXTRACT statement for a field group
By processing EXTRACT statements several times using different field groups, you fill the extract dataset with records of different length and structure. Since you can modify field groups dynamically up to their first usage in an EXTRACT statement, extract datasets provide the advantage that you need not determine the structure at the beginning of the program.
18. What is a collect statement? How is it different from append?
ANS:-
If an entry with the same key already exists, the COLLECT statement does not append a new line, but adds the contents of the numeric fields in the work area to the contents of the numeric fields in the existing entry.
19. What is open sql vs native sql?
ANS:-
20. What does an EXEC SQL stmt do in ABAP? What is the disadvantage of using it?
ANS:-
21. What is the meaning of ABAP/4 editor integrated with ABAP/4 data dictionary?
ANS:-
22. What are the events in ABAP/4 language?
ANS:-
Initialization, At selection-screen,Start-of-selection,end-of-selection,top-of-page,end-of-page, At line-selection,At user-command,At PF,Get,At New,At LAST,AT END, AT FIRST.
23. What is an interactive report?
What is the obvious diff of such report compared with classical type reports?
ANS:-
An Interactive report is a dynamic drill down report that produces the list on users choice.
diff:-
a) THE LIST PRODUCED BY CLASSICAL REPORT DOESN'T allow user to interact with the system
the list produced by interactive report allows the user to interact with the system.
b) ONCE A CLASSICAL REPORT EXECUTED USER LOOSES CONTROL.IR USER HAS CONTROL.
c) IN CLASSICAL REPORT DRILLING IS NOT POSSIBLE.IN INTERACTIVE DRILLING IS POSSIBLE.
24. What is a drill down report?
ANS:-
Its an Interactive report where in the user can get more relavent data by selecting explicitly.
25. How do you write a function module in SAP? describe.
ANS:-
creating function module:-
called program - se37-creating funcgrp,funcmodule by assigning attributes,importing,exporting,tables,exceptions.
calling program - SE38-in pgm click pattern and write function name- provide export,import,tables,exception values.
26. What are the exceptions in function module?
ANS:-
COMMUNICATION_FAILURE
SYSTEM_FAILURE
27. What is a function group?
ANS:-
GROUP OF ALL RELATED FUNCTIONS.
28. How are the date and time field values stored in SAP?
ANS:-
DD.MM.YYYY. HH:MM:SS
30. Name a few data dictionary objects? //rep//
ANS:-
TABLES,VIEWS,STRUCTURES,LOCK OBJECTS,MATCHCODE OBJECTS.
31. What happens when a table is activated in DD?
ANS:-
It is available for any insertion,modification and updation of records by any user.
32. What is a check table and what is a value table?
Check table will be at field level checking.
Value table will be at domain level checking ex: scarr table is check table for carrid.
33. What are match codes? describe?
ans:-
It is a similar to table index that gives list of possible values for either primary keys or non-primary keys.
34. What transactions do you use for data analysis?
ANS:-
35. What is table maintenance generator?
ANS:-
36. What are ranges? What are number ranges?
ANS:-
max,min values provided in selection screens.
37. What are select options and what is the diff from parameters?
ANS:-
select options provide ranges where as parameters do not.
SELECT-OPTIONS declares an internal table which is automatically filled with values or ranges
of values entered by the end user. For each SELECT-OPTIONS , the system creates a selection table.
SELECT-OPTIONS
A selection table is an internal table with fields SIGN, OPTION, LOW and HIGH.
The type of LOW and HIGH is the same as that of
The SIGN field can take the following values: I Inclusive (should apply) E Exclusive (should not apply)
The OPTION field can take the following values: EQ Equal GT Greater than NE Not equal BT Between LE Less
than or equal NB Not between LT Less than CP Contains pattern GE Greater than or equal NP No pattern.
diff:-
PARAMETERS allow users to enter a single value into an internal field within a report.
SELECT-OPTIONS allow users to fill an internal table with a range of values.
For each PARAMETERS or SELECT-OPTIONS statement you should define text elements by choosing
Goto - Text elements - Selection texts - Change.
Eg:- Parameters name(30).
when the user executes the ABAP/4 program,an input field for 'name' will appear on the selection screen.You can change the comments on the left side of the input fields by using text elements as described in Selection Texts.
38. How do you validate the selection criteria of a report?
And how do you display initial values in a selection screen?
ANS:-
validate :- by using match code objects.
display :- Parameters
select-options
39. What are selection texts?
ANS:-
40. What is CTS and what do you know about it?
ANS:-
The Change and Transport System (CTS) is a tool that helps you to organize development projects in the ABAP Workbench and in Customizing, and then transport the changes between the SAP Systems and clients in your system landscape.
This documentation provides you with an overview of how to manage changes with the CTS and essential information on setting up your system and client landscape and deciding on a transport strategy. Read and follow this documentation when planning your development project.
For practical information on working with the Change and Transport System, see Change and Transport Organizer and Transport Management System.
41. When a program is created and need to be transported to prodn does selection texts always go with it? if not how do you make sure? Can you change the CTS entries? How do you do it?
ANS:-
42. What is the client concept in SAP? What is the meaning of client independent?
ANS:-
43. Are programs client dependent?
ANS:-
Yes.Group of users can access these programs with a client no.
44. Name a few system global variables you can use in ABAP programs?
ANS:-
SY-SUBRC,SY-DBCNT,SY-LILLI,SY-DATUM,SY-UZEIT,SY-UCOMM,SY-TABIX.....
SY-LILLI IS ABSOLUTE NO OF LINES FROM WHICH THE EVENT WAS TRIGGERED.
45. What are internal tables? How do you get the number of lines in an internal table?
How to use a specific number occurs statement?
ANS:-
i)It is a standard data type object which exists only during the runtime of the program.
They are used to perform table calculations on subsets of database tables and for re-organising the contents of database tables according to users need.
ii)using SY-DBCNT.
iii)The number of memory allocations the system need to allocate for the next record population.
46. How do you take care of performance issues in your ABAP programs?
Performance of ABAPs can be improved by minimizing the amount of data to be transferred.
The data set must be transferred through the network to the applications, so reducing the amount OF time and also reduces the network traffic.
Some measures that can be taken are:
- Use views defined in the ABAP/4 DDIC (also has the advantage of better reusability).
- Use field list (SELECT clause) rather than SELECT *.
- Range tables should be avoided (IN operator)
- Avoid nested SELECTS.
i)system tools
ii)field symbols and field groups.
ans:-
Field Symbols : Field symbols are placeholders for existing fields. A Field Symbol does not physically reserve space for a field,but points to a field which is not known until runtime of the program.
eg:- FIELD-SYMBOL
Field groups : A field group combines several fields under one name.At runtime,the INSERT command is used to define which data fields are assigned to which field group.
There should always be a HEADER field group that defines how the extracted data will be sorted,the data is sorted by the fields grouped under the HEADER field group.
47. What are datasets?
ANS:-
The sequential files(ON APPLICATION SERVER) are called datasets. They are used for file handling in SAP.
48. How to find the return code of a statement in ABAP programs?
ANS:-
Using function modules.
49. What are interface/conversion programs in SAP?
ANS :
CONVERSION : LEGACY SYSTEM TO FLAT FILE.
INTERFACE : FLAT FILE TO SAP SYSTEM.
50. Have you used SAP supplied programs to load master data?
51. What are the techniques involved in using SAP supplied programs?
Do you prefer to write your own programs to load master data? Why?
52. What are logical databases? What are the advantages/disadvantages of logical databases?
ANS:-
To read data from a database tables we use logical database.
A logical database provides read-only access to a group of related tables to an ABAP/4 program.
adv:-
The programmer need not worry about the primary key for each table.Because Logical database knows how the different tables relate to each other,and can issue the SELECT command with proper where clause to retrieve the data.
i)An easy-to-use standard user interface.
ii)check functions which check that user input is complete,correct,and plausible.
iii)meaningful data selection.
iv)central authorization checks for database accesses.
v)good read access performance while retaining the hierarchical data view determined by the application logic.
disadv:-
i)If you donot specify a logical database in the program attributes,the GET events never occur.
ii)There is no ENDGET command,so the code block associated with an event ends with the next event
statement (such as another GET or an END-OF-SELECTION).
53. What specific statements do you using when writing a drill down report?
ans:-
AT LINE-SELECTION,AT USER-COMMAND,AT PF.
54. What are different tools to report data in SAP? What all have you used?
ans:-
55. What are the advantages and disadvantages of ABAP/4 query tool?
56. What are the functional areas? User groups? and how does ABAP/4 query work in relation to these?
57. Is a logical database a requirement/must to write an ABAP/4 query?
59. What are Change header/detail tables? Have you used them?
60. What do you do when the system crashes in the middle of a BDC batch session?
ans:-
we will look into the error log file (SM35).
61. What do you do with errors in BDC batch sessions?
ANS:-
We look into the list of incorrect session and process it again. To correct incorrect session we analyize the session to determine which screen and value produced the error.For small errors in data we correct them interactively otherwise
modify batch input program that has generated the session or many times even the datafile.
62. How do you set up background jobs in SAP? What are the steps? What are the event driven batch jobs?
ans:-
go to SM36 and create background job by giving job name,job class and job steps(JOB SCHEDULING)
63. Is it possible to run host command from SAP environment? How do you run?
64. What kind of financial periods exist in SAP? What is the relavent table for that?
65. Does SAP handle multiple currencies? Multiple languages?
ans:-
Yes.
66. What is a currency factoring technique?
67. How do you document ABAP/4 programs? Do you use program documentation menu option?
68. What is SAPscript and layout set?
ans:-
The tool which is used to create layout set is called SAPscript. Layout set is a design document.
69. What are the ABAP/4 commands that link to a layout set?
ans:-
control commands,system commands,
70. What is output determination?
71. What are IDOCs?
ans:-
IDOCs are intermediate documents to hold the messages as a container.
72. What are screen painter? menu painter? Gui status? ..etc.
ans:-
dynpro - flow logic + screens.
menu painter -
GUI Status - It is subset of the interface elements(title bar,menu bar,standard tool bar,push buttons) used for a certain screen.
The status comprises those elements that are currently needed by the transaction.
73. What is screen flow logic? What are the sections in it? Explain PAI and PBO.
ans:-
The control statements that control the screen flow.
PBO - This event is triggered before the screen is displayed.
PAI - This event is responsible for processing of screen after the user enters the data and clicks the pushbutton.
74. Overall how do you write transaction programs in SAP?
ans:-
Create program-SE93-create transcode-Run it from command field.
75. Does SAP has a GUI screen painter or not? If yes what operating systems is it available on? What is the other type of screen painter called?
76. What are step loops? How do you program pagedown pageup in step loops?
ans:-
step loops are repeated blocks of field in a screen.
77. Is ABAP a GUI language?
ANS:-
Yes.
ABAP IS AN EVENT DRIVEN LANGUAGE.
78. Normally how many and what files get created when a transaction program is written?
What is the XXXXXTOP program?
ans:-
ABAP/4 program.
DYNPRO
79. What are the include programs?
ANS:-
When the same sequence of statements in several programs are to be written repeadly they are coded in include programs (External programs) and are included in ABAP/4 programs.
80. Can you call a subroutine of one program from another program?
ans:- Yes- only external subroutines Using 'SUBMIT' statement.
81. What are user exits? What is involved in writing them? What precations are needed?
82. What are RFCs? How do you write RFCs on SAP side?
83. What are the general naming conventions of ABAP programs?
ANS:-
Should start with Y or Z.
84. How do you find if a logical database exists for your program requrements?
ans:-
SLDB-F4.
85. How do you find the tables to report from when the user just tell you the transaction he uses? And all the underlying data is from SAP structures?
ans:-
Transcode is entered in command field to open the table.Utilities-Table contents-display.
86. How do you find the menu path for a given transaction in SAP?
ans:-
87. What are the different modules of SAP?
ans:-
FI,CO,SD,MM,PP,HR.
89. How do you get help in ABAP?
ans:-
HELP-SAP LIBRARY,by pressing F1 on a keyword.
90. What are different ABAP/4 editors? What are the differences?
ans:-
91. What are the different elements in layout sets?
ans:-
PAGES,Page windows,Header,Paragraph,Character String,Windows.
92. Can you use if then else, perform ..etc statements in sap script?
ans:-
yes.
93. What type of variables normally used in sap script to output data?
94. How do you number pages in sapscript layout outputs?
95. What takes most time in SAP script programming?
ANS:-
LAYOUT DESIGN AND LOGO INSERTION.
96. How do you use tab sets in layout sets?
97. How do you backup sapscript layout sets? Can you download and upload? How?
98. What are presentation and application servers in SAP?
ANS:-
The application layer of an R/3 System is made up of the application servers and the message server. Application programs in an R/3 System are run on application servers. The application servers communicate with the presentation components, the database, and also with each other, using the message server.
99. In an ABAP/4 program how do you access data that exists on a presentation server vs on an application server?
ans:-
i)using loop statements.
ii)flat
100. What are different data types in ABAP/4?
ans:-
Elementary -
predefined C,D,F,I,N,P,T,X.
userdefined TYPES.
ex: see in intel book page no 35/65
Structured -
predefined TABLES.
userdefined Field Strings and internal tables.
101. What is difference between session method and Call Transaction?
ans:-
102. Setting up a BDC program where you find information from?
ans:-
103. What has to be done to the packed fields before submitting to a BDC session.
ans:-
fields converted into character type.
104. What is the structure of a BDC sessions.
ans:-
BDCDATA (standard structure).
105. What are the fields in a BDC_Tab Table.
ans:-
program,dynpro,dynbegin,fnam,fval.
106. What do you define in the domain and data element.
Technical details like
107. What is the difference between a pool table and a transparent table and how they are stored at the database level.
ans:-
ii)Pool tables is a logical representation of transparent tables .Hence no existence at database level. Where as transparent tables are physical tables and exist at database level.
108. What is cardinality?
For cardinality one out of two (domain or data element) should be the same for Ztest1 and Ztest2 tables. M:N
http://www.ittestpapers.com/articles/100-abap-interview-questions.html?page=5
SAP Smartforms Tutorial - Table Calculations using Sum Total
Within this SAP Smartforms tutorial, I will share ABAP codes with SAP Smartforms developers showing how to use Table Calculations using Sum - Total function in Smartform document.
Before going details with the Smartform table calculations, I want to note that the samples are created and executed on SAP Netweaver 7.01 ABAP Trial version. Please check the SAP Netweaver 7.01 ABAP trial version installation guide for details.
As the data source of the sample Smartform document, I will use the ZCARS ABAP table. The SAP Smartforms output will list the rows in ZCARS ABAP table.
So I create a new SAP Smartforms report using ABAP transaction code smartforms with Smart Form name ZSSF_CARS_LIST.
The ABAP internal table data will be displayed in the Smartform table control later in this Smartforms tutorial.
Go to Form > Global Settings > Global Definitions screen. Click on Initialization tab.
REFRESH GT_ZCARS.
SELECT * INTO TABLE GT_ZCARS FROM ZCARS.
Please note that in the output parameters list we should place the GT_ZCARS global variable. I prefer to use GT_ZCARS also in the input parameters list.
Here is the screenshot how Smartform developers can manage initialization section of this example output.
Of course, we have not yet defined the global variable GT_ZCARS. If you try to activate Samrtform, it will fail because of the undefined internal table.
Let's define global variables that are required in this example SAP Smartforms tutorial.
Go to Form > Global Settings > Global Definitions screen. Click on Global Data tab.
Create the following global variables in the Global Data table as follows.
Variable Name | Type Assignment | Associated Type | Default Value |
GT_ZCARS | TYPE TABLE OF | ZCARS | |
GS_ZCARS | TYPE | ZCARS | |
GV_ORDERNO | TYPE | CHAR3 | |
GV_COUNTER | TYPE | I | 0 |
GV_CATEGORYSUBTOTAL | TYPE | GTY_N10 | |
GV_TOTAL | TYPE | GTY_N10 | |
GV_N | TYPE | GTY_N10 |
ABAP developers will realize that I used a custom type GTY_N10 in the Global Data declarations type.
We have to define this data type in the SAP Smartform document before we can use it.
Go to Form > Global Settings > Global Definitions screen. Click on Types tab.
Type the followin ABAP code for type declaration.
TYPES :
BEGIN OF gty_N10,
N10(10) TYPE N,
END OF gty_N10.
Now we are ready to create SAP Smartforms Table control. Right click on Main window and choose Create > Table from context menu.
The data of the table is from ABAP internal table we have defined in Global Data tab and populated in Initialization tab. Let's assing the data source GT_ZCARS to SAP Smartforms table as seen in the below screenshot.
Go to the Data tab of the Table control, mark Internal Table checkbox. With data loop in internal table GT_ZCARS into GS_ZCARS structure or work area.
You will notice in the above screenshot that I added the CATEGORY field as sort criteria and mark the Event on Sort Begin and Event on Sort End checkboxes. These checkmarks will cause Smartform to create events and additional event lines just before and after the Main Area of the Smartform table.
Let's now create line types for table rows. I define two line types; one for displaying item rows and the second is for displaying category sum and overall total line.
And here is the details of table line types when you click Table Painter buton.
Now we can configure Table Calculations tab to display sum of numeric values listed on table using SUM Total operation.
The first line in Table Calculations is for auto numbering rows in the table display. ABAP developers can find the details about CNT Number Calculation example in SAP Smartforms Table in this target Smartform tutorial.
The second and third lines in Table Calculations manage the category subtotals and report total respectively.
Operation | Field Name | Target Field Name | Time | Reset | For Field Name |
CNT Number | GV_COUNTER | B Before Loop | S Sort Criterion | CATEGORY | |
SUM Total | GV_N | GV_CATEGORYSUBTOTAL-N10 | A After Loop | S Sort Criterion | CATEGORY |
SUM Total | GV_N | GV_TOTAL-N10 | A After Loop |
The above Table Calculations configuration will work as follows :
After each row displayed in the table, the global variable GV_N is summed into GV_CategorySubTotal-N10 variable value. The GV_CategorySubTotal-N10 value will be reset to its original value with Category field sort criterion. This means GV_CategorySubTotal-N10 will sum GV_N values from each row within same category. When the category changes, and a new category items begin listing on the table GV_CategorySubTotal-N10 will be set to 0, the initial value. So to display Category Subtotals, we will display GV_CategorySubTotal-N10 just before it is reset to initial value in the Category Event on Sort End line.
Just before printing the GV_CATEGORYSUBTOTAL-N10 value on the Smartform Text control within the event line cell, I remove preceeding zeros from the global variable.
* Remove preceeding zeros
SHIFT GV_CATEGORYSUBTOTAL-N10 LEFT DELETING LEADING '0'.
For the GV_TOTAL value which will display overall sum of the table row field, the third table calculation line will help Smartform developers. Note that this SUM calculation is same as previous calculation with exception this does not have a reset criteria. This means the sum operation will work for all table rows. The GV_N field variable calculated during table row display will be summed into target field GV_TOTAL-N10 till the end of all table rows. The GV_TOTAL-N10 total value can be easily displayed in SAP Smartforms table using the Table Footer section as follows.
After you activate SAP Smartform and run Smartform output, a similar report shown below will be displayed.