SlideShare uma empresa Scribd logo
1 de 11
ABAP Output List
          &
ALV – ABAP List Viewer
ABAP Output list & ALV ABAP List Viewer




ABAP Output List                                             Page 2
ABAP Output list & ALV ABAP List Viewer

1 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 Dictionary


3 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
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
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
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
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 menu




ABAP Output List                                                                        Page 7
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
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
ABAP Output list & ALV ABAP List Viewer
3.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 Violet



3.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 Snippet




ABAP Output List                                                                        Page 10
Preview Original paying document published on :
http://expertplug.com/materials/training/abap-output-list


You 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. 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.

Mais conteúdo relacionado

Destaque

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

Destaque (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Abap Output list

  • 1. ABAP Output List & ALV – ABAP List Viewer
  • 2. ABAP Output list & ALV ABAP List Viewer ABAP Output List Page 2
  • 3. ABAP Output list & ALV ABAP List Viewer 1 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 Dictionary 3 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. 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. 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. 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. 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 menu ABAP Output List Page 7
  • 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. 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. ABAP Output list & ALV ABAP List Viewer 3.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 Violet 3.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 Snippet ABAP Output List Page 10
  • 11. Preview Original paying document published on : http://expertplug.com/materials/training/abap-output-list You 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. 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.