Abap Output list


Published on

Preview Original paying document published on :


You can find many more SAP training material on www.ExpertPlug.com.
ExpertPlug is an SAP marketplace for training materials and an online community of experts. We offer a simple way for the global SAP workforce, consulting companies and industry to market their skills and find quality information.
As an SAP Expert, you can also market your SAP skills and make extra cash by publishing SAP documents on www.ExpertPlug.com.

1 Like
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Abap Output list

  1. 1. ABAP Output List &ALV – ABAP List Viewer
  2. 2. ABAP Output list & ALV ABAP List ViewerABAP Output List Page 2
  3. 3. ABAP Output list & ALV ABAP List Viewer1 Introduction In this session, we will discuss the ABAP List Viewer, for the outputting of an ABAP report in a particular format. In classical ABAP reporting, the output lists are generated by WRITE statements. In this section, we will discuss how the list generation can be done in a normal ABAP report and how the same can be achieved via ALV List Display.2 Pre- Requisites For understanding the ABAP List Generation, we would need to traverse through the transaction codes SE38 – ABAP Editor SE37 – Function Builder SE11 – Data Dictionary3 Simple List Creation via ABAP statements In the business case we had been considering for our sessions, we had been trying to analyze the current market trends on salary against the current salary structure of employees. Any end user would want to see the results of the analysis to be available for them to discuss the further actions that needs to be taken based on these analytics. In this section we would looking into various options that are available for the output generation available via ABAP.3.1 Simple List Generation As in any other software development language, ABAP also has a list of statements that will generate the outputs on the screen / in spool for a particular execution of query or program. The main statement that can generate a simple output is the WRITE statement. The WRITE statement has various optional parameters that enable the formatting of the output being generated. A simple WRITE statement follows the syntax below WRITE: ‘text’, value.ABAP Output List Page 3
  4. 4. ABAP Output list & ALV ABAP List Viewer This text enclosed between the ‘’ are outputted as they are and the value indicates any value that the report has derived and wants to be outputted. This can be string, integer, character or any data type. Now, considering the business case, we would start off with outputting the heading of the output list – the purpose of the output .Let us say “MARKET ANALYSIS- SALARY TRENDS’ To achieve this, we would have to put “MARKET ANALYSIS- SALARY TRENDS” as it is without any modifications .So it can be achieved by the simple statement WRITE as shown below. Code Snippet: Report Output: The first line that the report has provided in the output screen is the name of the report maintained in the report attribute Towards the right hand corner we could see ’1’ which is again the page number, which is provided on default by the report during the output generation. Since the heading is preferably aligned to the center of the screen, we may need to add few format options also along with the WRITE statements to make it possible. To make a text/ output justified to Center, we add the option CENTRE-JUSTIFIED at the end of this statement as shown below WRITE: / ‘MARKET ANALYSIS- SALARY TRENDS’ CENTERED. Similarly to make an output RIGHT JUSTIFIED, the addition of RIGHT JUSTIFIED needs to be used instead of CENTERED or LEFT JUSTIFIED for the left justification of the output of a particular line .ABAP Output List Page 4
  5. 5. ABAP Output list & ALV ABAP List Viewer Code Snippet: To make a value be outputted to next line we use ‘/’ along with the WRITE statement as shown below. The next information that we may have to make available is the period for the analysis is being made – analysis of current financial year’s market trend or as per the value the end user has provided on the selection screen. Code Snippet: Report Output: If the new line feature represented by / is avoided, the output of the report would be similar to as shown below Code Snippet: Report Output:ABAP Output List Page 5
  6. 6. ABAP Output list & ALV ABAP List Viewer Now, considering the fact that an ERP landscape could be spread across multiple locations of an company across globe and that end users would prefer to see the data in their own preferred languages (that SAP currently supports),providing them in the ‘’ will not be ensure that this can be achieved . To achieve this, the text symbols needs to be used.3.1.1 Text symbols Text symbols are generated with the prefix of TEXT-nnn where nnn stands for any alphanumeric of length 3. For e.g.: text-001 or text-n01. Write: / text-n00 would output the value maintained in the text-symbols. Once a preferred translation is maintained for the symbols, the value will be displayed, as per the logon language. Code Snippet: To Assign the text to text-001, Step 1: double click on text-011. Step 2: A new pop up window appears as shown below Step 3: Press “Yes” to continue to map the string to the text-001.ABAP Output List Page 6
  7. 7. ABAP Output list & ALV ABAP List Viewer Step 4: Save the report before proceeding further Step 5: A new window appears as shown below Step 6 : Maintain MARKET ANALYSIS- SALARY TRENDS’ against 001 and activate the text symbol . So in our case, ‘MARKET ANALYSIS- SALARY TRENDS’ is assigned to text-000. This also ensures that the literals inside the coding are reduced to a minimum and the mantainence of the code will be reduced as this ensures easy change of values for a common point. To maintain the different language equivalents, translation of this string has to be maintained To maintain these translations, the user has to have the following authorization object S_TRANSLAT linked to their user name/role assigned. For e.g.: if the German equivalent has to be maintained for the same string so that your German counterpart can view the information in German while logging using “DE” as the logon language. If ‘MARKET ANALYSIS- SALARY TRENDS’ is translated as ‘MARKT ANALYSE-GEHALT TRENDS’ in German, and this has to be assigned to the text-001, the Step 1: Go to the menu “GO TO” Step 2: Scroll to the option of “Translation” below this menuABAP Output List Page 7
  8. 8. ABAP Output list & ALV ABAP List Viewer Step 3: A pop window appears where in the language has to be provided where the translation is to be provided. In our case we are to maintain the German translation for the above mentioned string “DE” Step 4: Press “F4” function button to get the language key for German. A pop up appears with the available languages and its corresponding keys. Step 5: Select “DE” the German language Step 6: Press “Enter” to translate this text symbol.ABAP Output List Page 8
  9. 9. ABAP Output list & ALV ABAP List Viewer Step 7: If a message appears saying “No authorization assigned”, type in the tcode “SU53” in the same session. A new window appears providing you the information of the type of access a user has for the current transaction as shown below In such cases this authorization object has to be assigned by the people responsible for the user maintenance. If the user has the authorization to maintain the translation, a new window would appear where the German text could be provided and once done, press “enter” and activate the same for the initial screen.3.1.2 Underline The heading sometimes needs to be underlined and this is achieved by the usage of the SY-ULINE in addition to WRITE statement as shown below: Code Snippet Write :/0(20) -> this indicates that from position 0 to position 20, an underline has to be provided To underline the heading information Code Snippet: Report Output:ABAP Output List Page 9
  10. 10. ABAP Output list & ALV ABAP List Viewer3.1.3 Color and highlight COLOR ON / COLOR OFF help to assign a specific color to the output list as the end user needs – to highlight a value or for formatting purpose. Code Snippet Report Output This addition needs to be maintained for each WRITE statement. After the keyword “COLOR” one of the following constants has to be assigned to get the correct color for highlighting the text COL_BACKGROUND } 0 GUI-specific { 1 | COL_HEADING } 1 Gray-blue { 2 | COL_NORMAL } 2 Light gray { 3 | COL_TOTAL } 3 Yellow { 4 | COL_KEY } 4 Blue-green { 5 | COL_POSITIVE } 5 Green { 6 | COL_NEGATIVE } 6 Red { 7 | COL_GROUP } 7 Violet3.2 TOP OF PAGE As per the report generated, the heading of the output needs to be present always on the top of every page that may be generated. For achieving this, we can you use one of the 7 events that a report has -the event TOP-OF-PAGE. Code SnippetABAP Output List Page 10
  11. 11. Preview Original paying document published on :http://expertplug.com/materials/training/abap-output-listYou can find many more full SAP training material and SAP jobs on www.ExpertPlug.com.ExpertPlug is an SAP marketplace for training materials and an online community of experts. Weoffer a simple way for the global SAP workforce, consulting companies and industry to market theirskills and find quality information.As an SAP Expert, you can also market your SAP skills and make extra cash by publishing SAPdocuments on www.ExpertPlug.com.