Skip to Content
author's profile photo Former Member
Former Member

Classical vs ALV report allignment

Hi Friends,

In classical report 'm getting the output as follows.

PROGRAM ID:  Z2S0K123         Canada-Singapore Corp            PAGE :     1
18.06.2009 14:41:28            Production Materials           USERNAME: RSKUM 

How can I display the same allignment using ALV display?

Thanks in advance.

Regards,

Viji.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

12 Answers

  • Posted on Jun 18, 2009 at 07:40 AM

    Hi,

    Refer the wiki for displaying data in ALV Grid:-

    https://www.sdn.sap.com/irj/scn/wiki?path=/display/snippets/learn%252bto%252bdisplay%252bdata%252bin%252balv%252bgrid

    Now if you want the text to be JUSTIFIED the use the field catalog properties to middle align the text.

    Hope this helps you.

    Regards,

    Tarun Gambhir

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 18, 2009 at 07:43 AM

    Hello,

    As per my understanding, the text you have given in post is the part of the header of your report.

    You can have the same header in ALV list output. Just write the same code in the form for top of page.

    You need to use the events for ALV.

    Please try the below code.

    DATA: f_event   TYPE slis_alv_event,
              t_events  TYPE slis_t_event,
              w_repid   TYPE repid.
    TYPE-POOLS: slis.
    
    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
         EXPORTING
              i_list_type     = 0
         IMPORTING
              et_events       = t_events
         EXCEPTIONS
              list_type_wrong = 1
              OTHERS          = 2.
    IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    SORT t_events BY name.
    READ TABLE t_events WITH KEY name = slis_ev_top_of_page
                             INTO f_event BINARY SEARCH.
    IF sy-subrc = 0.
      MOVE  <slis_ev_top_of_page>   "<-- Form name for top of page (TOP_OF_PAGE)
        TO  f_event-form.
      APPEND f_event TO t_events.
    ENDIF.
    DELETE t_events WHERE form IS initial.
    w_repid = sy-repid.
    
    CALL FUNCTION reuse_alv_list_display
         EXPORTING
              is_layout                  = gf_layout
              it_fieldcat                = gt_fieldcat
              it_events                  = t_events
         TABLES
              t_outtab                   = gt_disp
         EXCEPTIONS
              program_error              = 1
              maximum_of_appends_reached = 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.
    
    *---------------------------------------------------------------------*
    *       FORM <TOP_OF_PAGE>                                            *
    *---------------------------------------------------------------------*
    *       ........                                                      *
    *---------------------------------------------------------------------*
    FORM <top_of_page>.
    WRITE: /'PROGRAM ID:',  <z2s0k123>, 28 'Canada-Singapore Corp', 58 'PAGE:',  <     1>
    <18.06.2009>, <14:41:28>,  28 ' Production Materials ',   57 'USERNAME:', <rskum>.
    ENDFORM.
    

    When the ALV display FM is called, it internally call the TOP_OF_PAGE subroutine.

    Thus you can get the top of page as you want.

    Hope this helps you.

    Regards,

    Sachinkumar Mehta

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 18, 2009 at 07:48 AM

    Hi Viji,

    You can achieve this by using the Field catalog parameters/properties

    FIELDCATALOG-JUST = 'L' / 'R' / 'C'.

    Thanks & regards,

    Dileep .C

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 18, 2009 at 07:48 AM

    Hello Viji,

    Two things to remember:

    1. If you are using an ALV list, then it is easy 😊) You can use WRITE stmts and use the formatting options.

    2. If you are using ALV Grid, it is a bit cumbersome. But still you have Tarun's wiki for your reference 😊)

    All the best !!!

    BR,

    Suhas

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 18, 2009 at 07:48 AM

    Please ignore this!

    Edited by: Vin on Jun 18, 2009 9:51 AM

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 18, 2009 at 07:49 AM

    Please ignore this!

    Edited by: Vin on Jun 18, 2009 9:51 AM

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 18, 2009 at 07:49 AM

    Viji....you have to create an itnernal table which will hold all these details...i.e. should have one column..in the internal table

    *      Types declaration to hold header details, displayed in ALV.
           BEGIN OF ty_header,
             col1(500)  TYPE c,
           END OF ty_header,
    
    DATA: gt_header          TYPE STANDARD TABLE OF ty_header,
              gv_gap1(25)              TYPE c VALUE '                        '.
    
    *       Concatenate Program ID, Comp Name and Page number.
            CONCATENATE gv_text1
                                     gv_text2
                                     sy-pageno
                                INTO gv_text
             SEPARATED BY gv_gap1.
    
            gs_header-col1 = gv_text.
            APPEND gs_header TO gt_header.
    
    * Similarly do it for other fields also...and then
        APPEND gs_header TO gt_header.
    
    *   Display first header 
        CALL METHOD gv_grid_control2->set_table_for_first_display
          EXPORTING
                is_layout                     = gs_layout1
          CHANGING
                it_outtab                     = gt_header
                it_fieldcatalog               = gt_fieldcat2
              EXCEPTIONS
                invalid_parameter_combination = 1
                program_error                 = 2
                too_many_lines                = 3
                OTHERS                        = 4.
    
    

    You may get better answers than these

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 18, 2009 at 07:50 AM

    Hi,

    You can display the same in the TOP -OF -PAGE.... or use

    'JUST' property, " (R)ight (L)eft (C)ent.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 18, 2009 at 07:50 AM

    Hi Viji,

    You can achieve this by using the Field catalog parameters/properties

    FIELDCATALOG-JUST = 'L' / 'R' / 'C'.

    Thanks & regards,

    Dileep .C

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 18, 2009 at 07:50 AM

    I wonder How I could post three same messages at a time...! Luckyly one more person also seem to be had troubled.

    @Fun

    ---Dileep .C

    Edited by: Dileep Kumar Chinnaiah on Jun 18, 2009 3:54 PM

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.