How to handle interactive list in alv reports

hi experts.
how to handle interactive list in alv reports.
regards.
subhasis

HI Subhasis,
below is the sample code for handling an interactive ALV report, hope this helps you ..
REPORT  ZTEST_ALV123.                           
TYPE-POOLS:SLIS.
DATA :   IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
          IT_FIELDCAT1 TYPE SLIS_T_FIELDCAT_ALV.
DATA: BEGIN OF ITAB OCCURS 0,
       VBELN LIKE VBAK-VBELN,
       POSNR LIKE VBAP-POSNR,
       END OF ITAB.
DATA: BEGIN OF ITAB1 OCCURS 0,
       VBELN LIKE LIKP-VBELN,
       POSNR LIKE LIPS-POSNR,
       VGBEL LIKE LIPS-VGBEL,
       VGPOS LIKE LIPS-VGPOS,
       END OF ITAB1.
DATA: IT_LIPS LIKE ITAB1 OCCURS 0 WITH HEADER LINE.
SELECT  VBELN
        POSNR
        FROM VBAP
        INTO TABLE ITAB.
IF SY-SUBRC = 0.
  SORT ITAB BY VBELN .
  SELECT VBELN
   POSNR
   VGBEL
   VGPOS
   INTO TABLE ITAB1
   FROM LIPS
   FOR ALL ENTRIES IN ITAB
   WHERE VGBEL = ITAB-VBELN
     AND    VGPOS = ITAB-POSNR.
ENDIF.
DATA: X_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
X_FIELDCAT-FIELDNAME = 'VBELN'.
X_FIELDCAT-TABNAME = 'ITAB'.
X_FIELDCAT-COL_POS  = 1.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
X_FIELDCAT-FIELDNAME = 'POSNR'.
X_FIELDCAT-TABNAME = 'ITAB'.
X_FIELDCAT-COL_POS  = 1.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
  EXPORTING
    I_CALLBACK_PROGRAM       = SY-REPID
    I_CALLBACK_PF_STATUS_SET = 'PFSTATUS'
    I_CALLBACK_USER_COMMAND  = 'HANDLE_USER_COMMAND'
    IT_FIELDCAT              = IT_FIELDCAT
  TABLES
    T_OUTTAB                 = ITAB
  EXCEPTIONS
    PROGRAM_ERROR            = 1
    OTHERS                   = 2.
IF SY-SUBRC  = 0.
ENDIF.
*&      Form  POPUP
      text
     -->P_EXTAB    text
FORM POPUP USING P_EXTAB TYPE SLIS_T_EXTAB.
"here double click on PFSTATUS and create the status, "activate, before that set PICK for choose(F2).
*- Pf status
  SET PF-STATUS 'PFSTATUS'.
ENDFORM.                 " POPUP
*&      Form  HANDLE_USER_COMMAND
      text
     -->R_UCOMM      text
     -->RS_SELFIELD  text
FORM HANDLE_USER_COMMAND USING R_UCOMM     LIKE SY-UCOMM
                               RS_SELFIELD TYPE SLIS_SELFIELD.
  CASE R_UCOMM.
    WHEN '&IC1'.
      IF RS_SELFIELD-FIELDNAME = 'VBELN'.
        READ TABLE ITAB INDEX RS_SELFIELD-TABINDEX.
        LOOP AT ITAB1 WHERE VGBEL = ITAB-VBELN
                          AND VGPOS = ITAB-POSNR.
          MOVE-CORRESPONDING ITAB1 TO IT_LIPS.
          APPEND IT_LIPS.
        ENDLOOP.
        PERFORM INTERACTIVE_REPORT.
      ENDIF.
  ENDCASE.
ENDFORM.                    "HANDLE_USER_COMMAND
*&      Form  interactive_report
      text
FORM INTERACTIVE_REPORT .
  X_FIELDCAT-FIELDNAME = 'VBELN'.
  X_FIELDCAT-SELTEXT_L = 'VBELN'.
  X_FIELDCAT-TABNAME = 'IT_LIPS'.
  X_FIELDCAT-COL_POS  = 1.
  APPEND X_FIELDCAT TO IT_FIELDCAT1.
  CLEAR X_FIELDCAT.
  X_FIELDCAT-FIELDNAME = 'POSNR'.
  X_FIELDCAT-SELTEXT_L = 'ITEM'.
  X_FIELDCAT-TABNAME = 'IT_LIPS'.
  X_FIELDCAT-COL_POS  = 2.
  APPEND X_FIELDCAT TO IT_FIELDCAT1.
  CLEAR X_FIELDCAT.
  X_FIELDCAT-FIELDNAME = 'VGBEL'.
  X_FIELDCAT-SELTEXT_M = 'SO #'.
  X_FIELDCAT-TABNAME = 'IT_LIPS'.
  X_FIELDCAT-COL_POS  = 3.
  APPEND X_FIELDCAT TO IT_FIELDCAT1.
  CLEAR X_FIELDCAT.
  X_FIELDCAT-FIELDNAME = 'VGPOS'.
  X_FIELDCAT-SELTEXT_M = 'SO ITEM'.
  X_FIELDCAT-TABNAME = 'IT_LIPS'.
  X_FIELDCAT-COL_POS  = 4.
  APPEND X_FIELDCAT TO IT_FIELDCAT1.
  CLEAR X_FIELDCAT.
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_CALLBACK_PROGRAM = SY-REPID
      IT_FIELDCAT        = IT_FIELDCAT1
    TABLES
      T_OUTTAB           = IT_LIPS
    EXCEPTIONS
      PROGRAM_ERROR      = 1
      OTHERS             = 2.
  IF SY-SUBRC  = 0.
  ENDIF.
ENDFORM.                    " interactive_report
Regards,
Ranjita
null

Similar Messages

  • How to use intractive list in Alv REPORT

    how to use intractive list in Alv REPORT with example.
    thangs
    venki.......

    Hi
    using the USER_COMMAND we can move to the Secondary(interactive) list in the ALV
    see the sample code
    report yh645_secndry_alv.
    type-pools: slis.
    data: fieldcat type slis_t_fieldcat_alv,
    fieldcat_ln like line of fieldcat,
    fs_layout type slis_layout_alv,
    t_layoout like standard table
    of fs_layout.
    data: begin of fs_spfli,
    carrid type spfli-carrid,
    connid type spfli-connid,
    countryfr type spfli-countryfr,
    cityfrom type spfli-cityfrom,
    airpfrom type spfli-airpfrom,
    countryto type spfli-countryto,
    cityto type spfli-cityto,
    airpto type spfli-airpto,
    fltime type spfli-fltime,
    deptime type spfli-deptime,
    arrtime type spfli-arrtime,
    distance type spfli-distance,
    distid type spfli-distid,
    fltype type spfli-fltype,
    period type spfli-period,
    checkbox,
    color(3),
    end of fs_spfli.
    data:
    begin of fs_table,
    carrid type spfli-carrid,
    connid type spfli-connid,
    end of fs_table.
    data: begin of fs_sflight,
    check,
    color(3).
    include type sflight.
    data:end of fs_sflight.
    data:
    begin of fs_table1,
    carrid type sflight-carrid,
    connid type sflight-connid,
    fldate type sflight-fldate,
    end of fs_table1.
    data:
    t_spfli like standard table
    of fs_spfli.
    data:
    t_table like standard table
    of fs_table.
    data:
    t_table1 like standard table
    of fs_table1.
    data:
    t_sflight like standard table
    of fs_sflight.
    data:
    t_sbook like standard table
    of sbook.
    data t_layout type slis_layout_alv.
    select *
    into corresponding fields of table t_spfli
    from spfli.
    perform start_list_viewer.
    perform get_spfli_details.
    *& Form SUB1
    text
    -->RT_EXTAB text
    form sub1 using rt_extab type slis_t_extab.
    data: flight type slis_extab.
    flight-fcode = 'SFLIGHT'.
    append flight to rt_extab.
    set pf-status 'SFLIGHT'. " EXCLUDING RT_EXTAB.
    endform. "SUB1
    *& Form START_LIST_VIEWER
    text
    --> p1 text
    <-- p2 text
    form start_list_viewer .
    data: pgm like sy-repid.
    pgm = sy-repid.
    fs_layout-box_fieldname = 'CHECKBOX'.
    fs_layout-info_fieldname = 'COLOR'.
    call function 'REUSE_ALV_LIST_DISPLAY'
    exporting
    i_callback_program = pgm
    i_callback_pf_status_set = 'SUB1'
    i_callback_user_command = 'USER_COMMAND'
    i_structure_name = 'SPFLI'
    is_layout = fs_layout
    tables
    t_outtab = t_spfli
    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. " START_LIST_VIEWER
    *******Process Call Back Events (Begin)**************************
    form user_command using ucomm like sy-ucomm
    selfield type slis_selfield.
    case ucomm.
    when 'SFLIGHT'.
    selfield-refresh = 'X'.
    perform get_spfli_details.
    select *
    from sflight
    into corresponding fields of table t_sflight
    for all entries in t_table
    where carrid eq t_table-carrid
    and connid eq t_table-connid.
    perform display_sflight.
    when 'SBOOK'.
    selfield-refresh = 'X'.
    perform get_sflight_details.
    select *
    from sbook
    into corresponding fields of table t_sbook
    for all entries in t_table1
    where carrid eq t_table1-carrid
    and connid eq t_table1-connid
    and fldate eq t_table1-fldate.
    perform display_sbook.
    endcase.
    endform. "USER_COMMAND
    *& Form SUB2
    text
    -->RT_EXTAB text
    form sub2 using rt_extab type slis_t_extab.
    data: flight type slis_extab.
    flight-fcode = 'SBOOK'.
    append flight to rt_extab.
    set pf-status 'SBOOK'. " EXCLUDING RT_EXTAB.
    endform. "SUB2
    *& Form DISPLAY_SFLIGHT
    text
    --> p1 text
    <-- p2 text
    form display_sflight .
    data: pgm like sy-repid.
    pgm = sy-repid.
    clear t_layout.
    fs_layout-box_fieldname = 'CHECK'.
    fs_layout-info_fieldname = 'COLOR'.
    call function 'REUSE_ALV_LIST_DISPLAY'
    exporting
    i_callback_program = pgm
    i_callback_pf_status_set = 'SUB2'
    i_callback_user_command = 'USER_COMMAND'
    i_structure_name = 'SFLIGHT'
    is_layout = fs_layout
    tables
    t_outtab = t_sflight
    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. " DISPLAY_SFLIGHT
    *& Form GET_SPFLI_DETAILS
    text
    --> p1 text
    <-- p2 text
    form get_spfli_details .
    loop at t_spfli into fs_spfli.
    if fs_spfli-checkbox = 'X'.
    fs_spfli-color = 'C51'.
    fs_spfli-checkbox = '1'.
    fs_table-carrid = fs_spfli-carrid.
    fs_table-connid = fs_spfli-connid.
    append fs_table to t_table.
    modify t_spfli from fs_spfli.
    endif.
    endloop.
    endform. " GET_SFLIGHT_DETAILS
    *& Form GET_SFLIGHT_DETAILS
    text
    --> p1 text
    <-- p2 text
    form get_sflight_details .
    loop at t_sflight into fs_sflight.
    if fs_sflight-check = 'X'.
    fs_sflight-color = 'C71'.
    fs_sflight-check = '1'.
    fs_table1-carrid = fs_sflight-carrid.
    fs_table1-connid = fs_sflight-connid.
    fs_table1-fldate = fs_sflight-fldate.
    append fs_table1 to t_table1.
    modify t_sflight from fs_sflight.
    endif.
    endloop.
    endform. " GET_SFLIGHT_DETAILS
    *& Form DISPLAY_SBOOK
    text
    --> p1 text
    <-- p2 text
    form display_sbook .
    data: pgm like sy-repid.
    pgm = sy-repid.
    call function 'REUSE_ALV_LIST_DISPLAY'
    exporting
    i_callback_program = pgm
    i_structure_name = 'SBOOK'
    tables
    t_outtab = t_sbook
    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. " DISPLAY_SBOOK
    Reward points for useful Answers
    Regards
    Anji

  • How to handle Events in Blocked ALV report

    Hi All,
    I have a Blocked ALV report, I have a requirement where if I double click a row in blocked ALV report, it should branch off to MM01 transaction code and the material number and change number should get populated with the material number and change number  in my program.
    Is there any idea how to do this.
    Thanks,
    Vishal.

    hi anil,
    I have used user_command1 as the function module however the field details are not getting captured.
    How can we use set get parameters in this aspect.
    Please elaborate your answer.
    Thanks,
    Vishal.

  • How to Handle PF Status in ALV  report ?

    Hi friends i wanna handle my own PF Status in my report how can i handle it ?
    please help me?
    regards
    satish

    call function module reuse_alv_grid_display.
    exporting.
    programname = gd_repid.
    t_fieldcatalog = d_fieldcat.
    set pf_status = 'SET_PF_STATUS'.
    importing.
    t_outtab = itab.
    exceptions.
    form set_pf_status using rt_extab type slis_t_extab.
    SET PF_STATUS 'NEWSTATUS'.
    endform.
    double click on NEWSTATUS it will take u to new window where in u can select required icon's which u need to be displayed in output.
    otherwise
    please see the standard program bcalv_grid_05.
    Reward with points if helpful.

  • Interactive lists from ALV

    Hi experts,
    Please tell me how to generate Interactive list from ALV.
    I have already created interactive list without ALV
    ( using AT LINE SELECTION)

    Please refer to the below code.
    A very good example with most of the company Standards.
    *& Report  zalv                                                      *
    REPORT zalv .
    TYPE-POOLS: kkblo,
                slis.
    TABLES: mara, marc, mard.
    DATA:       disvariant   LIKE disvariant,
                eventcat     TYPE slis_t_event,
                eventcat_ln  LIKE LINE OF eventcat,
                fieldcat     TYPE slis_t_fieldcat_alv,
                fieldcat_kkb TYPE kkblo_t_fieldcat,
                fieldcat_ln  LIKE LINE OF fieldcat,
                keyinfo      TYPE slis_keyinfo_alv,
                layout       TYPE slis_layout_alv,
                layout_kkb   TYPE kkblo_layout,
                pgm          LIKE sy-repid,
                printcat     TYPE slis_print_alv,
                sortcat      TYPE slis_t_sortinfo_alv,
                sortcat_ln   LIKE LINE OF sortcat,
                BEGIN OF coltab OCCURS 50,
                  fieldname LIKE fieldcat_ln-fieldname,
                END OF coltab.
    DATA: print          TYPE slis_print_alv.
    DATA : v_repid TYPE sy-repid.
    DATA: BEGIN OF wa OCCURS 0,
            matnr TYPE mara-matnr,
            ersda TYPE mara-ersda,
            ernam TYPE mara-ernam,
            aenam TYPE mara-aenam,
            werks TYPE marc-werks,
            pstat TYPE marc-pstat,
            lfmon TYPE mard-lfmon,
          END OF wa.
    DATA: itab LIKE TABLE OF wa.
    **Selection Screen
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001..
    SELECT-OPTIONS: mat_no FOR mara-matnr.
    SELECTION-SCREEN SKIP.
    SELECTION-SCREEN END OF BLOCK b1.
    * Parameter for list viewer display variant
    PARAMETERS:    variant  LIKE disvariant-variant.
    AT SELECTION-SCREEN ON variant.
      CHECK NOT variant IS INITIAL.
      PERFORM check_variant_existence USING variant 'U'.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR variant.
      PERFORM f4_display_variant USING variant 'U'.
    *Initialization
    INITIALIZATION.
      v_repid = sy-repid.
    *Start of selection
      PERFORM check_tcode_authority USING 'SA38'.
    START-OF-SELECTION.
      SELECT a~matnr a~ersda
             a~ernam a~aenam
             c~werks c~pstat d~lfmon
      INTO TABLE itab
      UP TO 10 ROWS
      FROM mara AS a
      INNER JOIN marc AS c ON a~matnr = c~matnr
      INNER JOIN mard AS d ON c~matnr = d~matnr
      WHERE a~matnr IN mat_no.
    *End of Selection
    END-OF-SELECTION.
      PERFORM call_list_viewer.
    *&      Form  call_list_viewer
    *       text
    FORM call_list_viewer .
      PERFORM build_fieldcat USING:
               'MATNR' 'ITAB'
                'Material #' 'CHAR'     18 ' ' ' ' ' ' ' ' ' ',
               'ERSDA' 'ITAB'
                'Date Created' 'CHAR'   10 ' ' ' ' ' ' ' ' ' ',
               'ERNAM' 'ITAB'
                'Created By' 'CHAR'     10 ' ' ' ' ' ' ' ' ' ',
               'AENAM' 'ITAB'
                'Changed By' 'CHAR'     10 ' ' ' ' ' ' ' ' ' ',
               'WERKS' 'ITAB'
                'Plant' 'CHAR'           4 ' ' ' ' ' ' ' ' ' ',
               'PSTAT' 'ITAB'
                'Status' 'CHAR'         10 ' ' ' ' ' ' ' ' ' ',
               'LFMON' 'ITAB'
                'Current Period' 'CHAR'  8 ' ' ' ' ' ' ' ' ' '.
      PERFORM build_eventcat USING: 'TOP_OF_LIST',
                                    'TOP_OF_PAGE'.
      PERFORM list_display TABLES itab.
    ENDFORM.                    "call_list_viewer
    * build field catalog entry                                            *
    FORM build_fieldcat USING a_fieldname
                              a_tabname
                              a_heading
                              a_datatype
                              a_outputlen
                              a_key
                              a_no_out
                              a_no_sum
                              a_do_sum
                              a_no_zero.
      CLEAR fieldcat_ln.
      fieldcat_ln-fieldname = a_fieldname.
      fieldcat_ln-tabname  = a_tabname.
      fieldcat_ln-outputlen = a_outputlen.
      fieldcat_ln-datatype = a_datatype.
      fieldcat_ln-reptext_ddic = a_heading.
      fieldcat_ln-key = a_key.
      fieldcat_ln-no_out = a_no_out.
      fieldcat_ln-no_sum = a_no_sum.
      fieldcat_ln-do_sum = a_do_sum.
      fieldcat_ln-no_zero = a_no_zero.
      APPEND fieldcat_ln TO fieldcat.
    ENDFORM.                    "BUILD_FIELDCAT
    *       FORM BUILD_EVENTCAT
    FORM build_eventcat USING a_event.
      eventcat_ln-name = eventcat_ln-form = a_event.
      APPEND eventcat_ln TO eventcat.
    ENDFORM.                    "BUILD_EVENTCAT
    * call the ABAP list viewer                                            *
    FORM list_display TABLES a_output.
      pgm = disvariant-report = sy-repid.
      disvariant-variant = variant.
    * call list viewer
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          i_callback_program       = pgm
    *      i_callback_pf_status_set = 'SET_PF_STATUS'
          it_fieldcat              = fieldcat
          is_variant               = disvariant
          is_layout                = layout
          is_print                 = print
          i_save                   = 'A'
          it_events                = eventcat
          it_sort                  = sortcat
    *      i_callback_user_command  = 'USER_COMMAND'
        TABLES
          t_outtab                 = a_output
        EXCEPTIONS
          program_error            = 1
          OTHERS                   = 2.
    ENDFORM.                    "LIST_DISPLAY
    *&      Form  top_of_page
    *       text
    FORM top_of_page.
      PERFORM standard_headings.
      PERFORM print_selection_screen TABLES:
                   mat_no USING  'Material No  : ' 18 'N' 1.
    ENDFORM.                    "top_of_page
    *       FORM CHECK_VARIANT_EXISTENCE
    *       Verify that a variant on the selection screen exists
    FORM check_variant_existence USING varname LIKE disvariant-variant
                                       save   TYPE c.
      DATA: xdisvar LIKE disvariant.
      xdisvar-report  = sy-repid.
      xdisvar-variant = varname.
      CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
        EXPORTING
          i_save        = save
        CHANGING
          cs_variant    = xdisvar
        EXCEPTIONS
          wrong_input   = 1
          not_found     = 2
          program_error = 3
          OTHERS        = 4.
      IF sy-subrc <> 0.
        MESSAGE e256(56) WITH varname.
    *   Anzeigevariante &1 nicht gefunden
      ENDIF.
      disvariant-report  = sy-repid.
      disvariant-variant = varname.
    ENDFORM.                    "check_variant_existence
    *       Form  F4_DISPLAY_VARIANT
    *       F4 help to find a display variant
    *       varname = name of the dynpro field for which f4 is requested
    *       save    = type of list variant saving
    *                 ' ' = no saving allowed
    *                 'A' = standard & user specific variants can be saved
    *                 'U' = only user specific variants can be saved
    *                 'X' = only standard variants can be saved
    FORM f4_display_variant USING varname LIKE disvariant-variant
                                  save    TYPE c.
      disvariant-report = sy-repid.
      CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
        EXPORTING
          is_variant    = disvariant
          i_save        = save
        IMPORTING
          es_variant    = disvariant
        EXCEPTIONS
          not_found     = 1
          program_error = 2
          OTHERS        = 3.
      IF sy-subrc = 0.
        varname = disvariant-variant.
      ELSE.
        MESSAGE s245(56).
    *   Keine Anzeigevariante(n) vorhanden
      ENDIF.
    ENDFORM.                               " F4_DISPLAY_VARIANT
    *       FORM STANDARD_HEADINGS                                        *
    *       Print standard page headings for report                       *
    FORM standard_headings.
      DATA: start_column TYPE i,
            title_len TYPE i,
            header_for_80_col(45),
            date_time_for_80_col(45),
            text_h0(11) VALUE 'Report No. ',
            text_h1(5) VALUE 'Date ',
            text_h2(6) VALUE 'Page -',
            text_h3(7) VALUE 'System ',
            text_h4(5) VALUE 'Time ',
            text_h5(11) VALUE 'Run By     '.
      FORMAT INTENSIFIED ON.
      CONDENSE syst-title.
      IF syst-linsz > 80.
        WRITE: /  text_h0,                 "Report No.
               12 syst-repid(8),
               23 text_h1,                 "Date
                  sy-datlo.
        title_len = STRLEN( syst-title ) / 2.
        start_column = ( syst-linsz / 2 ) - title_len.
        IF start_column < 40.
          start_column = 40.
        ENDIF.
        WRITE: AT start_column syst-title.
      ELSE.
        WRITE: /  text_h0,                 "Report No.
               12 syst-repid(8).
        start_column = 22.
        WRITE syst-title TO header_for_80_col CENTERED.
        WRITE: header_for_80_col.
      ENDIF.
      start_column = syst-linsz - 12.
      WRITE: AT start_column text_h2, syst-pagno LEFT-JUSTIFIED.
      IF syst-linsz > 80.
        WRITE: / text_h3,                  "System
              12 syst-sysid(4),
                 syst-mandt,
              23 text_h4,                  "Time
                 syst-timlo.
        WRITE: / text_h5,                  "Run By
              12 syst-uname.
      ELSE.
        WRITE: / text_h3,                  "System
              12 syst-sysid(4),
                 syst-mandt,
              23 text_h1,                  "Date
                 syst-datlo.
        WRITE: / text_h5,                  "Run By
              12 syst-uname,
              23 text_h4,                  "Time
                 syst-timlo.
      ENDIF.
      SKIP.
    ENDFORM.                    "STANDARD_HEADINGS
    *       FORM PRINT_SELECTION_SCREEN                                        *
    *  -->  SIGN                                                          *
    *  -->  OPTION                                                        *
    *  -->  LOW                                                           *
    *  -->  HIGH                                                          *
    *  -->  D_IND                                                         *
    *  -->  S_STRING                                                      *
    FORM print_selection_screen TABLES r_selection TYPE table
                           USING  p_name
                                  p_length TYPE i
                                  p_ind
                                  p_start_col.
      DATA: year(4)       TYPE c,
            month(2)      TYPE c,
            day(2)        TYPE c,
            low_date(10)  TYPE c,
            high_date(10) TYPE c,
            offset(80)    TYPE c.
      DATA: BEGIN OF l_selline,
              sign(1) TYPE c,
              option(2) TYPE c,
              data(200) TYPE c,
            END OF l_selline.
      DATA: l_string(80) TYPE c,
            l_temp(80) TYPE c,
            len TYPE i,
            len1 TYPE i.
      DESCRIBE FIELD p_name LENGTH len IN CHARACTER MODE.
      len = len + p_start_col + 2.
      LOOP AT r_selection.
        IF syst-tabix = 1.
          WRITE AT /p_start_col p_name.
        ELSE.
          len1 = ( STRLEN( l_string ) ).
          len = len1 + len + 2.
        ENDIF.
        MOVE r_selection TO l_selline.
        SHIFT l_selline-data LEFT DELETING LEADING '0'.
        CLEAR l_string.
        CASE l_selline-option.
          WHEN 'EQ'.
            CONCATENATE l_string '=' INTO l_string.
          WHEN 'NE'.
            CONCATENATE l_string 'not =' INTO l_string.
          WHEN 'LT'.
            CONCATENATE l_string '<' INTO l_string.
          WHEN 'GT'.
            CONCATENATE l_string '>' INTO l_string.
          WHEN 'LE'.
            CONCATENATE l_string '<=' INTO l_string.
          WHEN 'GE'.
            CONCATENATE l_string '>=' INTO l_string.
          WHEN 'BT'.
            CONCATENATE l_string 'between' INTO l_string.
          WHEN 'NB'.
            CONCATENATE l_string 'not between' INTO l_string.
          WHEN 'CP'.
            CONCATENATE l_string 'contains pattern' INTO l_string.
          WHEN 'NP'.
            CONCATENATE l_string 'no pattern' INTO l_string.
        ENDCASE.
        IF l_selline-sign EQ 'E'.
          CONCATENATE 'NOT' l_string INTO l_string SEPARATED BY ' '.
        ENDIF.
        IF p_ind EQ 'Y'.
          MOVE l_selline-data(4) TO year.
          MOVE l_selline-data+4(2) TO month.
          MOVE l_selline-data+6(2) TO day.
          CONCATENATE month '/' day '/' year INTO low_date.
          CONCATENATE l_string low_date INTO l_string SEPARATED BY ' '.
          IF l_selline-option EQ 'BT' OR l_selline-option EQ 'NB'.
            MOVE l_selline-data+p_length(4) TO year.
            offset = p_length + 4.
            MOVE l_selline-data+offset(2) TO month.
            ADD 2 TO offset.
            MOVE l_selline-data+offset(2) TO day.
            CONCATENATE month '/' day '/' year INTO high_date.
            CONCATENATE l_string 'and' high_date INTO l_string SEPARATED
                                                  BY ' '.
          ENDIF.
        ELSE.
          MOVE l_selline-data(p_length) TO l_temp.
          CONCATENATE l_string l_temp INTO l_string SEPARATED BY ' '.
          IF l_selline-option EQ 'BT' OR l_selline-option EQ 'NB'.
            MOVE l_selline-data+p_length(p_length) TO l_temp.
            CONCATENATE l_string 'and' l_temp INTO l_string SEPARATED
                                                                BY ' '.
          ENDIF.
        ENDIF.
        WRITE AT len l_string.
      ENDLOOP.
      IF syst-subrc <> 0.
        WRITE: AT /p_start_col p_name, ' *** ALL ***'.
      ENDIF.
    ENDFORM.                    "PRINT_SELECTION_SCREEN
    *       FORM CHECK_TCODE_AUTHORITY                                    *
    *       Check User Security Against A SAP Transaction                 *
    *  -->  a_tcode  Transaction Code For Security                        *
    FORM check_tcode_authority USING a_tcode.
    * if tcode is not passed, then return ok.
      IF NOT a_tcode IS INITIAL.
        CALL FUNCTION 'AUTHORITY_CHECK_TCODE'"Only People that
             EXPORTING                     " have access to
               tcode  = a_tcode            " Transaction t-tcode
             EXCEPTIONS                    " are ALLOWED to execute
                  ok     = 1               " this Program
                  not_ok = 2.
        IF syst-subrc NE 1.
          MESSAGE a999(zz) WITH 'YOU Do Not Have Authority to Execute'.
        ENDIF.
      ELSE.
        MOVE 1 TO syst-subrc.
      ENDIF.
    ENDFORM.                    "CHECK_TCODE_AUTHORITY
    Shreekant

  • How to create secondary lists in ALV

    Hi all,
    Can u plz explain me how to create Secondary lists usingl ALV and how many secondary lists we can create.
    Thanks in advance
    Venkat

    this is the very very simple program in HR module to demonstrate interactive ALV report.
    If u have HR module implemented...just copy and paste this code and debug it...you will easily get the flow of the report...this is the simplest program..
    i hope it helps...here u go......
    REPORT ztej_alv_interactive.
    TABLES: pa0000, pa0001.
    DATA : BEGIN OF it0001 OCCURS 0,
              pernr LIKE pa0001-pernr,
              ename LIKE pa0001-ename,
           END OF it0001.
    DATA : BEGIN OF it0000 OCCURS 0,
              pernr LIKE pa0000-pernr,
              begda LIKE pa0000-begda,
              endda LIKE pa0000-endda,
              massn LIKE pa0000-massn,
              massg LIKE pa0000-massg,
              aedtm LIKE pa0000-aedtm,
           END OF it0000.
    TYPE-POOLS: slis.
    DATA: v_repid LIKE sy-repid .
    DATA: i_fieldcat TYPE slis_t_fieldcat_alv.
    DATA: i_fieldcat1 TYPE slis_t_fieldcat_alv.
    DATA: it_listheader TYPE slis_t_listheader.
    DATA: it_listheader1 TYPE slis_t_listheader.
    DATA: v_events TYPE slis_t_event,
          wa_event TYPE slis_alv_event.
    DATA: alv_layout TYPE slis_layout_alv.
    DATA:  i_title_0001 TYPE lvc_title VALUE 'FIRST LIST DISPLAYED'.
    DATA:  i_title_0000 TYPE lvc_title.
    DATA : temp_pernr LIKE pa0001-pernr.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-000.
    SELECTION-SCREEN SKIP.
    SELECT-OPTIONS : s_pernr FOR pa0000-pernr DEFAULT '16240147'.
    SELECTION-SCREEN END OF BLOCK b1.
    INITIALIZATION.
      v_repid = sy-repid.
      PERFORM build_fieldcatlog USING i_fieldcat.
      PERFORM event_call.
      PERFORM populate_event.
    START-OF-SELECTION.
      PERFORM data_retrieval.
      PERFORM build_listheader USING it_listheader.
      PERFORM display_alv_report.
    *&      Form  BUILD_FIELDCATLOG
          text
    -->  p1        text
    <--  p2        text
    FORM build_fieldcatlog USING temp_fieldcat TYPE slis_t_fieldcat_alv.
      DATA : wa_temp_fieldcat TYPE slis_fieldcat_alv.
      wa_temp_fieldcat-tabname = 'IT0001'.
      wa_temp_fieldcat-fieldname = 'PERNR'.
      wa_temp_fieldcat-seltext_m = 'Personnel Number'.
      APPEND wa_temp_fieldcat TO temp_fieldcat.
      CLEAR wa_temp_fieldcat.
      wa_temp_fieldcat-tabname = 'IT0001'.
      wa_temp_fieldcat-fieldname = 'ENAME'.
      wa_temp_fieldcat-seltext_m = 'Name'.
      APPEND wa_temp_fieldcat TO temp_fieldcat.
      CLEAR wa_temp_fieldcat.
    ENDFORM.                    " BUILD_FIELDCATLOG
    *&      Form  EVENT_CALL
          text
    -->  p1        text
    <--  p2        text
    FORM event_call.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
            EXPORTING
               i_list_type     = 0
            IMPORTING
               et_events       = v_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.                    " EVENT_CALL
    *&      Form  POPULATE_EVENT
          text
    -->  p1        text
    <--  p2        text
    FORM populate_event.
      READ TABLE v_events INTO wa_event WITH KEY name = 'TOP_OF_PAGE'.
      IF sy-subrc EQ 0.
        wa_event-form = 'TOP_OF_PAGE'.
        MODIFY v_events FROM wa_event TRANSPORTING form WHERE name =
    wa_event-form.
      ENDIF.
      READ TABLE v_events INTO wa_event WITH KEY name = 'USER_COMMAND'.
      IF sy-subrc EQ 0.
        wa_event-form = 'USER_COMMAND'.
        MODIFY v_events FROM wa_event TRANSPORTING form WHERE name =
    wa_event-name.
      ENDIF.
    ENDFORM.                    " POPULATE_EVENT
    *&      Form  DATA_RETRIEVAL
          text
    -->  p1        text
    <--  p2        text
    FORM data_retrieval.
      SELECT pernr ename
             FROM pa0001
             INTO TABLE it0001
             WHERE pernr IN s_pernr.
      DELETE ADJACENT DUPLICATES FROM it0001.
    ENDFORM.                    " DATA_RETRIEVAL
    *&      Form  BUILD_LISTHEADER
          text
         -->P_IT_LISTHEADER  text
    FORM build_listheader USING i_listheader TYPE slis_t_listheader.
      DATA hline TYPE slis_listheader.
      hline-info = 'This is Interactive ALV Program.'.
      hline-typ = 'H'.
      APPEND hline TO i_listheader.
    ENDFORM.                    " BUILD_LISTHEADER
    *&      Form  DISPLAY_ALV_REPORT
          text
    -->  p1        text
    <--  p2        text
    FORM display_alv_report.
      v_repid = sy-repid.
      alv_layout-colwidth_optimize = 'X'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
         i_callback_program                = v_repid
      I_CALLBACK_PF_STATUS_SET          = ' '
         i_callback_user_command           = 'USER_COMMAND'
         i_callback_top_of_page            = 'TOP_OF_PAGE'
         i_grid_title                      = i_title_0001
      I_GRID_SETTINGS                   =
       is_layout                         = alv_layout
         it_fieldcat                       = i_fieldcat[]
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
        i_default                         = 'ZLAY1'
         i_save                            = 'A'
        is_variant                        = i_variant
         it_events                         = v_events
        TABLES
          t_outtab                          = it0001
    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.
      REFRESH i_fieldcat.
      CLEAR i_fieldcat.
      REFRESH it_listheader.
      CLEAR it_listheader.
    ENDFORM.                    " DISPLAY_ALV_REPORT
    *&      Form  TOP_OF_PAGE
          text
    FORM top_of_page.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary       = it_listheader
       i_logo                   =
       I_END_OF_LIST_GRID       =
    ENDFORM.                    "TOP_OF_PAGE
    *&      Form  USER_COMMAND
          text
         -->R_UCOMM    text
         -->,          text
         -->RS_SLEFIELDtext
    FORM user_command USING r_ucomm LIKE sy-ucomm
    rs_selfield TYPE slis_selfield.
      REFRESH i_fieldcat1.
      REFRESH it_listheader1.
      CASE r_ucomm.
        WHEN '&IC1'.
          READ TABLE it0001 INDEX rs_selfield-tabindex.
          IF sy-subrc = 0.
            temp_pernr = it0001-pernr.
            PERFORM build_fieldcatlog_0000 USING i_fieldcat1.
            PERFORM event_call_0000.
            PERFORM populate_event_0000.
            PERFORM data_retrieval_0000.
            PERFORM build_listheader_0000 USING it_listheader1.
            PERFORM display_alv_0000.
          ENDIF.
      ENDCASE.
    ENDFORM.                    "user_command
    *&      Form  BUILD_FIELDCATLOG_0000
          text
    -->  p1        text
    <--  p2        text
    FORM build_fieldcatlog_0000 USING temp_fieldcat TYPE slis_t_fieldcat_alv
      DATA : wa_temp_fieldcat TYPE slis_fieldcat_alv.
      wa_temp_fieldcat-tabname = 'IT0000'.
      wa_temp_fieldcat-fieldname = 'BEGDA'.
      wa_temp_fieldcat-seltext_m = 'From Date'.
      APPEND wa_temp_fieldcat TO temp_fieldcat.
      CLEAR wa_temp_fieldcat.
      wa_temp_fieldcat-tabname = 'IT0000'.
      wa_temp_fieldcat-fieldname = 'ENDDA'.
      wa_temp_fieldcat-seltext_m = 'To Date'.
      APPEND wa_temp_fieldcat TO temp_fieldcat.
      CLEAR wa_temp_fieldcat.
      wa_temp_fieldcat-tabname = 'IT0000'.
      wa_temp_fieldcat-fieldname = 'MASSN'.
      wa_temp_fieldcat-seltext_m = 'Action'.
      APPEND wa_temp_fieldcat TO temp_fieldcat.
      CLEAR wa_temp_fieldcat.
      wa_temp_fieldcat-tabname = 'IT0000'.
      wa_temp_fieldcat-fieldname = 'MASSG'.
      wa_temp_fieldcat-seltext_m = 'Reason'.
      APPEND wa_temp_fieldcat TO temp_fieldcat.
      CLEAR wa_temp_fieldcat.
      wa_temp_fieldcat-tabname = 'IT0000'.
      wa_temp_fieldcat-fieldname = 'AEDTM'.
      wa_temp_fieldcat-seltext_m = 'Action Run On'.
      APPEND wa_temp_fieldcat TO temp_fieldcat.
      CLEAR wa_temp_fieldcat.
    ENDFORM.                    " BUILD_FIELDCATLOG
    *&      Form  EVENT_CALL_0000
          text
    -->  p1        text
    <--  p2        text
    FORM event_call_0000.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
       EXPORTING
         i_list_type           = 0
       IMPORTING
         et_events             = v_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.                    " EVENT_CALL_0000
    *&      Form  POPULATE_EVENT_0000
          text
    -->  p1        text
    <--  p2        text
    FORM populate_event_0000.
      READ TABLE v_events INTO wa_event WITH KEY name = 'TOP_OF_PAGE'.
      IF sy-subrc EQ 0.
        wa_event-form = 'F_TOP_OF_PAGE'.
        MODIFY v_events FROM wa_event TRANSPORTING form WHERE name =
    wa_event-form.
      ENDIF.
    ENDFORM.                    " POPULATE_EVENT_0000
    *&      Form  TOP_OF_PAGE
          text
    FORM f_top_of_page.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary       = it_listheader1
       i_logo                   =
       I_END_OF_LIST_GRID       =
    ENDFORM.                    "TOP_OF_PAGE
    *&      Form  USER_COMMAND
          text
         -->R_UCOMM    text
         -->,          text
         -->RS_SLEFIELDtext
    *retreiving values from the database table ekko
    FORM data_retrieval_0000.
      SELECT pernr begda endda massn massg aedtm
             FROM pa0000
             INTO TABLE it0000
             WHERE pernr = temp_pernr.
    ENDFORM.
    *&      Form  BUILD_LISTHEADER_0000
          text
         -->P_IT_LISTHEADER  text
    FORM build_listheader_0000 USING i_listheader1 TYPE slis_t_listheader.
      DATA: hline1 TYPE slis_listheader.
      hline1-typ = 'H'.
      hline1-info = 'Actions Detail List'.
      APPEND hline1 TO i_listheader1.
    ENDFORM.                    " BUILD_LISTHEADER_0000
    *&      Form  DISPLAY_ALV_0000
          text
    -->  p1        text
    <--  p2        text
    FORM display_alv_0000.
      CONCATENATE 'Actions For Personnel Number ' temp_pernr
                   INTO i_title_0000 SEPARATED BY ' '.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
         i_callback_program                = v_repid
      I_CALLBACK_PF_STATUS_SET          = ' '
      I_CALLBACK_USER_COMMAND           = 'F_USER_COMMAND'
         i_callback_top_of_page            = 'F_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_title_0000
      I_GRID_SETTINGS                   =
       is_layout                          = alv_layout
         it_fieldcat                      = i_fieldcat1[]
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         =
         i_save                            = 'A'
      IS_VARIANT                        =
         it_events                         = v_events
        TABLES
          t_outtab                          = it0000
       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.                    " DISPLAY_ALV_0000
    Regards,
    Tejas

  • How to insert horizontal lines in alv report?

    hi,
        i have to insert horizontal lines in alv report.( RM07MLBB )
            actually my requirement is:
                               basis list = RM07MLBB.
    first secondary list = another report is called here ( RM07DOCS )
                      i want to insert horizontal lines in the first secondary list, when i execute individually RM07DOCS , i can get horizontal lines, but when i dounle click in the basic list --> in the first secondary list , i am not getting the horizontal lnes.
    functional modules used are REUSE_ALV_HIERSEQ_LIST_DISPLAY & REUSE_ALV_GRID_DISPLAY.
        here in this program,
                        is_layout = alv_layout.
    hence i tried to give     
                  alv_layout-no_hline = ' '. 
    but not effecting.
              can some one please tell me , how to insert lines in the alv report.
    thanks in advance,
    Dastagir.

    hello,
         so i cannot insert horizontal lines in the first secondary list according to my sorting condition, i.e., in a single block there should be :
           if same delivery challan number is repeating they should come in the same block,
    for the corresponding delivery challen number, if have po number, is repeating , they also should come in the same block.
                       in this way i have to seperate the blocks containing EXNUM , EBELN CONDITIONED.

  • How to create check box in ALV Reports?

    how to create check box in ALV Reports?

    Hi
    check the report  BCALV_TEST_GRID_EDITABLE
    or
    check this report
    REPORT ZRFC346_TST.
    TABLES:SFLIGHT,RL034.
    TYPE-POOLS:SLIS.
    INCLUDE:<ICON>,<SYMBOL>.
    DATA: G_REPID          LIKE SY-REPID,
          G_FIELDCAT       TYPE SLIS_T_FIELDCAT_ALV,
          G_IT_SORT        TYPE SLIS_T_SORTINFO_ALV,
          G_LAYOUT         TYPE SLIS_LAYOUT_ALV,
          G_TABNAME_HEADER TYPE SLIS_TABNAME,
          G_TABNAME_ITEM   TYPE SLIS_TABNAME,
          G_KEYINFO        TYPE SLIS_KEYINFO_ALV,
          G_VARIANT        LIKE DISVARIANT,
          G_EXTAB          TYPE SLIS_T_EXTAB,
          I_SLIS_EXIT_BY_USER TYPE SLIS_EXIT_BY_USER.
    DATA: XEVENT         TYPE SLIS_T_EVENT,
          AEVENT         TYPE SLIS_ALV_EVENT,
          VARIANT        LIKE DISVARIANT,
          LAYOUT         TYPE SLIS_LAYOUT_ALV,
          ASP_GROUP      TYPE SLIS_SP_GROUP_ALV,
          GT_SP_GROUP TYPE SLIS_T_SP_GROUP_ALV,
          EXTAB          TYPE SLIS_T_EXTAB WITH HEADER LINE,
          XFIELD         TYPE SLIS_T_FIELDCAT_ALV,
          AFIELD         TYPE SLIS_FIELDCAT_ALV,
          G_SUCOMM      LIKE SY-UCOMM,
          G_SELFLD       TYPE SLIS_SELFIELD.
    DATA: SAV_SY_REPID      LIKE SY-REPID.
    CONSTANTS: CON_SFLIGHT TYPE LVC_FNAME VALUE 'SFLIGHT',
               CON_DISPLAY_FULL TYPE I VALUE 3.
    Data to be displayed
    DATA: BEGIN OF GT_SFLIGHT OCCURS 0.
            INCLUDE STRUCTURE SFLIGHT.
    DATA:ACTIVATE(1).
    DATA: END OF GT_SFLIGHT.
    INITIALIZATION.
    *........Initialisierung...............................................
      PERFORM INITIALIZATION_RL034.
    *........Field cata....................................................
      PERFORM FIELD_CAT.
    *........SPECIAL GROUP.................................................
      PERFORM E07_SP_GROUP_BUILD USING GT_SP_GROUP[].
    START-OF-SELECTION.
    Selection
      SELECT * FROM SFLIGHT INTO TABLE GT_SFLIGHT.
    *........ALV CALL.......................................................
      PERFORM ALV_CALL.
      PERFORM USER_COMMAND_LOCAL USING G_SUCOMM G_SELFLD.
          FORM USER_COMMAND_LOCAL                                       *
    -->  G_UCOMM                                                       *
    -->  G_SELFIELD                                                    *
    FORM USER_COMMAND_LOCAL USING G_UCOMM LIKE SY-UCOMM
                                  G_SELFIELD TYPE SLIS_SELFIELD.
      CASE G_UCOMM.
        WHEN 'ACT'.
      ENDCASE.
    ENDFORM.
          FORM ALV_CALL                                                 *
    FORM ALV_CALL.
    Call ABAP List Viewer (ALV)
    G_LAYOUT-BOX_FIELDNAME = 'ACTIVATE'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
                 EXPORTING
                I_BACKGROUND_ID         = 'ALV_BACKGROUND'
                   I_BYPASSING_BUFFER                = SPACE
                   I_BUFFER_ACTIVE                   = SPACE
                    I_CALLBACK_PROGRAM                = SAV_SY_REPID
                    I_CALLBACK_PF_STATUS_SET          = 'STATUS'
                   I_CALLBACK_USER_COMMAND           = 'USER_COMMAND_LOCAL'
                I_CALLBACK_TOP_OF_PAGE            = ' '
                I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
                I_CALLBACK_HTML_END_OF_LIST       = ' '
                 I_STRUCTURE_NAME                  = 'SFLIGHT'
                I_BACKGROUND_ID                   = ' '
                I_GRID_TITLE                      =
                I_GRID_SETTINGS                   =
                  IS_LAYOUT                         = G_LAYOUT
                  IT_FIELDCAT                       = XFIELD[]
                IT_EXCLUDING                      =
                  IT_SPECIAL_GROUPS                 = GT_SP_GROUP[]
                IT_SORT                           =
                IT_FILTER                         =
                 IS_SEL_HIDE                       = 'X'
                I_DEFAULT                         = 'X'
                  I_SAVE                            = 'A'
                IS_VARIANT                        =
                 IT_EVENTS                         = XEVENT
                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
                IT_ALV_GRAPHICS                   =
                IT_ADD_FIELDCAT                   =
                IT_HYPERLINK                      =
                I_HTML_HEIGHT_TOP                 =
                I_HTML_HEIGHT_END                 =
                IT_EXCEPT_QINFO                   =
              IMPORTING
                E_EXIT_CAUSED_BY_CALLER           =
                ES_EXIT_CAUSED_BY_USER            =
                  TABLES
                    T_OUTTAB                          = GT_SFLIGHT
              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.
          FORM status                                                   *
    -->  EXTAB                                                         *
    FORM STATUS USING EXTAB TYPE SLIS_T_EXTAB.
      SET PF-STATUS 'STAT' EXCLUDING EXTAB.
    ENDFORM.                               " STATUS
    *&      Form  INITIALIZATION_RL034
          text
    -->  p1        text
    <--  p2        text
    FORM INITIALIZATION_RL034.
      SAV_SY_REPID = SY-REPID.
    ENDFORM.                    " INITIALIZATION_RL034
    *&      Form  DEFINE_EVENTS_RL034
          text
    -->  p1        text
    <--  p2        text
    FORM DEFINE_EVENTS_RL034.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
           EXPORTING
                I_LIST_TYPE = 0
           IMPORTING
                ET_EVENTS   = XEVENT.
       exceptions
            list_type_wrong = 1
            others          = 2.
    ENDFORM.                    " DEFINE_EVENTS_RL034
    *&      Form  FIELD_CAT
          text
    -->  p1        text
    <--  p2        text
    FORM FIELD_CAT.
      DATA: LS_FCAT TYPE SLIS_FIELDCAT_ALV,
            L_LIN   TYPE I.
      REFRESH XFIELD.
           1. per Default eingeblendete Felder                          *
    *........Ikone/Symbol..................................................
      CLEAR AFIELD.
      DATA: LS1_FCAT TYPE SLIS_FIELDCAT_ALV,
            L_LIN1   TYPE I.
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
           EXPORTING
                I_STRUCTURE_NAME       = CON_SFLIGHT
                I_BYPASSING_BUFFER     = SPACE
                I_BUFFER_ACTIVE        = SPACE
           CHANGING
                CT_FIELDCAT            = XFIELD
           EXCEPTIONS
                INCONSISTENT_INTERFACE = 1
                PROGRAM_ERROR          = 2
                OTHERS                 = 3.
      DESCRIBE TABLE XFIELD LINES L_LIN1.
      ADD 1 TO L_LIN1.
      CLEAR LS_FCAT.
      LS1_FCAT-FIELDNAME = 'ACTIVATE'.
      LS1_FCAT-CHECKBOX  = 'X'.
    LS1_FCAT-KEY       = 'X'.
      LS1_FCAT-INPUT     = 'X'.
      LS1_FCAT-EDIT     = 'X'.
      LS1_FCAT-INTTYPE   = 'C'.
      LS1_FCAT-DATATYPE  = 'CHAR'.
      LS1_FCAT-INTLEN    = 1.
      LS1_FCAT-COL_POS   = L_LIN1.
      LS1_FCAT-SELTEXT_S = LS1_FCAT-FIELDNAME.
      LS1_FCAT-SELTEXT_M = LS1_FCAT-FIELDNAME.
      LS1_FCAT-SELTEXT_L = LS1_FCAT-FIELDNAME.
      LS1_FCAT-SP_GROUP = 'A'.
      APPEND LS1_FCAT TO XFIELD.
      ADD 1 TO L_LIN.
    ENDFORM.                    " FIELD_CAT
    FORM E07_SP_GROUP_BUILD USING E07_LT_SP_GROUP TYPE SLIS_T_SP_GROUP_ALV.
      DATA: LS_SP_GROUP TYPE SLIS_SP_GROUP_ALV.
      CLEAR  LS_SP_GROUP.
      LS_SP_GROUP-SP_GROUP = 'A'.
      LS_SP_GROUP-TEXT     = 'SPECIAL'.
      APPEND LS_SP_GROUP TO E07_LT_SP_GROUP.
    ENDFORM.
    Regards
    Shiva

  • Interactive list in ALV

    Hi All,
    Is there any sample program for an interactive list in ALV? I would like to try an interactive ALV list option for one of my reports
    Thanks

    One more example - ALV Interactive ( two times REUSE_ALV_GRID_DISPLAY )
    REPORT  ZZ_22038_22098_002 NO STANDARD PAGE HEADING LINE-SIZE 650
    MESSAGE-ID ZZ_9838                      .
    TYPE-POOLS: SLIS.
    *type declaration for values from ekko
    TYPES: BEGIN OF I_EKKO,
           EBELN LIKE EKKO-EBELN,
           AEDAT LIKE EKKO-AEDAT,
           BUKRS LIKE EKKO-BUKRS,
           BSART LIKE EKKO-BSART,
           LIFNR LIKE EKKO-LIFNR,
           END OF I_EKKO.
    DATA: IT_EKKO TYPE STANDARD TABLE OF I_EKKO INITIAL SIZE 0,
          WA_EKKO TYPE I_EKKO.
    *type declaration for values from ekpo
    TYPES: BEGIN OF I_EKPO,
           EBELN LIKE EKPO-EBELN,
           EBELP LIKE EKPO-EBELP,
           MATNR LIKE EKPO-MATNR,
           MENGE LIKE EKPO-MENGE,
           MEINS LIKE EKPO-MEINS,
           NETPR LIKE EKPO-NETPR,
           END OF I_EKPO.
    DATA: IT_EKPO TYPE STANDARD TABLE OF I_EKPO INITIAL SIZE 0,
          WA_EKPO TYPE I_EKPO .
    *variable for Report ID
    DATA: V_REPID LIKE SY-REPID .
    *declaration for fieldcatalog
    DATA: I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
          WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
    DATA: IT_LISTHEADER TYPE SLIS_T_LISTHEADER.
    declaration for events table where user comand or set PF status will
    be defined
    DATA: V_EVENTS TYPE SLIS_T_EVENT,
          WA_EVENT TYPE SLIS_ALV_EVENT.
    declartion for layout
    DATA: ALV_LAYOUT TYPE SLIS_LAYOUT_ALV.
    declaration for variant(type of display we want)
    DATA: I_VARIANT TYPE DISVARIANT,
          I_VARIANT1 TYPE DISVARIANT,
          I_SAVE(1) TYPE C.
    *PARAMETERS : p_var TYPE disvariant-variant.
    *Title displayed when the alv list is displayed
    DATA:  I_TITLE_EKKO TYPE LVC_TITLE VALUE 'FIRST LIST DISPLAYED'.
    DATA:  I_TITLE_EKPO TYPE LVC_TITLE VALUE 'SECONDRY LIST DISPLAYED'.
    INITIALIZATION.
      V_REPID = SY-REPID.
      PERFORM BUILD_FIELDCATLOG.
      PERFORM EVENT_CALL.
      PERFORM POPULATE_EVENT.
    START-OF-SELECTION.
      PERFORM DATA_RETRIEVAL.
      PERFORM BUILD_LISTHEADER USING IT_LISTHEADER.
      PERFORM DISPLAY_ALV_REPORT.
    *&      Form  BUILD_FIELDCATLOG
          Fieldcatalog has all the field details from ekko
    FORM BUILD_FIELDCATLOG.
      WA_FIELDCAT-TABNAME = 'IT_EKKO'.
      WA_FIELDCAT-FIELDNAME = 'EBELN'.
      WA_FIELDCAT-SELTEXT_M = 'PO NO.'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'IT_EKKO'.
      WA_FIELDCAT-FIELDNAME = 'AEDAT'.
      WA_FIELDCAT-SELTEXT_M = 'DATE.'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'IT_EKKO'.
      WA_FIELDCAT-FIELDNAME = 'BUKRS'.
      WA_FIELDCAT-SELTEXT_M = 'COMPANY CODE'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'IT_EKKO'.
      WA_FIELDCAT-FIELDNAME = 'BUKRS'.
      WA_FIELDCAT-SELTEXT_M = 'DOCMENT TYPE'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'IT_EKKO'.
      WA_FIELDCAT-FIELDNAME = 'LIFNR'.
      WA_FIELDCAT-NO_OUT    = 'X'.
      WA_FIELDCAT-SELTEXT_M = 'VENDOR CODE'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    ENDFORM.                    "BUILD_FIELDCATLOG
    *&      Form  EVENT_CALL
      we get all events - TOP OF PAGE or USER COMMAND in table v_events
    FORM EVENT_CALL.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
       EXPORTING
         I_LIST_TYPE           = 0
       IMPORTING
         ET_EVENTS             = V_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.                    "EVENT_CALL
    *&      Form  POPULATE_EVENT
         Events populated for TOP OF PAGE & USER COMAND
    FORM POPULATE_EVENT.
      READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
      IF SY-SUBRC EQ 0.
        WA_EVENT-FORM = 'TOP_OF_PAGE'.
        MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
    WA_EVENT-FORM.
      ENDIF.
      READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'USER_COMMAND'.
      IF SY-SUBRC EQ 0.
        WA_EVENT-FORM = 'USER_COMMAND'.
        MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
    WA_EVENT-NAME.
      ENDIF.
    ENDFORM.                    "POPULATE_EVENT
    *&      Form  data_retrieval
      retreiving values from the database table ekko
    FORM DATA_RETRIEVAL.
      SELECT EBELN AEDAT BUKRS BSART LIFNR FROM EKKO INTO TABLE IT_EKKO.
    ENDFORM.                    "data_retrieval
    *&      Form  bUild_listheader
          text
         -->I_LISTHEADEtext
    FORM BUILD_LISTHEADER USING I_LISTHEADER TYPE SLIS_T_LISTHEADER.
      DATA HLINE TYPE SLIS_LISTHEADER.
      HLINE-INFO = 'this is my first alv pgm'.
      HLINE-TYP = 'H'.
    ENDFORM.                    "build_listheader
    *&      Form  display_alv_report
          text
    FORM DISPLAY_ALV_REPORT.
      V_REPID = SY-REPID.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
         I_CALLBACK_PROGRAM                = V_REPID
      I_CALLBACK_PF_STATUS_SET          = ' '
         I_CALLBACK_USER_COMMAND           = 'USER_COMMAND'
         I_CALLBACK_TOP_OF_PAGE            = 'TOP_OF_PAGE'
         I_GRID_TITLE                      = I_TITLE_EKKO
      I_GRID_SETTINGS                   =
      IS_LAYOUT                         = ALV_LAYOUT
         IT_FIELDCAT                       = I_FIELDCAT[]
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
        i_default                         = 'ZLAY1'
         I_SAVE                            = 'A'
        is_variant                        = i_variant
         IT_EVENTS                         = V_EVENTS
        TABLES
          T_OUTTAB                          = IT_EKKO
    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.                    "display_alv_report
    *&      Form  TOP_OF_PAGE
          text
    FORM TOP_OF_PAGE.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          IT_LIST_COMMENTARY       = IT_LISTHEADER
       i_logo                   =
       I_END_OF_LIST_GRID       =
    ENDFORM.                    "TOP_OF_PAGE
    *&      Form  USER_COMMAND
          text
         -->R_UCOMM    text
         -->,          text
         -->RS_SLEFIELDtext
    FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
    RS_SELFIELD TYPE SLIS_SELFIELD.
      CASE R_UCOMM.
        WHEN '&IC1'.
          READ TABLE IT_EKKO INTO WA_EKKO INDEX RS_SELFIELD-TABINDEX.
          PERFORM BUILD_FIELDCATLOG_EKPO.
          PERFORM EVENT_CALL_EKPO.
          PERFORM POPULATE_EVENT_EKPO.
          PERFORM DATA_RETRIEVAL_EKPO.
          PERFORM BUILD_LISTHEADER_EKPO USING IT_LISTHEADER.
          PERFORM DISPLAY_ALV_EKPO.
      ENDCASE.
    ENDFORM.                    "user_command
    *&      Form  BUILD_FIELDCATLOG_EKPO
          text
    FORM BUILD_FIELDCATLOG_EKPO.
      WA_FIELDCAT-TABNAME = 'IT_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'EBELN'.
      WA_FIELDCAT-SELTEXT_M = 'PO NO.'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'IT_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'EBELP'.
      WA_FIELDCAT-SELTEXT_M = 'LINE NO'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'I_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'MATNR'.
      WA_FIELDCAT-SELTEXT_M = 'MATERIAL NO.'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'I_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'MENGE'.
      WA_FIELDCAT-SELTEXT_M = 'QUANTITY'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'I_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'MEINS'.
      WA_FIELDCAT-SELTEXT_M = 'UOM'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'I_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'NETPR'.
      WA_FIELDCAT-SELTEXT_M = 'PRICE'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    ENDFORM.                    "BUILD_FIELDCATLOG_EKPO
    *&      Form  event_call_ekpo
      we get all events - TOP OF PAGE or USER COMMAND in table v_events
    FORM EVENT_CALL_EKPO.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
       EXPORTING
         I_LIST_TYPE           = 0
       IMPORTING
         ET_EVENTS             = V_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.                    "event_call_ekpo
    *&      Form  POPULATE_EVENT
           Events populated for TOP OF PAGE & USER COMAND
    FORM POPULATE_EVENT_EKPO.
      READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
      IF SY-SUBRC EQ 0.
        WA_EVENT-FORM = 'TOP_OF_PAGE'.
        MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
    WA_EVENT-FORM.
      ENDIF.
      ENDFORM.                    "POPULATE_EVENT
    *&      Form  TOP_OF_PAGE
          text
    FORM F_TOP_OF_PAGE.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          IT_LIST_COMMENTARY       = IT_LISTHEADER
       i_logo                   =
       I_END_OF_LIST_GRID       =
    ENDFORM.                    "TOP_OF_PAGE
    *&      Form  USER_COMMAND
          text
         -->R_UCOMM    text
         -->,          text
         -->RS_SLEFIELDtext
    *retreiving values from the database table ekko
    FORM DATA_RETRIEVAL_EKPO.
    SELECT EBELN EBELP MATNR MENGE MEINS NETPR FROM EKPO INTO TABLE IT_EKPO.
    ENDFORM.
    FORM BUILD_LISTHEADER_EKPO USING I_LISTHEADER TYPE SLIS_T_LISTHEADER.
    DATA: HLINE1 TYPE SLIS_LISTHEADER.
    HLINE1-TYP = 'H'.
    HLINE1-INFO = 'CHECKING PGM'.
    ENDFORM.
    FORM DISPLAY_ALV_EKPO.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
       I_CALLBACK_PROGRAM                = V_REPID
      I_CALLBACK_PF_STATUS_SET          = ' '
      I_CALLBACK_USER_COMMAND           = 'F_USER_COMMAND'
       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_TITLE_EKPO
      I_GRID_SETTINGS                   =
      IS_LAYOUT                         =
       IT_FIELDCAT                       = I_FIELDCAT[]
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         =
       I_SAVE                            = 'A'
      IS_VARIANT                        =
       IT_EVENTS                         = V_EVENTS
      TABLES
        T_OUTTAB                          = IT_EKPO
    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.

  • How to select multiple row in ALV report

    Hi friends,
    1. How to select multiple row in ALV report
                   ( How to set tab in ALV report and want to select multiple line.)
    Thanking you.
    Subash

    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.

  • How to find the list of Queries/Reports which are using Exceptional Aggregation in SAP BI?

    Hi All,
    We are interested to know how to find the list of Queries/ Reports which are using Exceptional aggregation in SAP BI.
    Please let us know is there any table's to check the list of reports using Exceptional Aggregation in SAP BI.

    Hi,
    Here you go..
    1) Go to table RSZCALC and get list of ELTUID where AGGREXC is not INITIAL and AGGRCHA is not initial; now you get only exception aggregation set based on some chars. Also you can further add STEPNR = 1 since your intention is just to get query name , not the calculation details; this will reduce number of entries to lookup and save DB time for next steps.
    Here you will get list of exception aggregation UUID numbers from which you can get properties from RSZELTDIR.
    2) Pass list of RSZCALC-ELTUID to table RSZELTXREF - TELTUID and get list of RSZELTXREF -SELTUID - this table stores query to it's elements maping kind.
    3) Now again pass RSZELTXREF - SELTUID into same table but into different field RSZELTZREF - TELTUID and get RSZELTXREF - SELTUID
    This step you get query reference sheet or column or query general UUID for next step.
    4) Pass list of RSZELTXREF - SELTUID into RSZELTDIR - ELTUID with DEFTP as 'REP'. Now you get list of query names in RSZELTDIR - MAPNAME and description in TXTLG.
    Note: you can also get the reference chars used for exception aggregation from RSZCALC - AGGRCHA field.
    Hope this helps.
    Please keep in mind, it might take more time depends on how many query elements you have in the system...
    Comments added for better DB performance by: Arun Thangaraj

  • Can anyone tell me how to use GUI status in ALV report.

    Can anyone tell me how to use GUI status in ALV report. I want to use  buttons in ALV report.

    Juheb,
    see the link
    http://help.sap.com/saphelp_nw2004s/helpdata/en/5e/88d440e14f8431e10000000a1550b0/frameset.htm
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVALV/BCSRVALV.pdf
    Adding a button on the ALV grid using OOPs
    check these sites.
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/webDynproABAP-ALVControllingStandard+Buttons&
    chk this.
    alv-pfstatus:
    http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_pfstatus.htm
    then how to capture that button click.
    http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_ucomm.htm
    REPORT ZTESTALV.
    TYPE-POOLS: SLIS.
    *- Fieldcatalog
    DATA: IT_FIELDCAT  TYPE LVC_T_FCAT,
          IT_FIELDCAT1  TYPE SLIS_T_FIELDCAT_ALV..
    *- For Events
    DATA:IT_EVENTS TYPE SLIS_T_EVENT.
    DATA:  X_FIELDCAT  TYPE LVC_S_FCAT,
            X_FIELDCAT1  TYPE SLIS_FIELDCAT_ALV.
    DATA:X_LAYOUT TYPE LVC_S_LAYO.
    "{ FOR DISABLE
    DATA: LS_EDIT TYPE LVC_S_STYL,
          LT_EDIT TYPE LVC_T_STYL.
    "} FOR DISABLE
    DATA: BEGIN OF IT_VBAP OCCURS 0,
          VBELN LIKE VBAP-VBELN,
          POSNR LIKE VBAP-POSNR,
          HANDLE_STYLE TYPE LVC_T_STYL, "FOR DISABLE
       <b>   BUTTON(10),</b>
         END OF IT_VBAP.
    DATA: LS_OUTTAB LIKE LINE OF IT_VBAP.
    SELECT VBELN
           POSNR
           UP TO 10 ROWS
          INTO CORRESPONDING FIELDS OF TABLE IT_VBAP
          FROM VBAP.
    DATA:L_POS TYPE I VALUE 1.
    CLEAR: L_POS.
    L_POS = L_POS + 1.
    <b>X_FIELDCAT-SELTEXT = 'Button'.
    x_fieldcat-fieldname = 'BUTTON'.
    X_FIELDCAT-TABNAME = 'ITAB'.
    X_FIELDCAT-COL_POS    = L_POS.
    X_FIELDCAT-OUTPUTLEN = '10'.
    X_FIELDCAT-style = X_FIELDCAT-style bit-xor
                      cl_gui_alv_grid=>MC_STYLE_BUTTON bit-xor
                      cl_gui_alv_grid=>MC_STYLE_ENABLEd.
    APPEND X_FIELDCAT TO IT_FIELDCAT.
    CLEAR X_FIELDCAT.</b>
    L_POS = L_POS + 1.
    X_FIELDCAT-SELTEXT = 'VBELN'.
    X_FIELDCAT-FIELDNAME = 'VBELN'.
    X_FIELDCAT-TABNAME = 'ITAB'.
    X_FIELDCAT-COL_POS    = L_POS.
    X_FIELDCAT-EDIT = 'X'.
    X_FIELDCAT-OUTPUTLEN = '10'.
    x_fieldcat-ref_field = 'VBELN'.
    x_fieldcat-ref_table = 'VBAK'.
    APPEND X_FIELDCAT TO IT_FIELDCAT.
    CLEAR X_FIELDCAT.
    L_POS = L_POS + 1.
    X_FIELDCAT-SELTEXT = 'POSNR'.
    X_FIELDCAT-FIELDNAME = 'POSNR'.
    X_FIELDCAT-TABNAME = 'ITAB'.
    X_FIELDCAT-COL_POS    = L_POS.
    X_FIELDCAT-EDIT = 'X'.
    X_FIELDCAT-OUTPUTLEN = '5'.
    APPEND X_FIELDCAT TO IT_FIELDCAT.
    CLEAR X_FIELDCAT.
    L_POS = L_POS + 1.
    "{FOR DISABLE HERE 6ROW IS DISABLED
    SY-TABIX = 6.
    LS_EDIT-FIELDNAME = 'VBELN'.
    LS_EDIT-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.
    LS_EDIT-STYLE2 = SPACE.
    LS_EDIT-STYLE3 = SPACE.
    LS_EDIT-STYLE4 = SPACE.
    LS_EDIT-MAXLEN = 10.
    INSERT LS_EDIT INTO TABLE LT_EDIT.
    *LS_EDIT-FIELDNAME = 'POSNR'.
    *LS_EDIT-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.
    *LS_EDIT-STYLE2 = SPACE.
    *LS_EDIT-STYLE3 = SPACE.
    *LS_EDIT-STYLE4 = SPACE.
    *LS_EDIT-MAXLEN = 6.
    *INSERT LS_EDIT INTO TABLE LT_EDIT.
    INSERT LINES OF LT_EDIT INTO TABLE LS_OUTTAB-HANDLE_STYLE.
    MODIFY IT_VBAP INDEX SY-TABIX FROM LS_OUTTAB  TRANSPORTING
                                      HANDLE_STYLE .
    X_LAYOUT-STYLEFNAME = 'HANDLE_STYLE'.
    "} UP TO HERE
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
      EXPORTING
        I_CALLBACK_PROGRAM = SY-REPID
        IS_LAYOUT_LVC      = X_LAYOUT
        IT_FIELDCAT_LVC    = IT_FIELDCAT
      TABLES
        T_OUTTAB           = IT_VBAP[]
      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.
    Don't forget to reward if useful....

  • Reg : Dynamic Drown list in ALV Report

    Hi Guru's,
    Please help on showing Dynamic drop down list in ALV Report.
    My requirement is to show sales partner function in ALV report for each and every line.Every line item may have different partner function.
    Regards
    P.Senthil Kumar

    ok

  • Regarding Interactive  list in alv

    Hi Experts,
    I want to know how to do a inteactive report in alv.
    For example: First i will display a alv list. Then when i double click on a field of a line or click on button (Details) by selecting  a line ,  then it will navigate me to the alv list with corresponding records where i clicked previously.
    How to use buttons in this case as we r using in simple interactive report.
    Can anyone pls help me in creating a simple example for the above???
    Thanks
    Sudhansu

    Hi,
    Example for Interactive ALV report.
    Please reward if useful.
    report  zreport no standard page heading
                                    message-id zw.
    Type Pools                                                           *
    type-pools: icon, slis.
    Tables                                                               *
    tables: tvst,
            likp,
            t30b,
            vekp,
            zpallettr,
            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
         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
         zeod_print  like zvantr-zeod_print,      " eod manifest print
         zzpackclass like vekp-zzpackclass,       " package class
         zzti        like vekp-zzti,              " T.I. value
      end of ty_data.
    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,
          t_disp_head type standard table of zpickhead.
    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.
    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
    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.
    selection-screen end of block b.
    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.
    At Selection Screen                                                  *
    at selection-screen.
      perform validate_selections.
    Initialization                                                       *
    initialization.
    Start of selection                                                   *
    start-of-selection.
    clear all data tables
      clear: t_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,
               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.
      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
                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_status_reporto01 .
      include zwmr_pick_status_reporti01 .
      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
      select * from likp into table t_likp
                         where vbeln in s_vbeln
                       and   vstel eq p_vstel                 "TR01-
                         and   vstel in p_vstel
                         and   lgtor in s_lgtor
                         and   wadat in s_wadat
                         and   lfart in s_lfart.
      if sy-subrc ne 0.
      no data found
        message i007.
        exit.
      endif.
      if not t_likp[] is initial.
      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 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+
      endif.
      if not t_lips[] is initial.
      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.
      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 * from vepo
                      inner join vekp on vepovenum = vekpvenum
                      appending corresponding fields of table t_vepo
                      for all entries in t_lips
                      where vepo~vbeln = t_lips-vbeln
                      and   vepo~posnr = t_lips-posnr
                      and   vepo~matnr = t_lips-matnr
                      and   vepo~charg = t_lips-charg
                      and   vekp~exidv in s_exidv.
    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.
          select * from zpallettr into table t_pallettr
                                  for all entries in t_vantr
                                  where zpallet_no eq t_vantr-zpallet_no.
                                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   vstel      eq p_vstel."TR01-
      endif.
      if not t_pallettr[] is initial.
      from the pallet nos. we can select the handling units
        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.
      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.
      if not t_likp[] is initial.
      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 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+
      endif.
      if not t_lips[] is initial.
      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.
      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.
      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 t_vepo.
        clear t_data_tab.
      delivery lines.
        clear w_lips.
        read table t_lips with key vbeln = t_vepo-vbeln
                                   posnr = t_vepo-posnr
                                   into w_lips.
        move-corresponding w_lips to t_data_tab.
      sales document line items
        clear w_vbup.
        read table t_vbup with key vbeln = t_vepo-vbeln
                                   posnr = t_vepo-posnr
                                   into w_vbup.
      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 t_vbuk with key vbeln = t_vepo-vbeln
                               into w_vbuk.
        move-corresponding w_vbuk to t_data_tab.
      delivery header
        clear w_likp.
        read table t_likp with key vbeln = t_vepo-vbeln
                               into w_likp.
        move-corresponding w_likp to t_data_tab.
      select handling unit info using vepo entry
        clear w_vekp.
        if t_vekp[] is initial.
          select single * from vekp into w_vekp
                                    where venum = t_vepo-venum.
        else.
          read table t_vekp with key venum = t_vepo-venum
                                     into w_vekp.
          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.
      select pallet / van load information
        select single zpallet_no zcount_check from zpallettr
                                 into (t_data_tab-zpallet_no,
                                       t_data_tab-zcount_check)
                                 where exidv eq w_vekp-exidv.
        if not t_data_tab-zpallet_no in s_palno.                "TR01+
          continue.                                             "TR01+
        endif.                                                  "TR01+
        if sy-subrc = 0.
          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.
          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+
        loop at t_vepo.
          read table t_lips with key vbeln = t_vepo-vbeln
                                     posnr = t_vepo-posnr.
          if sy-subrc = 0.
            delete t_lips index sy-tabix.
          endif.
        endloop.
        if not t_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,
            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.
      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-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.
      w_g_sort-spos      = 4.
      w_g_sort-fieldname = 'WADAT'.
      w_g_sort-tabname   = 't_disp_tab'.
      w_g_sort-up        = c_yes.
      append w_g_sort to g_sort.
    endform.                    " fill_sort
    *&      Form  fill_fieldcat
          Fill field category structure for ALV
    form fill_fieldcat.
      clear t_fldcat.
    create field catalogue for header table
      call function 'REUSE_ALV_FIELDCATALOG_MERGE'
           exporting
                i_program_name         = 'ZWMR_PICK_STATUS_REPORT'
                i_internal_tabname     = 't_disp_head'
                i_structure_name       = 'ZPICKHEAD'
                i_client_never_display = c_yes
           changing
                ct_fieldcat            = gt_fieldcat[].
      if sy-subrc <> 0.
        message id sy-msgid type sy-msgty number sy-msgno
                with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      endif.
    ceate field catalogue for items table
      call function 'REUSE_ALV_FIELDCATALOG_MERGE'
           exporting
                i_program_name         = 'ZWMR_PICK_STATUS_REPORT'
                i_internal_tabname     = 't_disp_tab'
                i_structure_name       = 'ZPICKDISP'
                i_client_never_display = c_yes
           changing
                ct_fieldcat            = gt_fieldcat[].
      if sy-subrc <> 0.
        message id sy-msgid type sy-msgty number sy-msgno
                with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      endif.
    modify field catalogue for this report
    set no display flag if not requested on selection screen
      if p_exdata ne c_yes.
        t_fldcat-no_out    =  c_yes.
        modify gt_fieldcat from t_fldcat transporting no_out
                           where fieldname eq 'PACKVORSCHR'
                           or    fieldname eq 'EXIDV'
                           or    fieldname eq 'ZPALLET_NO'
                           or    fieldname eq 'ZVAN_NO'
                           or    fieldname eq 'ZZPACKCLASS'
                           or    fieldname eq 'ZZTI'.
      endif.
    set no display flag for item level LGTOR field
      t_fldcat-no_out    =  c_yes.
      modify gt_fieldcat from t_fldcat transporting no_out
                         where fieldname eq 'LGTOR'
                         and   tabname   eq 't_disp_tab'.
    prevent display of technical fields
      t_fldcat-tech = c_yes.
      modify gt_fieldcat from t_fldcat transporting tech
                         where fieldname eq 'EXPAND'
                         or    fieldname eq 'SELKZ'.
    set vbeln as key
      t_fldcat-key = c_yes.
      modify gt_fieldcat from t_fldcat transporting key
                         where fieldname eq 'VBELN'.
    prevent scrolling for info fields
      t_fldcat-fix_column = c_yes.
      modify gt_fieldcat from t_fldcat transporting fix_column
                         where fieldname eq 'VBELN'.
    endform.                    " fill_fieldcat
    *&      Form  prepare_ALV
          Fill ALV parameters
    form prepare_alv.
    fill ALV key info
      g_keyinfo-header01 = 'LGTOR'.
      g_keyinfo-item01   = 'LGTOR'.
    fill ALV events
      gs_event-name = 'TOP_OF_PAGE'.
      gs_event-form = 'TOP_OF_PAGE'.
      append gs_event to gt_events.
    fill ALV sort table
      perform fill_sort.
    fill ALV layout structure
      perform fill_layout.
    fill ALV field category
      perform fill_fieldcat.
    endform.                    " prepare_ALV
    *&      Form  user_command
          form called on user command from ALV list
    form user_command using r_ucomm     like sy-ucomm
                            rs_selfield type slis_selfield.
      data: index type i,
            w_disp_head like line of t_disp_head,
            w_door like likp-lgtor.
      clear r_lgtor. refresh r_lgtor.
      case r_ucomm.
        when 'PICK'. " Double click line
        when 'VANM'. " Van Manifest button
        read the header table where has been selected
          loop at t_disp_head into w_disp_head where mark = c_yes.
            r_lgtor-sign   = 'I'.
            r_lgtor-option = 'EQ'.
            r_lgtor-low    = w_disp_head-lgtor.
            append r_lgtor.
          endloop.
        print the van manifest
          perform print_van_manifest tables r_lgtor.
        when 'EODM'. " EOD Manifest button
        read the header table where has been selected
          loop at t_disp_head into w_disp_head where mark = c_yes.
            r_lgtor-sign   = 'I'.
            r_lgtor-option = 'EQ'.
            r_lgtor-low    = w_disp_head-lgtor.
            append r_lgtor.
          endloop.
        print the end of day manifest
          perform print_eod_manifest tables r_lgtor.
        when 'REFR'. "Refresh
        refresh display
          w_sy_repid = sy-repid.
          call function 'RS_REFRESH_FROM_SELECTOPTIONS'
               exporting
                    curr_report     = w_sy_repid
               tables
                    selection_table = seltab.
              exceptions
                  not_found       = 1
                  no_report     

  • How to calculate totals in Blocked ALV Report

    Hi All,
    Can any body tell how to calculate totals & sub totals in
    Blocked ALV Report[Blocked List].
    Thanks in advance
    Thanks & Regards,
    Rayeezuddin.

    read this it might help
    Sums                                                       
    15. No_sumchoice(1) TYPE c : This parameter allows the choice for summing up
    Only by fieldcatalog.
    Value set: SPACE, 'X'
    'X' = fields which are to be summed, passed by the calling program (FIELDCAT-DO_SUM = 'X'). The user should not be able to change this value interactively.
    16. No_totalline(1) TYPE c : Removes the option of having totals after sub-totals.
    Value set: SPACE, 'X'
    'X' = no total record is to be output. Subtotals can still be calculated and output. The fields in the subtotals are flagged DO_SUM = 'X' in the field list.
    17. No_subchoice(1) TYPE c : Does not allow the user to interactively change the field chosen for subtotals.
    Value set: SPACE, 'X'
    'X' = value whose change triggers subtotals, provided by the calling program. The user should not be able to change this value interactively.
    18. No_subtotals(1) TYPE c : No subtotals possible          
    Value set: SPACE, 'X'
    'X' = no subtotals.
    19. Numc_sum(1)  TYPE c : Totals only possible for NUMC-Fields.
    20. No_unit_splitting TYPE c: No separate total lines by inh.units   
    21.totals_before_items TYPE c: Display totals before the items   
    22. Totals_only(1) TYPE c :  Show only totals      
    Value set: SPACE, 'X'
    'X' = only total records are output.
    23. Totals_text(60) TYPE c : Text for 1st col. in totals   
    Value set: SPACE, string (max.60)
    ' ' = The first column in the total record contains an appropriate number of '*'s to indicate the total by default. If the first column is wide enough, the string 'Total' is output after the asterisks.
    'String’ = The string passed is output after the total indicated by '*', if the column is wide enough.
    24. Subtotals_text(60) TYPE c : Texts for subtotals
    Value set: SPACE, string (max.60)
    ' ' = In the first column of subtotal records, the subtotal is indicated by an appropriate number of '*' by default. If the first column is not a subtotal criterion, the string 'Total' is output after the asterisks, if the column is wide enough.
    'String’ = the string passed is output after the subtotal indicated by '*', if the column is wide enough and the first column is not a subtotal criterion. If it is a subtotal criterion, its value is repeated after the total, if the column is wide enough.
    ELSE TELL ME I WILL PASTE COMPLETE HELP
    regards

Maybe you are looking for

  • How to global remove unread message mark in Mail

    I just vacated MS Outlook for Mac to use Mail for the first time. I'm running Mac OS X 10.7.4 and am current on updates. All of the messages in the folders that I moved from Outlook to Mail are marked as unread. I must have 1,000 marked messages. Is

  • Radio button and associated functionality is not working!

    Hi Pros, I am facing the following problem: 1.I have an interactive PDF created in Acrobat 9 Pro. 2.PDF have few radio buttons, each radio buttons ahave assigned valus(eg: 1,2,3 etc) 3.I have a text box in which the value of selected radio button is

  • How to write the code for IMPORT and export in Field exit

    Hi,    Using the FB01 tcode with condition as document type (ZF) and company code i want to substitute values should come in the next screen.       i am passin the document type and the company code in the FB01 initial screen (100) and added field ex

  • Is this a Siri-ism or what? kleptomania while adding files to iTunes

    I have been working on moving my music to a NAS and getting it all to work with a new Mac Mini and an new Apple TV, iPhone, iTouch, etc. using library sharing and Home Sharing. I have most of my music ripped from my personal CD collection along with

  • Desktop Manager v5.0 Crashing on Vista 32-bit with BB Tour

    Hi, When Desktop Manager stops working halfway through the synchronization process. It does not matter if the sync is autoamtic (when the device is connected) or if i start it manually. I am not sure if it is device related (Black Berry Tour 9630) or