Colouring a row in alv display

Hi,
Can we colour one row dynamically(depending on input data) in alv display? If possible how?
Thank you.

Hi,
<b>Refer the code below and reward points if it helps.</b>
REPORT zcuitest_alv_07.
* Use of colours in ALV grid (cell, line and column)            *
* Table
TABLES : mara.
* Type
TYPES : BEGIN OF ty_mara,
          matnr         LIKE mara-matnr,
          matkl         LIKE mara-matkl,
          counter(4)    TYPE n,
          free_text(15) TYPE c,
          color_line(4) TYPE c,           " Line color
          color_cell    TYPE lvc_t_scol,  " Cell color
END OF ty_mara.
* Structures
DATA  : wa_mara     TYPE ty_mara,
        wa_fieldcat TYPE lvc_s_fcat,
        is_layout   TYPE lvc_s_layo,
        wa_color    TYPE lvc_s_scol.
* Internal table
DATA : it_mara     TYPE STANDARD TABLE OF ty_mara,
       it_fieldcat TYPE STANDARD TABLE OF lvc_s_fcat,
       it_color    TYPE TABLE          OF lvc_s_scol.
* Variables
DATA : okcode LIKE sy-ucomm,
       w_alv_grid          TYPE REF TO cl_gui_alv_grid,
       w_docking_container TYPE REF TO cl_gui_docking_container.
PARAMETERS : p_column AS CHECKBOX,
             p_line   AS CHECKBOX,
             p_cell   AS CHECKBOX.
START-OF-SELECTION.
  PERFORM get_data.
END-OF-SELECTION.
  PERFORM fill_catalog.
  PERFORM fill_layout.
  CALL SCREEN 2000.
*&      Module  status_2000  OUTPUT
*       text
MODULE status_2000 OUTPUT.
  SET PF-STATUS '2000'.
ENDMODULE.                 " status_2000  OUTPUT
*&      Module  user_command_2000  INPUT
*       text
MODULE user_command_2000 INPUT.
  DATA : w_okcode LIKE sy-ucomm.
  MOVE okcode TO w_okcode.
  CLEAR okcode.
  CASE w_okcode.
    WHEN 'BACK'.
      LEAVE TO SCREEN 0.
  ENDCASE.
ENDMODULE.                 " user_command_2000  INPUT
*&      Module  alv_grid  OUTPUT
*       text
MODULE alv_grid OUTPUT.
  IF w_docking_container IS INITIAL.
    PERFORM create_objects.
    PERFORM display_alv_grid.
  ENDIF.
ENDMODULE.                 " alv_grid  OUTPUT
*&      Form  create_objects
*       text
*  -->  p1        text
*  <--  p2        text
FORM create_objects.
* Ratio must be included in [5..95]
  CREATE OBJECT w_docking_container
    EXPORTING
      ratio                       = 95
    EXCEPTIONS
      cntl_error                  = 1
      cntl_system_error           = 2
      create_error                = 3
      lifetime_error              = 4
      lifetime_dynpro_dynpro_link = 5
      others                      = 6.
  CREATE OBJECT w_alv_grid
    EXPORTING
      i_parent          = w_docking_container.
ENDFORM.                    " create_objects
*&      Form  display_alv_grid
*       text
*  -->  p1        text
*  <--  p2        text
FORM display_alv_grid.
  CALL METHOD w_alv_grid->set_table_for_first_display
    EXPORTING
      is_layout                     = is_layout
    CHANGING
      it_outtab                     = it_mara
      it_fieldcatalog               = it_fieldcat
    EXCEPTIONS
      invalid_parameter_combination = 1
      program_error                 = 2
      too_many_lines                = 3
      OTHERS                        = 4.
ENDFORM.                    " display_alv_grid
*&      Form  get_data
*       text
*  -->  p1        text
*  <--  p2        text
FORM get_data.
  SELECT * FROM mara UP TO 5 ROWS.
    CLEAR : wa_mara-color_line, wa_mara-color_cell.
    MOVE-CORRESPONDING mara TO wa_mara.
    ADD 1                   TO wa_mara-counter.
    MOVE 'Blabla'           TO wa_mara-free_text.
    IF wa_mara-counter = '0002'
    AND p_line = 'X'.
* Color line
      MOVE 'C410' TO wa_mara-color_line.
    ELSEIF wa_mara-counter = '0004'
    AND p_cell = 'X'.
* Color cell
      MOVE 'FREE_TEXT' TO wa_color-fname.
      MOVE '5'         TO wa_color-color-col.
      MOVE '1'         TO wa_color-color-int.
      MOVE '1'         TO wa_color-color-inv.
      APPEND wa_color TO it_color.
      wa_mara-color_cell[] = it_color[].
    ENDIF.
    APPEND wa_mara TO it_mara.
  ENDSELECT.
ENDFORM.                    " get_data
*&      Form  fill_catalog
*       text
*  -->  p1        text
*  <--  p2        text
FORM fill_catalog.
* Colour code :                                                 *
* Colour is a 4-char field where :                              *
*              - 1st char = C (color property)                  *
*              - 2nd char = color code (from 0 to 7)            *
*                                  0 = background color         *
*                                  1 = blue                     *
*                                  2 = gray                     *
*                                  3 = yellow                   *
*                                  4 = blue/gray                *
*                                  5 = green                    *
*                                  6 = red                      *
*                                  7 = orange                   *
*              - 3rd char = intensified (0=off, 1=on)           *
*              - 4th char = inverse display (0=off, 1=on)       *
* Colour overwriting priority :                                 *
*   1. Line                                                     *
*   2. Cell                                                     *
*   3. Column                                                   *
  DATA : w_position TYPE i VALUE '1'.
  CLEAR wa_fieldcat.
  MOVE w_position TO wa_fieldcat-col_pos.
  MOVE 'MATNR'    TO wa_fieldcat-fieldname.
  MOVE 'MARA'     TO wa_fieldcat-ref_table.
  MOVE 'MATNR'    TO wa_fieldcat-ref_field.
  APPEND wa_fieldcat TO it_fieldcat.
  ADD 1 TO w_position.
  CLEAR wa_fieldcat.
  MOVE w_position TO wa_fieldcat-col_pos.
  MOVE 'MATKL'    TO wa_fieldcat-fieldname.
  MOVE 'MARA'     TO wa_fieldcat-ref_table.
  MOVE 'MATKL'    TO wa_fieldcat-ref_field.
* Color column
  IF p_column = 'X'.
    MOVE 'C610'     TO wa_fieldcat-emphasize.
  ENDIF.
  APPEND wa_fieldcat TO it_fieldcat.
  ADD 1 TO w_position.
  CLEAR wa_fieldcat.
  MOVE w_position TO wa_fieldcat-col_pos.
  MOVE 'COUNTER'  TO wa_fieldcat-fieldname.
  MOVE 'N'        TO wa_fieldcat-inttype.
  MOVE '4'        TO wa_fieldcat-intlen.
  MOVE 'Counter'  TO wa_fieldcat-coltext.
  APPEND wa_fieldcat TO it_fieldcat.
  ADD 1 TO w_position.
  CLEAR wa_fieldcat.
  MOVE w_position  TO wa_fieldcat-col_pos.
  MOVE 'FREE_TEXT' TO wa_fieldcat-fieldname.
  MOVE 'C'         TO wa_fieldcat-inttype.
  MOVE '20'        TO wa_fieldcat-intlen.
  MOVE 'Text'      TO wa_fieldcat-coltext.
  APPEND wa_fieldcat TO it_fieldcat.
ENDFORM.                    " fill_catalog
*&      Form  fill_layout
*       text
*  -->  p1        text
*  <--  p2        text
FORM fill_layout.
* Field that identify color line in internal table
  MOVE 'COLOR_LINE' TO is_layout-info_fname.
* Field that identify cell color in inetrnal table
  MOVE 'COLOR_CELL' TO is_layout-ctab_fname.
ENDFORM.                    " fill_layout
<b>Flow logic code</b>
Code:
PROCESS BEFORE OUTPUT.
  MODULE status_2000.
  MODULE alv_grid.
PROCESS AFTER INPUT.
  MODULE user_command_2000.

Similar Messages

  • How to change the colour of row in ALV depending on condition?

    Hi All,
    I want to change the color(from green to red )of perticular row in ALV depending on certain conditions like if amount in some field in row is more than 5000.
    Can anybody please tell me how to do that?
    expecting early reply.
    Thanks in advance,
    Rohini.

    Hi
    Check this sample report
    *& Report  ZALVCOLOR                                                   *
    REPORT  ZALVCOLOR                               .
    DATA : mara TYPE mara.                 " General Material Data
    TYPE-POOLS: slis.                      " ALV Global types
    FIELD-SYMBOLS :
      <data> TYPE table.                   " Data to display
    SELECT-OPTIONS :
      s_matnr FOR mara-matnr.              " Material number
    SELECTION-SCREEN :
      SKIP, BEGIN OF LINE,COMMENT 5(27) v_1 FOR FIELD p_max.    "#EC NEEDED
    PARAMETERS p_max(2) TYPE n DEFAULT '50' OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    INITIALIZATION.
      v_1 = 'Maximum of lines to display'.
    START-OF-SELECTION.
      PERFORM f_read_data.
      PERFORM f_display_data.
    *      Form  f_read_data
    FORM f_read_data.
      FIELD-SYMBOLS :
        <field>    TYPE ANY,
        <field2>   TYPE ANY,
        <header>   TYPE ANY,
        <header2>  TYPE ANY,
        <lt_data>  TYPE table.             " Data read from DB
      DATA:
        lp_struct  TYPE REF TO data,
        lp_struct2 TYPE REF TO data,
        lp_table   TYPE REF TO data,       " Pointer to dynamic table
        lp_table2  TYPE REF TO data,       " Pointer to dynamic table
        ls_lvc_cat TYPE lvc_s_fcat,
        lt_lvc_cat TYPE lvc_t_fcat.        " Field catalog
    * First column
      CLEAR ls_lvc_cat.
      ls_lvc_cat-fieldname = 'MATNR'.
      ls_lvc_cat-ref_table = 'MARA'.
      APPEND ls_lvc_cat TO lt_lvc_cat.
    * 2nd column
      CLEAR ls_lvc_cat.
      ls_lvc_cat-fieldname = 'MAKTX'.
      ls_lvc_cat-ref_table = 'MAKT'.
      APPEND ls_lvc_cat TO lt_lvc_cat.
    * 3rd column
      CLEAR ls_lvc_cat.
      ls_lvc_cat-fieldname = 'MATKL'.
      ls_lvc_cat-ref_table = 'MARA'.
      APPEND ls_lvc_cat TO lt_lvc_cat.
    * Create 1st internal table
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING it_fieldcatalog = lt_lvc_cat
        IMPORTING ep_table = lp_table.
      ASSIGN lp_table->* TO <lt_data>.
    * Read data into 1st internal table
      SELECT matnr maktx matkl
        INTO TABLE <lt_data>
        FROM v_matnr
          UP TO p_max ROWS
       WHERE matnr IN s_matnr.
    * Create 2nd internal table
    * Checkbox
      CLEAR ls_lvc_cat.
      ls_lvc_cat-fieldname = 'CHECKBOX'.
      APPEND ls_lvc_cat TO lt_lvc_cat.
    * Table color
      CLEAR ls_lvc_cat.
      ls_lvc_cat-fieldname = 'TABCOLOR'.
      ls_lvc_cat-ref_table = 'CALENDAR_TYPE'.
      ls_lvc_cat-ref_field = 'COLTAB'.
      APPEND ls_lvc_cat TO lt_lvc_cat.
    * Create 2nd internal table
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING it_fieldcatalog = lt_lvc_cat
        IMPORTING ep_table = lp_table2.
      ASSIGN lp_table2->* TO <data>.
    * Create structure = structure of the 1st internal table
      CREATE DATA lp_struct LIKE LINE OF <lt_data>.
      ASSIGN lp_struct->* TO <header>.
    * Create structure = structure of the 2nd internal table
      CREATE DATA lp_struct2 LIKE LINE OF <data>.
      ASSIGN lp_struct2->* TO <header2>.
    * Move data from 1st internal table --> 2nd internal table
      LOOP AT <lt_data> ASSIGNING <header>.
        DESCRIBE TABLE lt_lvc_cat.
        CLEAR <header2>.
    *   Fill the internal to display <data>
        DO sy-tfill TIMES.
          READ TABLE lt_lvc_cat INTO ls_lvc_cat INDEX sy-index.
    *     For each field of lt_lvc_cat.
          ASSIGN COMPONENT ls_lvc_cat-fieldname OF STRUCTURE <header>
                        TO <field>.
          IF sy-subrc NE 0. EXIT .ENDIF.
          ASSIGN COMPONENT ls_lvc_cat-fieldname OF STRUCTURE <header2>
                        TO <field2>.
          IF sy-subrc NE 0. EXIT .ENDIF.
          <field2> = <field>.
        ENDDO.
    *   Modify color
        ASSIGN COMPONENT 'TABCOLOR' OF STRUCTURE <header2>
                      TO <field2>.
        IF sy-subrc EQ 0.
          PERFORM f_modify_color USING 'MAKTX' <field2>.
          PERFORM f_modify_color USING 'MATKL' <field2>.
        ENDIF.
        APPEND <header2> TO <data> .
      ENDLOOP.
    ENDFORM.                    " f_read_data
    *      Form  F_DISPLAY_DATA
    FORM f_display_data.
    * Macro definition
      DEFINE m_sort.
        add 1 to ls_sort-spos.
        ls_sort-fieldname = &1.
        ls_sort-down      = 'X'.
        append ls_sort to lt_sort.
      END-OF-DEFINITION.
      DATA:
        ls_layout   TYPE slis_layout_alv,
        lt_sort     TYPE slis_t_sortinfo_alv,
        ls_sort     TYPE slis_sortinfo_alv,
        ls_fieldcat TYPE slis_fieldcat_alv,
        lt_fieldcat TYPE slis_t_fieldcat_alv.  " Field catalog
    * Build Fieldcatalog - First column
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname   = 'MATNR'.
      ls_fieldcat-ref_tabname = 'MARA'.
      ls_fieldcat-key  = 'X'.
      APPEND ls_fieldcat TO lt_fieldcat.
    * Build Fieldcatalog - 2nd column
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname   = 'MAKTX'.
      ls_fieldcat-ref_tabname = 'MAKT'.
      APPEND ls_fieldcat TO lt_fieldcat.
    * Build Fieldcatalog - 3rd column
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname   = 'MATKL'.
      ls_fieldcat-ref_tabname = 'MARA'.
      APPEND ls_fieldcat TO lt_fieldcat.
    * Layout
      ls_layout-zebra = 'X'.
      ls_layout-colwidth_optimize = 'X'.
      ls_layout-box_fieldname = 'CHECKBOX'.
      ls_layout-coltab_fieldname = 'TABCOLOR'.
      m_sort 'MATNR'.                      " Sort by creation date
    * Display data
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                is_layout   = ls_layout
                it_fieldcat = lt_fieldcat
                it_sort     = lt_sort
           TABLES
                t_outtab    = <data>.
    ENDFORM.                               " F_DISPLAY_DATA
    *      Form  F_modify_color
    FORM f_modify_color USING u_fieldname TYPE lvc_fname
                              ut_tabcolor TYPE table.
      DATA:
        l_rnd_value TYPE datatype-integer2,
        ls_tabcolor TYPE lvc_s_scol.
    * Random value
      CALL FUNCTION 'RANDOM_I2'
           EXPORTING
                rnd_min   = 0
                rnd_max   = 3
           IMPORTING
                rnd_value = l_rnd_value.
      CLEAR ls_tabcolor.
      ls_tabcolor-fname = u_fieldname.
      CASE l_rnd_value.
        WHEN 0.
          ls_tabcolor-color-col = 1.       " Blue.
          ls_tabcolor-color-int = 0.
          ls_tabcolor-color-inv = 0.
        WHEN 1.
          ls_tabcolor-color-col = 3.       " Yellow.
          ls_tabcolor-color-int = 0.
          ls_tabcolor-color-inv = 0.
        WHEN 2.
          ls_tabcolor-color-col = 5.       " Green.
          ls_tabcolor-color-int = 0.
          ls_tabcolor-color-inv = 0.
        WHEN 3.
          ls_tabcolor-color-col = 6.       " Red.
          ls_tabcolor-color-int = 0.
          ls_tabcolor-color-inv = 0.
      ENDCASE.
      INSERT ls_tabcolor INTO TABLE ut_tabcolor.
    ENDFORM.                               " F_MODIFY_COLOR
    Reward all helpfull answers
    Regards
    Pavan

  • How to set selected row in alv display?

    Hi,
    How do I select some particular row in alv - say at first display i want to highlight 4th row. How can i do that?
    Thanks,
    Sheel

    try to use method set_selected_rows just after method for first display.

  • Delete Selected rows in ALV display

    Hi everyone,
    I have a requirement where in my output display, I will have 3 buttons, like Select all, Deselect all and Delete selected.
    For Select all and Deselect all I am able to write code and they are working fine. But for Delete selected I am not getting
    its actual functionality in the output.
    Please help me in this and provide some part of code which can fulfill this.
    Regards.
    Moderator Message: FAQ. Explore the already given answers and search the forum and the web for more.
    Edited by: kishan P on Sep 15, 2010 12:45 PM

    Hi Dieter,
    I think the problem is smwhr else...Delete is a stanard functionality in the ALV Grid and would not fire your own code...
    @Latha: I guess the row is getting deleted but your functionality is not working..If that is right then follow this approach:
    When u delete a row it doesnot call your event handler and hence your code is not executed...You have to implement the toolbar event for this...In the toolbar event put a breakpoint and see the sy-ucomm for delete...you will then have to manually change this standard delete sy-ucomm to your custom sy-ucomm...
    The code in the handle_toolbar method would be somthing like this
    loop at mt-toolbar.
    if sy-ucomm = standarad delete code
      replace with your own custom code for exapmle 'DELETE'.
    endif.
    endloop. 
    Once you have done this then the Delete row would fire your own code for delete event...
    Hope this helps...
    Regards,
    Sitakant

  • Overlapping rows in ALV Display

    Hi
    I have a report, which when run in forground displays the output in correct format(ALV), but same report when run in background, the output rows overlaps with eachother.
    Experts please sugest the possible reasons for this. Or point out the possible culprit line in the code below...
    Following is the code used for the ALV.
      DATA : lv_scrtext_l TYPE scrtext_l,
             lv_scrtext_m TYPE scrtext_m,
             lv_scrtext_s TYPE scrtext_s,
             l_no        TYPE numc3.
      TRY.
          CALL METHOD CL_SALV_TABLE=>FACTORY
            IMPORTING
              R_SALV_TABLE = GO_TABLE
            CHANGING
              T_TABLE      = IT_FINAL_2.
        CATCH cx_salv_msg .
      ENDTRY.
      LR_COLUMNS = GO_TABLE->GET_COLUMNS( ).
      LR_COLUMNS->SET_OPTIMIZE( 'X' ).
    Return structure of the table.
      REF_TABLE_DESCR ?= CL_ABAP_TYPEDESCR=>DESCRIBE_BY_DATA( WA_FINAL ).
      IT_TABDESCR[] = REF_TABLE_DESCR->COMPONENTS[].
      READ TEXTPOOL sy-repid INTO it_text_tab LANGUAGE sy-langu .
      LOOP AT IT_TABDESCR INTO WA_TABDESCR.
        l_no  = sy-tabix.
        Try.
            LR_COLUMN ?= LR_COLUMNS->GET_COLUMN( WA_TABDESCR-NAME ).
            IF  WA_TABDESCR-NAME = 'PERNR'.
              LR_COLUMN->SET_KEY(  ).
            ENDIF.
          CATCH CX_SALV_NOT_FOUND .
        ENDTRY.
        CASE wa_tabdescr-name+0(3).
          WHEN 'DOM' OR 'SUB' OR 'TLE' OR 'COE' OR  'DOJ'.
            READ TABLE pnpbukrs INTO pnpbukrs INDEX 1.
            IF SY-SUBRC =  0.
              SELECT SINGLE entity_code FROM zhrtr_entity_com INTO g_entity "#EC CI_NOFIRST
                                    WHERE comp_code = pnpbukrs-low AND
                                     endda = c_99991231.
              IF SY-SUBRC = 0  AND g_entity NE '0002'.
                lr_column->set_visible( ' ' ).
              ENDIF.
            ENDIF.
        ENDCASE.
        IF WA_TABDESCR-NAME EQ 'PSPID' .
          LV_CHECK = 'X'.
        ENDIF.
        READ TABLE it_text_tab INTO wa_text_tab WITH KEY id = 'I'
        key = l_no .
        lv_scrtext_l = wa_text_tab-entry.
        lv_scrtext_m = wa_text_tab-entry.
        lv_scrtext_s = wa_text_tab-entry.
        lr_column->set_long_text( lv_scrtext_l ).
        lr_column->set_medium_text( lv_scrtext_m ).
        lr_column->set_short_text( lv_scrtext_s ).
        CLEAR lv_scrtext_l .
        CLEAR lv_scrtext_m .
        CLEAR lv_scrtext_s.
    *col_1 col_background        '0'.
    *col_1 col_heading           '1'.
    *col_1 col_normal            '2'.
    *col_1 col_total             '3'.
    *col_1 col_key               '4'.
    *col_1 col_positive          '5'.
    *col_1 col_negative          '6'.
    *col_1 col_group             '7'.
        IF LV_CHECK IS INITIAL.
          LS_COLOR-COL = col_background.
        ELSE.
          LS_COLOR-COL = col_key.  "col_group  .
        ENDIF.
        LS_COLOR-INT = 1.
        LS_COLOR-INV = 1.
        LR_COLUMN->SET_COLOR( LS_COLOR ).
        CLEAR : lv_scrtext_l, lv_scrtext_m, lv_scrtext_s.
      ENDLOOP.
      DATA: LR_DISPLAY_SETTINGS TYPE REF TO CL_SALV_DISPLAY_SETTINGS.
    *Set the striped pattern
      LR_DISPLAY_SETTINGS = GO_TABLE->GET_DISPLAY_SETTINGS( ).
      CALL METHOD LR_DISPLAY_SETTINGS->SET_STRIPED_PATTERN
        EXPORTING
          VALUE = 'X'.
    CALL METHOD lr_display_settings->set_fit_column_to_table_size
      EXPORTING
        value  = IF_SALV_C_BOOL_SAP=>TRUE.
      LR_FUNCTIONS = GO_TABLE->GET_FUNCTIONS( ).
      LR_FUNCTIONS->SET_ALL( 'X' ).
      GO_TABLE->DISPLAY( ).

    While setting the layout you can set the maximum line size as 1023.

  • Colouring a row in ALV oops

    Hello Experts,
    Very Good Morning !
    I have a requirement where in the output of alv i have 3 fields and the layout looks as follows
    a            b              c          
    mara     matnr        1         
    mara    ersda         1
    mara    ernam        1
    lfa1       lifnr           2
    lfa1      LAND1       2
    lfa1      NAME1       2
    lfa1     name2         2
    so my requirement is when ever the value of the field c is changed the colour of the last four records which contains the c value 2 must change,the four records shoud appear with some other colour, also below if the value of c is changed from 2 to 3 then all the records with c = 3 must change with some other colour.
    the output must look with different colour with different c values
    so any one can help me in this issue?
    Regards,
    Badri

    Hi
        Try This code
    REPORT  ZPRI_ALV_ROW_COLOR.
    TABLES: MARA , MAKT .
    DATA: LAYOUT TYPE LVC_S_LAYO .
    DATA: CONT1 TYPE REF TO CL_GUI_CUSTOM_CONTAINER .
    DATA: GRID1 TYPE REF TO CL_GUI_ALV_GRID .
    DATA: FCAT1 TYPE LVC_T_FCAT .
    DATA: WA_FCAT1 LIKE LINE OF FCAT1 .
    TYPES : BEGIN OF TYPE_ITAB1 ,
             MATNR LIKE MARA-MATNR ,
             MTART LIKE MARA-MTART,
             MATKL LIKE MARA-MATKL ,
             MAKTX LIKE MAKT-MAKTX ,
             COL(4) TYPE C ,
           END OF TYPE_ITAB1 .
    DATA: IT_ITAB1 TYPE STANDARD TABLE OF TYPE_ITAB1 WITH HEADER LINE .
    DATA: LEN TYPE I.
    LAYOUT-INFO_FNAME = 'COL' .
    break devuser .
    WA_FCAT1-TABNAME = 'IT_ITAB1' .
    WA_FCAT1-FIELDNAME = 'MATNR' .
    WA_FCAT1-COLTEXT = 'Material' .
    WA_FCAT1-OUTPUTLEN = 18 .
    APPEND WA_FCAT1 TO FCAT1 .
    CLEAR WA_FCAT1 .
    WA_FCAT1-TABNAME = 'IT_ITAB1' .
    WA_FCAT1-FIELDNAME = 'MTART' .
    WA_FCAT1-COLTEXT = 'Material Type' .
    WA_FCAT1-OUTPUTLEN = 15 .
    APPEND WA_FCAT1 TO FCAT1 .
    CLEAR WA_FCAT1 .
    WA_FCAT1-TABNAME = 'IT_ITAB1' .
    WA_FCAT1-FIELDNAME = 'MATKL' .
    WA_FCAT1-COLTEXT = 'Material Group' .
    WA_FCAT1-OUTPUTLEN = 15 .
    APPEND WA_FCAT1 TO FCAT1 .
    CLEAR WA_FCAT1 .
    WA_FCAT1-TABNAME = 'IT_ITAB1' .
    WA_FCAT1-FIELDNAME = 'MAKTX' .
    WA_FCAT1-COLTEXT = 'Description' .
    WA_FCAT1-OUTPUTLEN = 25 .
    APPEND WA_FCAT1 TO FCAT1 .
    CLEAR WA_FCAT1 .
    SELECT AMATNR AMTART AMATKL BMAKTX INTO TABLE IT_ITAB1 FROM MARA AS A INNER JOIN MAKT AS B ON AMATNR = BMATNR .
    DESCRIBE TABLE IT_ITAB1 LINES LEN .
    LEN = LEN  .
    IT_ITAB1-COL = 'C601' .
    MODIFY IT_ITAB1 INDEX LEN FROM IT_ITAB1
           TRANSPORTING COL .
    CALL SCREEN 100 .
    *&      Module  SHOWALV  OUTPUT
          text
    module SHOWALV output.
    CREATE OBJECT cont1
       EXPORTING
        PARENT                      =
         container_name              = 'CUSTOM'
        STYLE                       =
        LIFETIME                    = lifetime_default
        REPID                       =
        DYNNR                       =
        NO_AUTODEF_PROGID_DYNNR     =
      EXCEPTIONS
        CNTL_ERROR                  = 1
        CNTL_SYSTEM_ERROR           = 2
        CREATE_ERROR                = 3
        LIFETIME_ERROR              = 4
        LIFETIME_DYNPRO_DYNPRO_LINK = 5
        others                      = 6
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CREATE OBJECT grid1
      EXPORTING
       I_SHELLSTYLE      = 0
       I_LIFETIME        =
        i_parent          =  CONT1
       I_APPL_EVENTS     = space
       I_PARENTDBG       =
       I_APPLOGPARENT    =
       I_GRAPHICSPARENT  =
       I_NAME            =
       I_FCAT_COMPLETE   = SPACE
    EXCEPTIONS
       ERROR_CNTL_CREATE = 1
       ERROR_CNTL_INIT   = 2
       ERROR_CNTL_LINK   = 3
       ERROR_DP_CREATE   = 4
       others            = 5
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CALL METHOD grid1->set_table_for_first_display
      EXPORTING
       I_BUFFER_ACTIVE               =
       I_BYPASSING_BUFFER            =
       I_CONSISTENCY_CHECK           =
       I_STRUCTURE_NAME              =
       IS_VARIANT                    =
       I_SAVE                        =
       I_DEFAULT                     = 'X'
        IS_LAYOUT                     = LAYOUT
       IS_PRINT                      =
       IT_SPECIAL_GROUPS             =
       IT_TOOLBAR_EXCLUDING          =
       IT_HYPERLINK                  =
       IT_ALV_GRAPHICS               =
       IT_EXCEPT_QINFO               =
       IR_SALV_ADAPTER               =
      CHANGING
        it_outtab                     = IT_ITAB1[]
        IT_FIELDCATALOG               = FCAT1
       IT_SORT                       =
       IT_FILTER                     =
    EXCEPTIONS
       INVALID_PARAMETER_COMBINATION = 1
       PROGRAM_ERROR                 = 2
       TOO_MANY_LINES                = 3
       others                        = 4
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    endmodule.                 " SHOWALV  OUTPUT
    Thanks and regards ..
    Priyank .

  • How to colour a row in alv report

    Hi
    As per our client's requirement we have to do color the column on the basis of values in the column like
    if data is more than 5000 it will show in red,if less than 5000 it will show in green in ALV  report.
    Pls give me the solution.
    Thanks&Regards.

    Hi Sahoo,
    If you are using the class CL_GUI_ALV_GRID. In methods SET_TABLE_FOR_FIRST_DISPLAY.
    in layout structure you will find field SEL_MODE
    pass :
    LS_LAYOUT-SEL_MODE = 'A'.
    In PAI.
      CALL METHOD GRID->GET_SELECTED_ROWS
        IMPORTING
          ET_INDEX_ROWS = T_ROWS
          ET_ROW_NO     = T_ROWID.
    Hope these will solve your problem.
    Regards,
    Kumar M.

  • Insert  Blank row  After every Row  in alv report

    How to insert blank  row After every row  in Alv report

    what do you mean by a 'blank row'? ALV displays tabular data with 'any' number of columns. Now if you actually want a blank row (no columns at all, just a row), then that is just not possible. If I'm not mistaken, this question was posted before, so try to do a search on SCN. See what is says.

  • ALV Display Requirement

    hi experts,
    well i am having a problem regarding ALV display...the requirement is :
    ALV DISPLAY SHOULD BE LIKE THIS
                                                                                    Open Balance      12345
       SY-DATUM            POSTING DATE          DOC. NUMBER         LOCAL CURRENCY AMOUNT
    now the sum of the amount is displayed in front of open balance field, which is displayed in a first row of ALV display. And below are the columns with heading are having a details of the GL-ACCOUNT.
    Is this possible using a same ALV grid display or i have to use 2 ALV grid display? In both cases plz let me know to get this sort of output?
    regards,
    Yahya Shoaib.

    In the heading part you can display the total..
    *& Report  ZTRN_ALV1
    REPORT  ZTRN_ALV1.
    TYPE-POOLS: SLIS.
    DATA: REPID LIKE SY-REPID,
          FCAT TYPE SLIS_T_FIELDCAT_ALV,
          GCAT TYPE SLIS_FIELDCAT_ALV,
          FCAT1 TYPE SLIS_T_FIELDCAT_ALV,
          GCAT1 TYPE SLIS_FIELDCAT_ALV,
          LAYOUT TYPE SLIS_LAYOUT_ALV,
          T_EVENTS TYPE SLIS_T_EVENT,
          EVENTS TYPE SLIS_ALV_EVENT,
          HEADING TYPE SLIS_T_LISTHEADER,
          HEADER TYPE SLIS_LISTHEADER.
    PARAMETERS: CCODE LIKE LFB1-BUKRS.
    DATA: BEGIN OF ITAB OCCURS 0,
          lifnr LIKE LFA1-LIFNR,
          BUKRS LIKE LFB1-BUKRS,
          NAME1 LIKE LFA1-NAME1,
      END OF ITAB.
      DATA: BEGIN OF JTAB OCCURS 0,
          EBELN LIKE EKKO-EBELN,
          lifnr LIKE LFA1-LIFNR,
          AEDAT LIKE EKKO-AEDAT,
      END OF JTAB.
    *DATA: JTAB LIKE STANDARD TABLE OF EKKO WITH HEADER LINE INITIAL SIZE 0.
    START-OF-SELECTION.
    REPID = SY-REPID.
    PERFORM FETCH.
    PERFORM FIELDCAT.
    PERFORM LAYOUT.
    PERFORM GET_EVENTS.
    PERFORM EVENTS.
    PERFORM OUTPUT.
    *&      Form  FETCH
          text
    -->  p1        text
    <--  p2        text
    FORM FETCH .
    SELECT ALIFNR ANAME1 BBUKRS INTO CORRESPONDING FIELDS OF TABLE ITAB FROM LFA1 AS A JOIN LFB1 AS B ON ALIFNR EQ B~LIFNR WHERE
      B~BUKRS EQ CCODE.
    ENDFORM.                    " FETCH
    *&      Form  FIELDCAT
          text
    -->  p1        text
    <--  p2        text
    FORM FIELDCAT .
    GCAT-COL_POS = '1'.
    GCAT-FIELDNAME = 'BUKRS'.
    GCAT-TABNAME = ITAB.
    GCAT-SELTEXT_M = 'COMPANY CODE'.
    APPEND GCAT TO FCAT.
    GCAT-COL_POS = '2'.
    GCAT-FIELDNAME = 'LIFNR'.
    GCAT-TABNAME = ITAB.
    GCAT-SELTEXT_M = 'VENDOR NUMBER'.
    APPEND GCAT TO FCAT.
    GCAT-COL_POS = '3'.
    GCAT-FIELDNAME = 'NAME1'.
    GCAT-TABNAME = ITAB.
    GCAT-SELTEXT_M = 'VENDOR NAME'.
    APPEND GCAT TO FCAT.
    ENDFORM.                    " FIELDCAT
    *&      Form  LAYOUT
          text
    -->  p1        text
    <--  p2        text
    FORM LAYOUT .
    LAYOUT-ZEBRA = 'X'.
    ENDFORM.                    " LAYOUT
    *&      Form  GET_EVENTS
          text
    -->  p1        text
    <--  p2        text
    FORM GET_EVENTS .
    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.
    ENDFORM.                    " GET_EVENTS
    *&      Form  EVENTS
          text
    -->  p1        text
    <--  p2        text
    FORM EVENTS .
    READ TABLE T_EVENTS INTO EVENTS WITH KEY NAME = 'TOP_OF_PAGE'.
    EVENTS-FORM = 'TOP_OF_PAGE'.
    MODIFY TABLE T_EVENTS FROM EVENTS TRANSPORTING FORM.
    READ TABLE T_EVENTS INTO EVENTS WITH KEY NAME = 'USER_COMMAND'.
    EVENTS-FORM = 'USER_COMMAND'.
    MODIFY TABLE T_EVENTS FROM EVENTS TRANSPORTING FORM.
    ENDFORM.                    " EVENTS
    *&      Form  OUTPUT
          text
    -->  p1        text
    <--  p2        text
    FORM OUTPUT .
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
       I_CALLBACK_PROGRAM                = REPID
      I_CALLBACK_PF_STATUS_SET          = ' '
       I_CALLBACK_TOP_OF_PAGE            = 'TOP_OF_PAGE'
      I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
      I_BACKGROUND_ID                   = ' '
      I_GRID_TITLE                      =
      I_GRID_SETTINGS                   =
       IS_LAYOUT                         = LAYOUT
       IT_FIELDCAT                       = FCAT[]
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         = 'X'
      I_SAVE                            = ' '
      IS_VARIANT                        =
       IT_EVENTS                         = T_EVENTS
      IT_EVENT_EXIT                     =
      IS_PRINT                          =
      IS_REPREP_ID                      =
      I_SCREEN_START_COLUMN             = 0
      I_SCREEN_START_LINE               = 0
      I_SCREEN_END_COLUMN               = 0
      I_SCREEN_END_LINE                 = 0
      I_HTML_HEIGHT_TOP                 = 0
      I_HTML_HEIGHT_END                 = 0
      IT_ALV_GRAPHICS                   =
      IT_HYPERLINK                      =
      IT_ADD_FIELDCAT                   =
      IT_EXCEPT_QINFO                   =
      IR_SALV_FULLSCREEN_ADAPTER        =
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
      TABLES
        T_OUTTAB                          = ITAB
    EXCEPTIONS
      PROGRAM_ERROR                     = 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.
    ENDFORM.                    " OUTPUT
    *&      Form  TOP_OF_PAGE
          text
    -->  p1        text
    <--  p2        text
    FORM TOP_OF_PAGE .
    CLEAR HEADING[].    <----IN THIS INTERNAL TABLE YOU EASILY DISPLAY TOTAL...
    HEADER-TYP = 'H'.
    HEADER-INFO = 'WIPRO TECHNOLOGIES'.
    APPEND HEADER TO HEADING.
    HEADER-TYP = 'S'.
    HEADER-INFO = 'ADVANCED ABAP TRAINING'.
    APPEND HEADER TO HEADING.
    HEADER-TYP = 'A'.
    HEADER-INFO = 'LIST OF VENDORS'.
    APPEND HEADER TO HEADING.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
      EXPORTING
        IT_LIST_COMMENTARY       = HEADING[]
      I_LOGO                   =
      I_END_OF_LIST_GRID       =
      I_ALV_FORM               =
    ENDFORM.

  • How to change a color for a row in ALV grid display

    Hi,
       how to change a color for a row in ALV grid display based on a condition.Any sample code plz

    Hello Ramya,
    Did you check in [SCN|How to color a row of  alv grid]
    Thanks!

  • Blank Row in ALV Grid Display

    In ALV Display I want to have a <u>BLANK row</u> everytime the value of 'Cross Company Code Document Number' (BVORG) changes.
    Is there a way to use the Sort Option of "REUSE_ALV_GRID_DISPLAY" to do this? Or is the only possible way is by modifying the ITAB that is being passed for display?
    If ITAB is the only method to do it then how should I go about making this happen?
    Thanks-
    Rohit.

    if you do again sort then blank rows will come top,so make sure that should not do sort after inserting blank rows.
    please sort it before inserting blank row .
    sort itab by fields..
    loop at itab.
    endloop.
    do not sort here.
    Thanks
    Seshu

  • ALV  display for  row  s   and columns in this format.have ur full points..

    Hi ALL
      I have to dispalay data in the ALV format as :
    Basic
    DA
    HRA
    PF
    VPF
    20000
    500
    5000
    | 1500     | 600  |          |
    Details :  Basic   HRA in one Row and   PF , VPF in  second Row.
    The Amount  regarding htese fields are also displayed in the next rows for all  emp. numbers.
    its urgent for me and need helpful answers...
    Regards
    Lakhan

    see the attached code it will display the hierarchial display as per your need
    change the internal tables with dat of your own orgn structure and pass it to the fun module.
    Description : Pick Status Report
    This is an ALV report using the heirarchical ALV list display. The
    report selects all deliveries that fulfil the selection criteria
    and displays a summary of all items in that delivery with reference
    to certain statuses: overall status, goods issue status, transfer
    order status, load to pallet status, pallet count status, loaded to
    van status, van manifest printed status and end of day manifest
    printed status. These statuses have been defined by the business.
    There is extra functionality required to trigger printing of the van
    and end of day manifests from this report, and to set the loading
    end status of a shipment if the last handling unit of a particular
    shipment has been loaded onto a van for which the van manifest has
    been triggered.
    REPORT zwmr_pick_status_report NO STANDARD PAGE HEADING
    MESSAGE-ID zw.
    Type Pools
    TYPE-POOLS: icon, slis.
    Tables
    TABLES: tvst,
    likp,
    t30b,
    vekp,
    *{ INSERT UKMK900355 4
    zhu_to_link, "AS03
    *} INSERT
    zpallettr,
    vttk, "MB01
    zvantr.
    Types
    TYPES:
    BEGIN OF ty_data,
    lgtor LIKE likp-lgtor, " door
    vbeln LIKE likp-vbeln, " delivery
    wbstk LIKE vbuk-wbstk, " Goods movement status
    kostk LIKE vbuk-kostk, " Picking status
    posnr LIKE lips-posnr, " item
    route LIKE likp-route, " route
    wadat LIKE likp-wadat, " goods issue date
    lvsta LIKE vbup-lvsta, " warehouse status
    packvorschr LIKE vekp-packvorschr, " pack mnemonic
    exidv LIKE vekp-exidv, " handling unit
    zpallet_no(10), "like zpallettr-zpallet_no, " pallet no
    zdep_point LIKE zpallettr-zdep_point, "Departur Point "Jvdm01
    zcount_check LIKE zpallettr-zcount_check," count check flag
    zvan_no(10), "like zvantr-zvan_no, " van no
    zvan_print LIKE zvantr-zvan_print, " van manifest print
    tknum LIKE vttk-tknum, " Shipment No "ANV 11523
    zeod_print LIKE zvantr-zeod_print, " eod manifest print
    zzpackclass LIKE vekp-zzpackclass, " package class
    zzti LIKE vekp-zzti, " T.I. value
    vstel LIKE likp-vstel, "Shipping point RM050906
    anzpk TYPE znopack, "No of packages in dlv MB01+
    END OF ty_data.
    TYPES:BEGIN OF x_likp ,
    vbeln LIKE likp-vbeln,
    vstel LIKE likp-vstel, "RM050906
    lgtor LIKE likp-lgtor,
    zzroute2lgtor LIKE likp-zzroute2lgtor, "MB01
    route LIKE likp-route,
    wadat LIKE likp-wadat,
    zz2route LIKE likp-zz2route, "MB01+
    zzexproute LIKE likp-zzexproute, "MB01+
    zzroute2 LIKE likp-zzroute2, "MB01+
    anzpk LIKE likp-anzpk,
    END OF x_likp.
    TYPES: BEGIN OF x_vbuk,
    vbeln TYPE vbuk-vbeln,
    wbstk TYPE vbuk-wbstk, " Goods movement status
    kostk TYPE vbuk-kostk, " Picking status
    END OF x_vbuk.
    TYPES: BEGIN OF x_lips,
    vbeln TYPE lips-vbeln, " delivery
    posnr TYPE lips-posnr, " item
    pstyv TYPE lips-pstyv,
    matnr TYPE lips-matnr,
    charg TYPE lips-charg,
    END OF x_lips.
    TYPES: BEGIN OF x_vbup,
    vbeln TYPE vbup-vbeln, " delivery
    posnr TYPE vbup-posnr, " item
    lvsta TYPE vbup-lvsta, " warehouse status
    END OF x_vbup.
    TYPES: BEGIN OF x_vepo,
    venum TYPE vepo-venum, "Internal Handling Unit
    Number
    vepos TYPE vepo-vepos, "Handling Unit Item
    vbeln TYPE vepo-vbeln, " delivery
    posnr TYPE vepo-posnr, " item
    exidv TYPE vekp-exidv,
    END OF x_vepo.
    TYPES: BEGIN OF x_vepo1,
    venum TYPE vekp-venum, "Internal Handling Unit
    Number
    exidv TYPE vekp-exidv,
    END OF x_vepo1.
    Start of changes by ANV SR#11523
    TYPES: BEGIN OF x_vttp,
    tknum TYPE tknum, " Shipment No
    tpnum TYPE tpnum, " Item No
    vbeln TYPE vbup-vbeln, " delivery
    laufk LIKE vttk-laufk, " leg indicator MB01+
    END OF x_vttp.
    End of changes by ANV SR#11523
    Data
    RANGES: r_del FOR likp-vbeln,
    r_lgtor FOR likp-lgtor.
    RANGES: r_vanno FOR zvantr-zvan_no,
    r_palno FOR zpallettr-zpallet_no.
    DATA: BEGIN OF number_range OCCURS 0,
    mark(1),
    id(3),
    num(10) TYPE n,
    desc LIKE zpalletmd-zdesc,
    END OF number_range.
    DATA: t_disp_tab TYPE STANDARD TABLE OF zpickdisp,
    t_data_tab TYPE ty_data OCCURS 0 WITH HEADER LINE,
    it_likp TYPE x_likp OCCURS 0 WITH HEADER LINE, "SUM
    it_vbuk TYPE x_vbuk OCCURS 0 WITH HEADER LINE, "SUM
    it_lips TYPE x_lips OCCURS 0 WITH HEADER LINE, "SUM
    it_vbup TYPE x_vbup OCCURS 0 WITH HEADER LINE, "SUM
    it_vepo TYPE x_vepo OCCURS 0 WITH HEADER LINE, "SUM
    it_vepo2 TYPE x_vepo OCCURS 0 WITH HEADER LINE, "SUM
    *{ INSERT UKMK900355 3
    t_vepo_low TYPE x_vepo OCCURS 0 WITH HEADER LINE, " AS01
    *} INSERT
    it_vepo1 TYPE x_vepo1 OCCURS 0 WITH HEADER LINE, "SUM
    it_vttp TYPE x_vttp OCCURS 0 WITH HEADER LINE, "ANV SR#11523
    t_disp_head TYPE STANDARD TABLE OF zpickhead.
    DATA wa_item_tab TYPE zpickdisp OCCURS 0 WITH HEADER LINE.
    "ANV SR#11113
    DATA: w_numrnge LIKE number_range,
    w_number(10) TYPE n.
    DATA: t_likp LIKE likp OCCURS 0 WITH HEADER LINE,
    t_lips LIKE lips OCCURS 0 WITH HEADER LINE,
    t_vbuk LIKE vbuk OCCURS 0 WITH HEADER LINE,
    t_vbup LIKE vbup OCCURS 0 WITH HEADER LINE,
    t_vepo LIKE vepo OCCURS 0 WITH HEADER LINE,
    t_vekp LIKE vekp OCCURS 0 WITH HEADER LINE,
    t_vantr LIKE zvantr OCCURS 0 WITH HEADER LINE,
    t_pallettr LIKE zpallettr OCCURS 0 WITH HEADER LINE,
    w_likp like likp,
    w_lips LIKE lips,
    w_vbuk LIKE vbuk,
    w_vbup LIKE vbup,
    w_vepo LIKE vepo,
    w_vekp LIKE vekp,
    w_vepo TYPE x_vepo1,
    w_vbup TYPE x_vbup,
    w_vttp TYPE x_vttp, " ANV SR#11523
    w_lips TYPE x_lips,
    w_vbuk TYPE x_vbuk,
    w_likp TYPE x_likp, "MB01-+
    w_tplst LIKE vttk-tplst. "MB01+
    DATA: s_variant LIKE disvariant, "MB01+
    def_variant LIKE disvariant.
    ALV DATA *****
    DATA:
    g_grid TYPE REF TO cl_gui_alv_grid,
    g_sort TYPE slis_t_sortinfo_alv,
    g_custom_container TYPE REF TO cl_gui_custom_container,
    g_layout TYPE slis_layout_alv,
    gt_fieldcat TYPE slis_t_fieldcat_alv,
    t_fldcat LIKE LINE OF gt_fieldcat,
    g_keyinfo TYPE slis_keyinfo_alv,
    gt_events TYPE slis_t_event,
    gs_event TYPE slis_alv_event,
    w_sy_repid LIKE sy-repid.
    DATA: BEGIN OF seltab OCCURS 0.
    INCLUDE STRUCTURE rsparams.
    DATA: END OF seltab.
    SYSTEM GENERATED TABLE CONTROL DATA ********
    DECLARATION OF TABLECONTROL 'TC_TABCON' ITSELF
    CONTROLS: tc_tabcon TYPE TABLEVIEW USING SCREEN 0100.
    LINES OF TABLECONTROL 'TC_TABCON'
    DATA: g_tc_tabcon_lines LIKE sy-loopc.
    DATA: ok_code LIKE sy-ucomm.
    Constants
    CONSTANTS: c_data_class LIKE klah-class VALUE 'DG_DATA',
    c_mat_class LIKE rmclf-klart VALUE '001',
    c_pack LIKE lips-mtart VALUE 'VERP',
    c_a(1) VALUE 'A',
    c_b(1) VALUE 'B',
    c_c(1) VALUE 'C',
    c_yes(1) VALUE 'X',
    c_no(1) VALUE ' '.
    Selection screen
    standard report select options block
    SELECTION-SCREEN BEGIN OF BLOCK a WITH FRAME TITLE text-002.
    SELECT-OPTIONS:
    s_wadat FOR likp-wadat NO-EXTENSION OBLIGATORY. " Goods Issue Date
    *parameters: "TR01-
    p_vstel like tvst-vstel obligatory. " Shipping Point "TR01-
    SELECT-OPTIONS: "TR01+
    p_vstel FOR tvst-vstel. " Shipping Point "TR01+
    SELECT-OPTIONS:
    s_lfart FOR likp-lfart, " Delivery type
    s_lgtor FOR t30b-lgtor, " Door selection
    s_exidv FOR vekp-exidv, " Handling Unit
    s_vbeln FOR likp-vbeln, " Delivery "MB01-+
    s_lfdat FOR likp-lfdat. " Delivery date
    PARAMETERS:
    p_exdata AS CHECKBOX. " Show extra columns flag
    SELECTION-SCREEN END OF BLOCK a.
    van/pallet specific select options block
    SELECTION-SCREEN BEGIN OF BLOCK b WITH FRAME TITLE text-001.
    SELECT-OPTIONS:
    s_palno FOR zpallettr-zpallet_no, " no-extension,
    s_vanno FOR zvantr-zvan_no. " no-extension.
    SELECT-OPTIONS:
    s_deppnt FOR zpallettr-zdep_point, "Jvdm01
    s_tplst FOR vttk-tplst. "MB01
    SELECTION-SCREEN END OF BLOCK b.
    MB01 - START - Display variant
    SELECTION-SCREEN BEGIN OF BLOCK c WITH FRAME TITLE text-019.
    PARAMETERS: p_vari LIKE disvariant-variant.
    SELECTION-SCREEN END OF BLOCK c.
    MB01 - END
    Value Request Events
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_palno-low.
    CLEAR: number_range, w_number .
    REFRESH number_range.
    select numbers and display pop up screen for selection
    PERFORM select_pal_nos.
    s_palno-low = w_number.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_palno-high.
    CLEAR: number_range, w_number .
    REFRESH number_range.
    select numbers and display pop up screen for selection
    PERFORM select_pal_nos.
    s_palno-high = w_number.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_vanno-low.
    CLEAR: number_range, w_number .
    REFRESH number_range.
    select numbers and display pop up screen for selection
    PERFORM select_van_nos.
    s_vanno-low = w_number.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_vanno-high.
    CLEAR: number_range, w_number .
    REFRESH number_range.
    select numbers and display pop up screen for selection
    PERFORM select_van_nos.
    s_vanno-high = w_number.
    MB01 - START - display variant
    F4-Help for variant
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.
    PERFORM f4_for_variant.
    MB01 - END
    At Selection Screen
    AT SELECTION-SCREEN.
    PERFORM validate_selections.
    Initialization
    INITIALIZATION.
    MB01 - START INSERT
    1. Transportation planning point
    Import transportation planning point from user parameters and
    populate
    select option.
    GET PARAMETER ID 'TDP' FIELD w_tplst.
    MOVE: 'I' TO s_tplst-sign,
    'EQ' TO s_tplst-option,
    w_tplst TO s_tplst-low.
    APPEND s_tplst.
    2. Display variant
    CLEAR s_variant.
    s_variant-report = sy-repid.
    Get default variant
    s_def_variante = s_variant.
    CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
    EXPORTING
    i_save = 'A'
    CHANGING
    cs_variant = s_variant
    EXCEPTIONS
    not_found = 2.
    IF sy-subrc = 0.
    p_vari = s_variant-variant.
    ENDIF.
    MB01 - END INSERT
    Start of selection
    START-OF-SELECTION.
    clear all data tables
    CLEAR: t_likp,
    it_likp,
    t_lips,
    t_vbuk,
    t_vbup,
    t_vepo,
    t_vantr,
    t_pallettr,
    w_likp,
    w_lips,
    w_vbuk,
    w_vbup,
    w_vepo,
    w_vekp.
    REFRESH: t_likp,
    it_likp,
    t_lips,
    t_vbuk,
    t_vbup,
    t_vepo,
    t_vantr,
    t_pallettr.
    select data for ALV
    due to different input parameters being used, to streamline the data
    selection process, different selection methods are required
    IF NOT s_vanno IS INITIAL
    OR NOT s_palno IS INITIAL
    OR NOT s_deppnt IS INITIAL. "Jvdm01
    if selecting by van/pallet number, need to select the data from the
    handling unit upwards to delivery
    PERFORM select_data_up.
    ELSE.
    otherwise the data can be selected from the delivery downwards
    PERFORM select_data_down.
    ENDIF.
    End of selection
    END-OF-SELECTION.
    call hierarchical ALV display function module
    CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
    EXPORTING
    i_callback_program = 'ZWMR_PICK_STATUS_REPORT'
    i_callback_pf_status_set = 'SET_STATUS'
    i_callback_user_command =
    'USER_COMMAND' "custom gui status form
    is_layout = g_layout "user command form
    it_fieldcat = gt_fieldcat
    it_sort = g_sort
    i_save = 'X' "MB01+
    is_variant = s_variant
    it_events = gt_events
    i_tabname_header = 't_disp_head'
    i_tabname_item = 't_disp_tab'
    i_structure_name_header = 'ZPICKHEAD'
    i_structure_name_item = 'ZPICKDISP'
    is_keyinfo = g_keyinfo
    TABLES
    t_outtab_header = t_disp_head
    t_outtab_item = t_disp_tab.
    IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    FORMS
    Includes inserted by Screen Painter Wizard. DO NOT CHANGE THIS LINE!
    INCLUDE zwmr_pick_o01.
    INCLUDE zwmr_pick_status_reporto01 .
    INCLUDE zwmr_pick_i01.
    INCLUDE zwmr_pick_status_reporti01 .
    INCLUDE zwmr_pick_f01.
    INCLUDE zwmr_pick_status_reportf01 .
    *& Form select_pal_nos
    select pallet numbers for search help
    FORM select_pal_nos.
    DATA: BEGIN OF t_palno OCCURS 0,
    zpallet_no LIKE zpallettr-zpallet_no,
    END OF t_palno.
    select all available pallet numbers
    SELECT DISTINCT zpallet_no FROM zpallettr
    INTO CORRESPONDING FIELDS OF TABLE t_palno.
    LOOP AT t_palno.
    get pallet id
    SELECT SINGLE zpallet_id FROM zpallettr
    INTO number_range-id
    WHERE zpallet_no = t_palno-zpallet_no.
    get pallet description
    SELECT SINGLE zdesc FROM zpalletmd
    INTO number_range-desc
    WHERE zpallet_id = number_range-id.
    number_range-num = t_palno-zpallet_no.
    append to search help table
    APPEND number_range.
    ENDLOOP.
    call pop up dialog box
    CALL SCREEN 0100 STARTING AT 5 5.
    ENDFORM. " select_pal_nos
    *& Form select_van_nos
    select van numbers for search help
    FORM select_van_nos.
    DATA: BEGIN OF t_vanno OCCURS 0,
    zvan_no LIKE zvantr-zvan_no,
    END OF t_vanno.
    select available van numbers
    SELECT DISTINCT zvan_no FROM zvantr
    INTO CORRESPONDING FIELDS OF TABLE t_vanno.
    LOOP AT t_vanno.
    select van id
    SELECT SINGLE zvan_id FROM zvantr
    INTO number_range-id
    WHERE zvan_no = t_vanno-zvan_no.
    select van description (maintained in pallet tables)
    SELECT SINGLE zdesc FROM zpalletmd
    INTO number_range-desc
    WHERE zpallet_id = number_range-id.
    number_range-num = t_vanno-zvan_no.
    append to search help table
    APPEND number_range.
    ENDLOOP.
    call pop up dialog box
    CALL SCREEN 0100 STARTING AT 5 5.
    ENDFORM. " select_van_nos
    *& Form select_data_down
    select data if selecting from delivery down
    FORM select_data_down.
    select all deliveries from LIKP that fulfill selection criteria
    Start SU01 optmization changes
    SELECT vbeln vstel lgtor route wadat "RM050906
    SELECT vbeln vstel lgtor route wadat
    zzroute2lgtor zz2route zzexproute zzroute2 anzpk "MB01-+
    FROM likp INTO CORRESPONDING FIELDS OF TABLE it_likp"MB01-+
    WHERE vbeln IN s_vbeln
    AND vstel IN p_vstel
    AND lfart IN s_lfart
    AND wadat IN s_wadat
    AND lfdat IN s_lfdat "MB01+
    AND
    ( lgtor IN s_lgtor OR zzroute2lgtor IN s_lgtor ) ."MB01+
    IF sy-subrc NE 0.
    no data found
    MESSAGE i007.
    EXIT.
    ENDIF.
    IF NOT t_likp[] IS INITIAL. "SUM
    IF NOT it_likp[] IS INITIAL.
    SORT it_likp BY vbeln. "SUM
    select sales document headers from VBUK
    SELECT vbeln wbstk kostk
    FROM vbuk INTO TABLE it_vbuk
    FOR ALL ENTRIES IN it_likp "SUM
    WHERE vbeln EQ it_likp-vbeln. "SUM
    SORT it_vbuk BY vbeln.
    select all relevant delivery items from LIPS
    SELECT vbeln posnr pstyv matnr charg
    FROM lips INTO TABLE it_lips
    FOR ALL ENTRIES IN it_likp
    WHERE vbeln EQ it_likp-vbeln
    AND pckpf NE 'B' "cannot be packed "AS05
    AND pstyv NE 'ZPAC' "AS05
    AND pstyv NE 'ZGDP' "TR02+ "AS05
    AND lfimg GT 0. "TR01+
    ENDIF.
    IF NOT it_lips[] IS INITIAL.
    select all sales document line items from VBUP
    SORT it_lips BY vbeln posnr. "SUM
    SELECT vbeln posnr lvsta
    FROM vbup INTO TABLE it_vbup
    FOR ALL ENTRIES IN it_lips
    WHERE vbeln EQ it_lips-vbeln
    AND posnr = it_lips-posnr.
    SORT it_vbup BY vbeln posnr.
    select corresponding handling unit ID's (venum)
    TR03 Replace
    start
    select * from vepo appending corresponding fields of table t_vepo
    for all entries in t_lips
    where vbeln = t_lips-vbeln
    and posnr = t_lips-posnr
    and matnr = t_lips-matnr
    and charg = t_lips-charg.
    SELECT vepoVENUM vepoVEPOS vepovbeln vepoposnr
    FROM vepo as vepo
    INNER JOIN vekp as vekp ON vepovenum = vekpvenum
    APPENDING corresponding fields of table it_vepo
    FOR ALL ENTRIES IN it_lips
    WHERE vepo~vbeln = it_lips-vbeln
    AND vepo~posnr = it_lips-posnr
    AND vepo~matnr = it_lips-matnr
    AND vepo~charg = it_lips-charg
    AND vekp~exidv IN s_exidv.
    SELECT venum vepos vbeln posnr
    FROM vepo INTO TABLE it_vepo2
    FOR ALL ENTRIES IN it_lips
    WHERE vbeln = it_lips-vbeln
    AND posnr = it_lips-posnr
    AND matnr = it_lips-matnr
    AND charg = it_lips-charg.
    SORT it_vepo2 BY venum vepos.
    *{ INSERT UKMK900355 1
    Ice-multis: replace lower-level HUs with highest level " AS01
    PERFORM replace_highest_hu. " AS01
    *} INSERT
    Start of changes by ANV SR#11523
    MB01 - extract shipment header as well to populate leg indicator
    Therefore, join vttp with vttk
    Limit as well by transportation planning point
    SELECT vttptknum vttptpnum vttpvbeln vttklaufk
    FROM vttp INNER JOIN vttk
    ON vttptknum = vttktknum
    INTO TABLE it_vttp
    FOR ALL ENTRIES IN it_lips
    WHERE vttp~vbeln = it_lips-vbeln
    AND vttk~tplst IN s_tplst.
    MB01 - END
    End of changes by ANV SR#11523
    IF NOT it_vepo2[] IS INITIAL.
    SELECT venum exidv
    FROM vekp INTO TABLE it_vepo1
    FOR ALL ENTRIES IN it_vepo2
    WHERE venum = it_vepo2-venum
    AND exidv IN s_exidv.
    ENDIF.
    SORT it_vepo1 BY venum.
    CLEAR: w_vepo, it_vepo.
    LOOP AT it_vepo1.
    READ TABLE it_vepo2 WITH KEY venum = it_vepo1-venum.
    IF sy-subrc = 0.
    it_vepo2-exidv = it_vepo1-exidv.
    MODIFY it_vepo2 TRANSPORTING exidv
    WHERE venum = it_vepo1-venum .
    ENDIF.
    ENDLOOP.
    DELETE it_vepo2 WHERE exidv IS initial.
    it_vepo[] = it_vepo2[].
    TR03 Replace end
    ENDIF.
    build process table
    PERFORM move_to_table.
    ENDFORM. "select_data_down
    *& Form select_data_up
    select data if selecting from van/pallet up
    FORM select_data_up.
    IF NOT s_vanno IS INITIAL.
    if van then select van numbers and hence pallet numbers
    SELECT * FROM zvantr INTO TABLE t_vantr
    WHERE zvan_no IN s_vanno.
    and vstel eq p_vstel."TR01-
    IF NOT t_vantr[] IS INITIAL.
    SORT t_vantr BY zvan_id zvan_no vstel zpallet_no. "SUM
    SELECT * FROM zpallettr INTO TABLE t_pallettr
    FOR ALL ENTRIES IN t_vantr
    WHERE zpallet_no EQ t_vantr-zpallet_no
    AND zdep_point IN s_deppnt. "Jvdm01
    and vstel eq p_vstel."TR01-
    ENDIF.
    ELSE.
    otherwise can get pallet numbers directly
    SELECT * FROM zpallettr INTO TABLE t_pallettr
    WHERE zpallet_no IN s_palno
    AND zdep_point IN s_deppnt. "Jvdm01
    and vstel eq p_vstel."TR01-
    ENDIF.
    IF NOT t_pallettr[] IS INITIAL.
    from the pallet nos. we can select the handling units
    SORT t_pallettr BY zpallet_id zpallet_no vstel exidv. "SUM
    SELECT * FROM vekp INTO TABLE t_vekp
    FOR ALL ENTRIES IN t_pallettr
    WHERE exidv EQ t_pallettr-exidv
    AND exidv NE space
    AND exidv IN s_exidv "TR03+
    AND ( exida = 'E' "TR01+
    OR exida = 'F' ). "TR01+
    ENDIF.
    SORT t_vekp BY venum. "SUM
    IF NOT t_vekp[] IS INITIAL.
    build vbeln range from t_vekp.
    LOOP AT t_vekp.
    r_del-sign = 'I'.
    r_del-option = 'EQ'.
    r_del-low = t_vekp-vpobjkey.
    APPEND r_del.
    ENDLOOP.
    select all deliveries from LIKP that correspond to HU's
    SELECT * FROM likp INTO TABLE t_likp
    WHERE vbeln IN r_del
    AND wadat IN s_wadat
    AND lfart IN s_lfart.
    ENDIF.
    MB01- START
    SELECT vbeln lgtor route wadat
    FROM likp INTO TABLE it_likp
    WHERE vbeln IN r_del
    AND wadat IN s_wadat
    AND lfart IN s_lfart.
    SELECT vbeln vstel lgtor route wadat
    zzroute2lgtor zz2route zzexproute zzroute2 anzpk "MB01-+
    FROM likp INTO CORRESPONDING FIELDS OF TABLE it_likp
    WHERE vbeln IN r_del
    AND lfart IN s_lfart
    AND wadat IN s_wadat "MB01-+
    AND lfdat IN s_lfdat. "MB01+
    MB01- END
    ENDIF.
    IF NOT it_likp[] IS INITIAL.
    SORT it_likp BY vbeln . "SUM
    select sales document headers from VBUK
    SELECT * FROM vbuk INTO TABLE t_vbuk
    FOR ALL ENTRIES IN t_likp
    WHERE vbeln EQ t_likp-vbeln.
    SELECT vbeln wbstk kostk
    FROM vbuk INTO TABLE it_vbuk
    FOR ALL ENTRIES IN it_likp
    WHERE vbeln EQ it_likp-vbeln.
    SORT it_vbuk BY vbeln. "SUM
    select all relevant delivery items from LIPS
    SELECT * FROM lips INTO TABLE t_lips
    FOR ALL ENTRIES IN t_likp
    WHERE vbeln EQ t_likp-vbeln
    AND pstyv NE 'ZPAC'
    AND pstyv NE 'ZGDP' "TR02+
    AND lfimg GT 0. "TR01+
    SELECT vbeln posnr pstyv matnr charg
    FROM lips INTO TABLE it_lips
    FOR ALL ENTRIES IN it_likp
    WHERE vbeln EQ it_likp-vbeln
    AND pckpf NE 'B' "cannot be packed "AS05
    AND pstyv NE 'ZPAC' "AS05
    AND pstyv NE 'ZGDP' "TR02+ "AS05
    AND lfimg GT 0. "TR01+
    ENDIF.
    IF NOT it_lips[] IS INITIAL.
    SORT it_lips BY vbeln posnr. "SUM
    select all sales document line items from VBUP
    SELECT * FROM vbup INTO TABLE t_vbup
    FOR ALL ENTRIES IN t_lips
    WHERE vbeln EQ t_lips-vbeln
    AND posnr = t_lips-posnr.
    Start of changes by ANV SR#11523
    MB01 - START
    join vttp with vttk to obtain leg indicator
    SELECT tknum tpnum vbeln
    FROM vttp INTO TABLE it_vttp
    FOR ALL ENTRIES IN it_lips
    WHERE vbeln = it_lips-vbeln.
    SELECT vttptknum vttptpnum vttpvbeln vttklaufk
    FROM vttp INNER JOIN vttk
    ON vttptknum = vttktknum
    INTO TABLE it_vttp
    FOR ALL ENTRIES IN it_lips
    WHERE vttp~vbeln = it_lips-vbeln
    AND vttk~tplst IN s_tplst.
    MB01 - END
    End of changes by ANV SR#11523
    SELECT vbeln posnr lvsta
    FROM vbup INTO TABLE it_vbup
    FOR ALL ENTRIES IN it_lips
    WHERE vbeln EQ it_lips-vbeln
    AND posnr = it_lips-posnr.
    SORT t_vbup BY vbeln posnr. "SUM
    select corresponding handling unit ID's (venum)
    SELECT * FROM vepo APPENDING CORRESPONDING FIELDS OF TABLE t_vepo
    FOR ALL ENTRIES IN t_lips
    WHERE vbeln = t_lips-vbeln
    AND posnr = t_lips-posnr
    AND matnr = t_lips-matnr
    AND charg = t_lips-charg.
    SELECT venum vepos vbeln posnr
    FROM vepo APPENDING CORRESPONDING FIELDS OF TABLE it_vepo
    FOR ALL ENTRIES IN it_lips
    WHERE vbeln = it_lips-vbeln
    AND posnr = it_lips-posnr
    AND matnr = it_lips-matnr
    AND charg = it_lips-charg.
    *{ INSERT UKMK900355 1
    it_vepo2[] = it_vepo[]. " DS01
    PERFORM replace_highest_hu. " DS01
    it_vepo[] = it_vepo2[]. " DS01
    *} INSERT
    ENDIF.
    build process table
    PERFORM move_to_table.
    ENDFORM. "select_data_up
    *& Form move_to_table
    move data to processing table
    FORM move_to_table.
    LOOP AT it_vepo.
    CLEAR t_data_tab.
    delivery lines.
    CLEAR w_lips.
    READ TABLE it_lips WITH KEY vbeln = it_vepo-vbeln
    posnr = it_vepo-posnr
    INTO w_lips BINARY SEARCH. "SUM
    MOVE-CORRESPONDING w_lips TO t_data_tab.
    sales document line items
    CLEAR w_vbup.
    READ TABLE it_vbup WITH KEY vbeln = it_vepo-vbeln
    posnr = it_vepo-posnr
    INTO w_vbup BINARY SEARCH. "SUM
    if w_vbup-kosta = space. "TR01-
    not relevant for picking
    delete t_vepo. "TR01-
    continue. "TR01-
    else. "TR01-
    MOVE-CORRESPONDING w_vbup TO t_data_tab.
    endif. "TR01-
    sales doc header
    CLEAR w_vbuk.
    READ TABLE it_vbuk WITH KEY vbeln = it_vepo-vbeln
    INTO w_vbuk BINARY SEARCH. "SUM
    MOVE-CORRESPONDING w_vbuk TO t_data_tab.
    delivery header
    CLEAR w_likp.
    READ TABLE it_likp WITH KEY vbeln = it_vepo-vbeln
    INTO w_likp BINARY SEARCH. "SUM
    MOVE-CORRESPONDING w_likp TO t_data_tab.
    MB01 - START
    DATA: w_routetype TYPE i. "0=non-global,1=1st route,2=2nd
    route,3=both
    At this point move DOOR2 if it falls within the global route scenario
    and the door2 is satisfies the selection criteria for door
    1. Does delivery fall within global route scenario
    CLEAR w_routetype.
    IF w_likp-zz2route = 'Y' .
    1.a. First route - does door1 satisfy the selection criteria
    IF w_likp-lgtor IN s_lgtor.
    w_routetype = 1.
    MOVE w_likp-zzexproute TO t_data_tab-route.
    1.b. Second route - does door2 satisfy the selection criteria
    ELSEIF w_likp-zzroute2lgtor IN s_lgtor.
    here we need to move door2 to lgtor
    w_routetype = 2.
    MOVE w_likp-zzroute2lgtor TO t_data_tab-lgtor.
    MOVE w_likp-zzroute2 TO t_data_tab-route.
    ENDIF.
    If both routes satsify the criteria, append for 2nd leg ***REVISIT!
    IF w_likp-lgtor IN s_lgtor AND w_likp-zzroute2lgtor IN s_lgtor.
    w_routetype = 3.
    ENDIF.
    ENDIF.
    MB01 - END
    Start of changes by ANV SR#11523
    MB01 - If the delivery falls within the global route scenario... need
    to select either preliminary shipment leg OR subsequent leg
    when laufk= 1 (prelim) and linked to route1, if laufk = 2 (subseq) &
    linked to route2
    Shipment Number
    SORT it_vttp BY vbeln laufk.
    CLEAR w_vttp.
    CASE w_routetype.
    WHEN 0.
    READ TABLE it_vttp WITH KEY vbeln = it_vepo-vbeln
    INTO w_vttp BINARY SEARCH.
    WHEN 1.
    READ TABLE it_vttp WITH KEY vbeln = it_vepo-vbeln
    laufk = '1'
    INTO w_vttp BINARY SEARCH.
    WHEN 2.
    READ TABLE it_vttp WITH KEY vbeln = it_vepo-vbeln
    laufk = '3'
    INTO w_vttp BINARY SEARCH.
    WHEN 3. "REVISIT
    ENDCASE.
    MOVE w_vttp-tknum TO t_data_tab-tknum.
    MB01 - END
    End of changes by ANV SR#11523
    select handling unit info using vepo entry
    CLEAR w_vekp.
    IF t_vekp[] IS INITIAL.
    SELECT SINGLE * FROM vekp INTO w_vekp
    WHERE venum = it_vepo-venum.
    ELSE.
    READ TABLE t_vekp WITH KEY venum = it_vepo-venum
    INTO w_vekp BINARY SEARCH. "SUM
    IF sy-subrc NE 0.
    SELECT SINGLE * FROM vekp INTO w_vekp
    WHERE venum = t_vepo-venum.
    ENDIF.
    ENDIF.
    MOVE-CORRESPONDING w_vekp TO t_data_tab.
    *{ INSERT UKMK900355 2
    WM status for HU "AS03
    SELECT SINGLE * FROM zhu_to_link WHERE lgnum EQ w_vekp-lgnum"AS03
    AND exidv EQ w_vekp-exidv."AS03
    IF sy-subrc EQ 0. "AS03
    IF zhu_to_link-zpick_comp EQ space. "AS03
    t_data_tab-lvsta = 'B'. "AS03
    ELSE. "AS03
    t_data_tab-lvsta = 'C'. "AS03
    ENDIF. "AS03
    ENDIF. "AS03
    *} INSERT
    select pallet / van load information "Jvdm01-
    SELECT SINGLE zpallet_no zcount_check FROM zpallettr "Jvdm01-
    INTO (t_data_tab-zpallet_no, "Jvdm01-
    t_data_tab-zcount_check) "Jvdm01-
    WHERE exidv EQ w_vekp-exidv. "Jvdm01-
    PERFORM read_pallet. "MB01+
    SELECT SINGLE zpallet_no zcount_check zdep_point "Jvdm01+
    FROM zpallettr "Jvdm01+
    INTO (t_data_tab-zpallet_no, "Jvdm01+
    t_data_tab-zcount_check, "Jvdm01+
    t_data_tab-zdep_point) "Jvdm01+
    WHERE exidv EQ w_vekp-exidv. "Jvdm01+
    WHERE exidv EQ w_vekp-exidv "MB01-+
    AND zpallet_id = t_data_tab-lgtor."MB01+
    MB01 - INSERT START
    If pallet number specified and
    we are in the global route scenario & both doors fall within the
    selection criteria, we need to copy the one that is currently in a
    specified pallet
    IF NOT s_palno IS INITIAL AND not t_data_tab-zpallet_no in s_palno
    AND w_routetype = '3' .
    Switch doors & get 2nd shipment
    MOVE w_likp-zzroute2lgtor TO t_data_tab-lgtor.
    MOVE w_likp-zzroute2 TO t_data_tab-route.
    Read subsequent leg shipment
    READ TABLE it_vttp WITH KEY vbeln = it_vepo-vbeln
    laufk = '3'
    INTO w_vttp BINARY SEARCH.
    IF sy-subrc = 0.
    MOVE w_vttp-tknum TO t_data_tab-tknum.
    ENDIF.
    PERFORM read_pallet. "MB01+
    ENDIF.
    MB01 - INSERT END
    IF NOT t_data_tab-zpallet_no IN s_palno. "TR01+
    CONTINUE. "TR01+
    ENDIF. "TR01+
    IF sy-subrc = 0. "mb01+
    perform read_van. "MB01+
    SELECT SINGLE zvan_no zvan_print zeod_print FROM zvantr
    INTO (t_data_tab-zvan_no,
    t_data_tab-zvan_print,
    t_data_tab-zeod_print)
    WHERE zpallet_no EQ t_data_tab-zpallet_no.
    MB01 - INSERT START
    If van number specified and
    we are in the global route scenario & both doors fall within the
    selection criteria, we need to copy the one that is currently on a
    specified van
    IF NOT s_vanno IS INITIAL AND not t_data_tab-zvan_no in s_vanno AND
    w_routetype = '3' .
    Switch doors & get 2nd shipment
    MOVE w_likp-zzroute2lgtor TO t_data_tab-lgtor.
    MOVE w_likp-zzroute2 TO t_data_tab-route.
    Read subsequent leg shipment
    READ TABLE it_vttp WITH KEY vbeln = it_vepo-vbeln
    laufk = '3'
    INTO w_vttp BINARY SEARCH.
    IF sy-subrc = 0.
    MOVE w_vttp-tknum TO t_data_tab-tknum.
    ENDIF.
    PERFORM read_pallet. "MB01+
    perform read_van.
    ENDIF. "mb01-
    MB01 - INSERT END
    IF NOT t_data_tab-zvan_no IN s_vanno. "TR01+
    CONTINUE. "TR01+
    ENDIF. "TR01+
    ENDIF.
    APPEND t_data_tab.
    ENDLOOP.
    *-----> TR01+ start
    If the delivery has yet to be packed, then need to include in report
    Thus delete t_lips here and if any entries left after looping through
    t_vepo, these will also need to be added to t_data_tab
    if the selection is by handling unit though we do not want
    these"TR03+
    IF s_exidv IS INITIAL. "TR03+
    *{ REPLACE UKMK900355 1
    *\ LOOP AT it_vepo.
    *\ READ TABLE it_lips WITH KEY vbeln = it_vepo-vbeln
    *\ posnr = it_vepo-posnr
    *\ BINARY SEARCH. "SUM
    *\ IF sy-subrc = 0.
    *\ DELETE it_lips INDEX sy-tabix.
    *\ ENDIF.
    *\ ENDLOOP.
    Higher-level HUs can contain more than one delivery item " AS01
    LOOP AT it_lips. " AS01
    READ TABLE t_vepo_low WITH KEY vbeln = it_lips-vbeln " AS01
    posnr = it_lips-posnr. " AS01
    CHECK sy-subrc EQ 0. " AS01
    DELETE it_lips. " AS01
    ENDLOOP. " AS01
    *} REPLACE
    IF NOT it_lips[] IS INITIAL.
    move any unpacked items to the data table
    PERFORM move_lips_to_table.
    ENDIF.
    ENDIF. "TR03+
    *<---- TR01+ End
    get relevant status icons
    PERFORM select_icons.
    prepare ALV data
    PERFORM prepare_alv.
    ENDFORM. " select_data
    *& Form select_icons
    select icons for display and move data to display table
    FORM select_icons.
    DATA: w_disp_tab LIKE zpickdisp,
    w_disp_head LIKE zpickhead,
    w_color LIKE zpickdisp-color,
    ov_icon LIKE zpickdisp-ov_icon,
    gi_icon LIKE zpickdisp-gi_icon,
    to_icon LIKE zpickdisp-to_icon,
    lp_icon LIKE zpickdisp-lp_icon,
    pc_icon LIKE zpickdisp-pc_icon,
    lv_icon LIKE zpickdisp-lv_icon,
    vm_icon LIKE zpickdisp-vm_icon,
    em_icon LIKE zpickdisp-em_icon,
    sp_icon LIKE zpickdisp-sp_icon, " ANV SR#11523
    t_ovst_tab LIKE t_disp_tab WITH HEADER LINE.
    CONSTANTS: c_col1(3) VALUE 'C10',
    c_col2(3) VALUE 'C20'.
    SORT t_data_tab BY lgtor vbeln.
    w_color = c_col2.
    LOOP AT t_data_tab.
    AT NEW lgtor.
    fill ALV header table
    CLEAR w_disp_head.
    w_disp_head-lgtor = t_data_tab-lgtor.
    APPEND w_disp_head TO t_disp_head.
    ENDAT.
    goods issue status & overall amber/green only
    CASE t_data_tab-wbstk.
    WHEN c_c.
    MOVE icon_green_light TO gi_icon.
    MOVE icon_green_light TO ov_icon.
    WHEN OTHERS.
    MOVE icon_red_light TO gi_icon.
    MOVE icon_yellow_light TO ov_icon.
    ENDCASE.
    transfer order status
    CASE t_data_tab-lvsta.
    WHEN c_a.
    MOVE icon_red_light TO to_icon.
    WHEN c_b.
    MOVE icon_yellow_light TO to_icon.
    WHEN c_c.
    MOVE icon_green_light TO to_icon.
    WHEN space.
    write N/A
    to_icon = 'N/A'.
    ENDCASE.
    loaded to pallet status
    IF NOT t_data_tab-zpallet_no IS INITIAL.
    MOVE icon_green_light TO lp_icon.
    ELSE.
    MOVE icon_red_light TO lp_icon.
    ENDIF.
    pallet count status
    IF NOT t_data_tab-zcount_check IS INITIAL.
    MOVE icon_green_light TO pc_icon.
    ELSE.
    MOVE icon_red_light TO pc_icon.
    ENDIF.
    loaded to van status
    IF NOT t_data_tab-zvan_no IS INITIAL.
    MOVE icon_green_light TO lv_icon.
    ELSE.
    MOVE icon_red_light TO lv_icon.
    ENDIF.
    van manifest status
    IF NOT t_data_tab-zvan_print IS INITIAL.
    MOVE icon_green_light TO vm_icon.
    ELSE.
    MOVE icon_red_light TO vm_icon.
    ENDIF.
    Start of changes by ANV SR#11523
    Shipment status
    IF NOT t_data_tab-tknum IS INITIAL.
    MOVE icon_green_light TO sp_icon.
    ELSE.
    MOVE icon_red_light TO sp_icon.
    ENDIF.
    End of changes by ANV SR#11523
    end of day manifest status
    IF NOT t_data_tab-zeod_print IS INITIAL.
    MOVE icon_green_light TO em_icon.
    ELSE.
    MOVE icon_red_light TO em_icon.
    ENDIF.
    move working data table to display table
    MOVE-CORRESPONDING t_data_tab TO w_disp_tab.
    w_disp_tab-ov_icon = ov_icon.
    w_disp_tab-gi_icon = gi_icon.
    w_disp_tab-to_icon = to_icon.
    w_disp_tab-lp_icon = lp_icon.
    w_disp_tab-pc_icon = pc_icon.
    w_disp_tab-lv_icon = lv_icon.
    w_disp_tab-vm_icon = vm_icon.
    w_disp_tab-em_icon = em_icon.
    w_disp_tab-sp_icon = sp_icon. "ANV SR#11523
    w_disp_tab-color = w_color.
    fill N/A values for initial fields for display
    IF w_disp_tab-packvorschr IS INITIAL.
    w_disp_tab-packvorschr = 'N/A'.
    ENDIF.
    IF w_disp_tab-exidv IS INITIAL.
    w_disp_tab-exidv = 'N/A'.
    ENDIF.
    IF w_disp_tab-zpallet_no IS INITIAL.
    WRITE 'N/A' TO w_disp_tab-zpallet_no.
    ENDIF.
    IF w_disp_tab-zvan_no IS INITIAL.
    WRITE 'N/A' TO w_disp_tab-zvan_no.
    ENDIF.
    display different color for new doc number
    AT END OF vbeln.
    IF w_color = c_col1.
    w_color = c_col2.
    ELSEIF w_color = c_col2.
    w_color = c_col1.
    ENDIF.
    ENDAT.
    APPEND w_disp_tab TO t_disp_tab.
    CLEAR w_disp_tab.
    ENDLOOP.
    we have all the icons in display but need to check the overall status
    as this refers to the line items
    green and amber statuses already set and use the same criteria as the
    goods issue status unless detected as red here
    DATA: ov_stat_red(1).
    CLEAR w_disp_tab.
    SORT t_disp_tab BY vbeln.
    LOOP AT t_disp_tab INTO w_disp_tab.
    AT NEW vbeln.
    check all line items for delivery
    LOOP AT t_data_tab WHERE vbeln = w_disp_tab-vbeln.
    IF t_data_tab-lvsta = c_a.
    set overall status to red
    ov_stat_red = c_yes.
    EXIT.
    ELSE.
    leave green/amber status icon as previosly determined
    ENDIF.
    ENDLOOP.
    IF ov_stat_red = c_yes.
    set overall status to red for all items in that delivery
    CLEAR ov_stat_red.
    MOVE icon_red_light TO w_disp_tab-ov_icon.
    MODIFY t_disp_tab FROM w_disp_tab TRANSPORTING ov_icon
    WHERE vbeln = w_disp_tab-vbeln.
    ENDIF.
    ENDAT.
    ENDLOOP.
    ENDFORM. " select_icons
    *& Form fill_layout
    fill ALV layout parameters
    FORM fill_layout.
    CLEAR g_layout.
    g_layout-colwidth_optimize = c_yes. " column width optimisation
    g_layout-zebra = space. " alternate line colors
    g_layout-box_fieldname = 'MARK'. " checkbox fieldname
    g_layout-info_fieldname = 'COLOR'. " highlight row indicator
    g_layout-no_vline = space. " vertical line
    g_layout-key_hotspot = space. " hotspot field
    g_layout-f2code = 'PICK'. " F2 ok_code
    g_layout-numc_sum = c_yes. " sum numc fields
    g_layout-box_tabname = 't_disp_head'. " checkbox table name
    g_layout-expand_fieldname = 'EXPAND'. " expand field name
    ENDFORM. " fill_layout
    *& Form fill_sort
    fill ALV sort table
    FORM fill_sort.
    DATA: w_g_sort TYPE slis_sortinfo_alv.
    w_g_sort-spos = 1.
    w_g_sort-fieldname = 'LGTOR'.
    w_g_sort-tabname = 't_disp_tab'.
    w_g_sort-up = c_yes.
    APPEND w_g_sort TO g_sort.
    w_g_sort-spos = 2.
    w_g_sort-fieldname = 'VBELN'.
    w_g_sort-tabname = 't_disp_tab'.
    w_g_sort-up = c_yes.
    APPEND w_g_sort TO g_sort.
    w_g_sort-spos = 3.
    w_g_sort-fieldname = 'POSNR'.
    w_g_sort-tabname = 't_disp_tab'.
    w_g_sort-up = c_yes.
    APPEND w_g_sort TO g_sort.

  • ALV display column and row wise

    hi experts,
    Is it possible to display in ALV display as 6 fields in column and some ranges in row display so how to display that using alv grid any sample report please do send me.
    e.g.display format.
                   PO Type          Shipping Date          Invoice Num          PCS  #        Po No.          Cust Name          Terms          Open Balance
    Current                                                                           
    Total Current                                                                           
    1 - 15                                                                           
    Total 1 - 15                                                                           
    16-30                                                                           
    Total 16-30                                                                           
    31 - 60                                                                           
    Total 31 - 60                                                                           
    61 - 90                                                                           
    Total 61 - 90                                                                           
    > 90                                                                           
    Total > 90                                                                           
    TOTAL

    hi Lakshman,
    i want report for customer open invoices that is aging report,
    so depens on due days as per ranges shown in my question like 1--15 days,
    15-16 days these are due days ranges , and i have display these related ranges records horizontally , just understand my display format u will get what i mean to say,
    please send me any proper solution.
    Thanks and Regards,
    Yogesh

  • How to display multiple lines of texts in a single rows in ALV

    Hi,
    I have a unique requirement in which i have to display multiple lines if texts for a single rows in ALV Grid. Right now in my output it is coming in single line which is not visible fully because that text is more than 255 character. So i want to display the test by splitting into multiple lines and show it on output. Please suggest some solution for this if this is possible in ALV.
    Thanks,
    Raghav

    Hi Raghavendra,
    Its not possible to display multiple line in one row of an alv, but i think you can acheive it by splitting the whole text into multiple sub-text.
    For example, if your requirement is as below:
    Field #1          Field #2
    1                    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx(200 characters)
    2                    yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy(220 character)
    then you can break Field#2 value into say 50 character and then populate the internal table with repetative entries of Field#1 and the finally sort it by Field#1 value... as a result of which you output will be somewhat as below:
    Field#1          Field#2
    1                   xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
                         xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
                         xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
                         xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    2                   yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
                         yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
                         yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
                         yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
                         yyyyyyyyyyyyyyyyyyyy           
    Hope it will help you in meeting your requirement.
    Regards,
    Shradha

  • Colour Row of ALV

    Hello,
    I am using an ALV where I want to colour particular rows in it based on the content of a particular column (like whenever the value is TOTAL in that row) ,i want to color that entire row . How can i achieve the same.?
    Please help.
    Any help would be highly appreciated.
    Thanks.

    Hi,
    Add a attribute CELL_COLOR of type WDY_UIE_LIBRARY_ENUM_TYPE in your context node.
    Now according to you condition set the value of this attribute :-
    like :-
    LOOP AT IT_NODENAME INTO WA_NODENAME.
      IF (condition ).
      WA_NODENAME-CELL_COLOUR = CL_WD_TABLE_COLUMN=>E_CELL_DESIGN-GOODVALUE_LIGHT.
    ENDIF.
    ENDLOOP.
    The colors details and types are given in the class CL_WD_TABLE_COLUMN.
    Follow :-
    [TableColumn|http://help.sap.com/saphelp_nw70/helpdata/en/bd/5d9041d3c72e7be10000000a1550b0/content.htm]
    Now in after instantiating your alv component and using get model get the column reference and set the cell color attribute.
    like:-
      LO_CMP_USAGE =   WD_THIS->WD_CPUSE_ALV_COMP( ).
      IF LO_CMP_USAGE->HAS_ACTIVE_COMPONENT( ) IS INITIAL.
        LO_CMP_USAGE->CREATE_COMPONENT( ).
      ENDIF.
      LO_INTERFACECONTROLLER =   WD_THIS->WD_CPIFC_ALV_COMP( ).
      DATA LV_VALUE TYPE REF TO CL_SALV_WD_CONFIG_TABLE.
      LV_VALUE = LO_INTERFACECONTROLLER->GET_MODEL(
    configure columns
      LR_COLUMN_SETTINGS ?= LV_VALUE.
      LT_COLUMNS = LR_COLUMN_SETTINGS->GET_COLUMNS( ).
    as you want color a row so make it for all the columns:-
    LOOP AT LT_COLUMNS INTO LS_COLUMN .
        CASE LS_COLUMN-ID .
    use this for all :-
        LR_COLUMN->SET_CELL_DESIGN_FIELDNAME( VALUE = 'CELL_COLOUR' ).
      ENDCASE.
    ENDLOOP.
    Regards,
    Monishankar C

Maybe you are looking for

  • "All of the playlists for updating no longer exist"???!!

    I created a few new playlists and deleted an old one in iTunes, and then when I plugged in my mini to update I get the message: Songs on the iPod “Kellee's iPod” cannot be updated because all of the playlists for updating no longer exist" There are n

  • Windows 8 upgrade via newer systems??

    Hi there I have read numerous post on this board by HP staff helping people upgrade to Windows 8. One staff member said that their maybe other versions of the same machine that have been tested already that use the same hardware. My machine: HP Pavil

  • Output type Requirement triggering

    Hi, In my project I have a requirement to stop triggering of an output type if all the items in the sales order have reason for rejection set. I have done the condition check in a output requirement routine and if the condition fails then I set SY-SU

  • Tabspace in Text file

    Hi I am creating text file using text_io function. I want to put tabspace after one word instead of giving manual space. e.g oracle oracle oracle oracle Let me know if any idea. Thanx Vishal Problem solved using CHR(9) Thanks once again

  • How do i add an iTunes gift card to my iTouch?

    how do i add an iTunes gift card to my iPod Touch?