Help alv

this is my question.
i have this print
   CID            POSITION
-   01               010
    01               010
    01               010
    01               020
    01               020
    02               020
    02               020
    02               020
in this moment my print:
CID            POSITION
  01               010
                     020
02
  gw_fieldcat-tabname = 'GT_DETTAGLIO'.
  gw_fieldcat-fieldname = 'CID'.
  gw_fieldcat-seltext_l = 'Cid'.
  APPEND gw_fieldcat TO gt_fieldcat.
  CLEAR gw_fieldcat.
  lw_sort-fieldname = 'CEDOLA'.
  APPEND lw_sort TO lt_sort.
  CLEAR lw_sort.
  gw_fieldcat-tabname = 'GT_DETTAGLIO'.
  gw_fieldcat-fieldname = 'POSITION'.
  gw_fieldcat-seltext_l = 'Position.
  APPEND gw_fieldcat TO gt_fieldcat.
  CLEAR gw_fieldcat.
  lw_sort-fieldname = 'POS'.
  APPEND lw_sort TO lt_sort.
  CLEAR lw_sort.
I want that when I make the sort, it must sort to me therefore                  
CID            POSITION
01               010
01               020
02               020
this is possible ?

Hi,
apply this two line in your code just after the internal table is getting populated. you will get the appropriate result.
DELETE ADJACENT DUPLICATES FROM itab  COMPARING cid position.
sort itab by cid position.
itab is your internal table name.
reward some point.
Bye,
Anomitro

Similar Messages

  • SAP GUI for JAVA - Search Help ALV display

    I need to be able to display search helps in the ALV grid format or the ' Dialog Modal ' option as seen on the <b>Settings for all F4 helps</b> tab under the personalize option for search helps.
    Currently when I am using a Macintosh machine the system ignores the system setting and my personal settings and displays all search results in an ABAP List format. Unfortunately the ABAP list format does not work correctly when used to input a field on another ABAP list report.
    This behaviour can be found on the Mozilla Firefox browser when SAP GUI for HTML and the SAP GUI for JAVA.
    Your help will be greatly appreciated.

    Hi Rolf-Martin,
    Thank you for your detailed explanation on how the ALV grid control is implemented for the SAP GUI for Java.  This has been pretty insightful.  The good news is that I finally figured out a solution to my problem.  You see I inherited an old custom program where an ABAP list is used as an interactive data capture screen with input fields.  Well a couple of fields had search helps. The program has worked fine with the regular SAP GUI until a MAC OS user tried to use it with the SAP GUI for Java.  Whenever they selected a line from the search help it would bring back the entire onto their input screen.
    A sample of the code:
    form search_help.
        CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'
           EXPORTING
                TABNAME     = 'EKPO'
                FIELDNAME   = 'MATNR'
                SEARCHHELP                = 'ZMAT1_A'
                SHLPPARAM                 = 'MATNR'
           TABLES
                RETURN_TAB       = RET_TABLE.
    IF NOT RET_TABLE-FIELDVAL IS INITIAL.
       LINXX-XMATNR = RET_TABLE-FIELDVAL.
       MODIFY CURRENT LINE FIELD VALUE XMATNR FROM LINXX-XMATNR. " ****
    ENDIF.
    SET CURSOR 9 SY-CUROW.   " ********
    endform.
    The problem was being caused by the fact that the search help ABAP list was overriding the sy-XXXX values for the current line contents, index, pageno, cursor row for the calling ABAP list. So when a user selected a row from the search help this would now become the current context and be transferred back to the calling program. 
    The fix was pretty simple; all I had to do was save the current line context and the context prior to calling the search help.  After the search help was run I would then replace the current line with the saved one in my local variable.  I hope this makes sense. We now have a couple of happy MAC OS users.
    Once again I thank you for your patience and support in  this matter.
    Have a great day,
    Edwin.

  • Experts plz help ALV issue

    hi all experts
    plz help
    i have an alv based on object oriented method
    in the output i am gettin a toolbar in which i have two buttons like print and export
    problem is
    when i click on these buttons i am gettin short dump
    Field symbol has not yet been assigned.
    What happened?
        Error in the ABAP Application Program
        The current ABAP program "SAPLKKBL" had to be terminated because
        come across a statement that unfortunately cannot be executed.
    plz tel me for printing do i need to wwrite any seperate event or any method for it
    plz guide me
    thanx in advance .

    *& Report  ZMULTIPLE_ALV
    *REPORT  ZMULTIPLE_ALV.
    report zrich_0006.
    tables: mara.
    type-pools: slis.
    Internal Tables
    data: begin of ialv occurs 0,
          matnr type mara-matnr,
          maktx type makt-maktx,
          end of ialv .
    Internal Tables
    data: begin of ialv2 occurs 0,
          matnr type mard-matnr,
          werks type mard-werks,
          lgort type mard-lgort,
          end of ialv2 .
          CLASS lcl_event_receiver DEFINITION      Handles Double Click
    class lcl_event_receiver definition.
      public section.
        methods handle_hotspot_click
           for event hotspot_click of cl_gui_alv_grid
          importing e_row_id.
      private section.
    endclass.
          CLASS lCL_EVENT_RECEIVER IMPLEMENTATION    Handles Double Click
    class lcl_event_receiver implementation.
      method handle_hotspot_click.
        perform get_details using e_row_id-index.
      endmethod.
    endclass.
    data: alv_container type ref to cl_gui_custom_container,
          event_receiver type ref to lcl_event_receiver,
          alv_grid type ref to cl_gui_alv_grid,
          alv_container2 type ref to cl_gui_custom_container,
          alv_grid2 type ref to cl_gui_alv_grid,
          ok_code like sy-ucomm,
          fieldcat type lvc_t_fcat,
          gs_layout   type lvc_s_layo,
          fieldcat2 type lvc_t_fcat.
    select-options: s_matnr for mara-matnr.
    start-of-selection.
      perform get_data.
      call screen 100.
         Module  status_0100  OUTPUT
    module status_0100 output.
      data: variant type  disvariant.
      data: lt_exclude type ui_functions.
      data: ls_fcat type lvc_s_fcat.
      set pf-status '0100'.
      set titlebar '0100'.
      check alv_container is initial.
      Code for first ALV Grid
    Create Controls
      create object alv_container
             exporting container_name = 'ALV_CONTAINER'.
      create object alv_grid
             exporting  i_parent =  alv_container.
      create Event Receiver
      create object event_receiver.
      clear fieldcat.  refresh: fieldcat.
      clear: ls_fcat.
      ls_fcat-reptext    = 'Material Number'.
      ls_fcat-coltext    = 'Material Number'.
      ls_fcat-fieldname  = 'MATNR'.
      ls_fcat-ref_table  = 'IALV'.
      ls_fcat-hotspot    = 'X'.
      ls_fcat-outputlen  = '18'.
      ls_fcat-col_pos    = 1.
      append ls_fcat to fieldcat.
      clear: ls_fcat.
      ls_fcat-reptext    = 'Material Description'.
      ls_fcat-coltext    = 'Material Description'.
      ls_fcat-fieldname  = 'MATKX'.
      ls_fcat-ref_table  = 'IALV'.
      ls_fcat-outputlen  = '40'.
      ls_fcat-col_pos    = 2.
      append ls_fcat to fieldcat.
      gs_layout-grid_title = 'Flights'(100).
      CALL METHOD alv_grid->SET_TABLE_FOR_FIRST_DISPLAY
        EXPORTING
         I_BUFFER_ACTIVE               =
         I_BYPASSING_BUFFER            =
         I_CONSISTENCY_CHECK           =
         I_STRUCTURE_NAME              =
         IS_VARIANT                    =
         I_SAVE                        =
         I_DEFAULT                     = 'X'
          IS_LAYOUT                     = gs_layout
         IS_PRINT                      =
         IT_SPECIAL_GROUPS             =
         IT_TOOLBAR_EXCLUDING          =
         IT_HYPERLINK                  =
         IT_ALV_GRAPHICS               =
         IT_EXCEPT_QINFO               =
         IR_SALV_ADAPTER               =
        CHANGING
          IT_OUTTAB                     = ialv[]
          IT_FIELDCATALOG               = fieldcat[]
         IT_SORT                       =
         IT_FILTER                     =
       EXCEPTIONS
         INVALID_PARAMETER_COMBINATION = 1
         PROGRAM_ERROR                 = 2
         TOO_MANY_LINES                = 3
         OTHERS                        = 4
      IF SY-SUBRC <> 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    call method alv_grid->set_table_for_first_display
         changing
              it_outtab       = ialv[]
              it_fieldcatalog = fieldcat[].
      handler for ALV grid
      set handler event_receiver->handle_hotspot_click for alv_grid.
      Code for second ALV Grid
    Create Controls
      create object alv_container2
             exporting container_name = 'ALV_CONTAINER2'.
      create Event Receiver
      create object alv_grid2
             exporting  i_parent =  alv_container2.
      clear fieldcat.  refresh: fieldcat.
      clear: ls_fcat.
      ls_fcat-reptext    = 'Material Number'.
      ls_fcat-coltext    = 'Material Number'.
      ls_fcat-fieldname  = 'MATNR'.
      ls_fcat-ref_table  = 'IALV2'.
      ls_fcat-outputlen  = '18'.
      append ls_fcat to fieldcat2.
      clear: ls_fcat.
      ls_fcat-reptext    = 'Plant'.
      ls_fcat-coltext    = 'Plant'.
      ls_fcat-fieldname  = 'MATNR'.
      ls_fcat-ref_table  = 'IALV2'.
      ls_fcat-outputlen  = '4'.
      append ls_fcat to fieldcat2.
      clear: ls_fcat.
      ls_fcat-reptext    = 'Store Loc'.
      ls_fcat-coltext    = 'Store Loc'.
      ls_fcat-fieldname  = 'LGORT'.
      ls_fcat-ref_table  = 'IALV2'.
      ls_fcat-outputlen  = '4'.
      append ls_fcat to fieldcat2.
      call method alv_grid2->set_table_for_first_display
           changing
               it_outtab       = ialv2[]
               it_fieldcatalog = fieldcat2[].
    endmodule.
         Module  USER_COMMAND_0100  INPUT
    module user_command_0100 input.
      case sy-ucomm.
        when 'BACK' or 'CANC'.
          if not alv_container is initial.
            call method alv_container->free.
            clear: alv_container.
            free : alv_container.
          endif.
          if not alv_container2 is initial.
            call method alv_container2->free.
            clear: alv_container2.
            free : alv_container2.
          endif.
          if sy-subrc = 0.
            set screen 0.
            leave screen.
          else.
            leave program.
          endif.
      endcase.
    endmodule.
          FORM GET_DATA.
    form get_data.
      select maramatnr maktmaktx
                 into corresponding fields of table ialv
                     from mara
                          inner join makt
                             on maramatnr = maktmatnr
                                    where mara~matnr in s_matnr
                                      and makt~spras = sy-langu.
      sort ialv ascending by matnr.
    endform.
          FORM GET_MORE_DATA.
    form get_more_data.
      select matnr werks lgort
                 into corresponding fields of table ialv2
                     from mard
                               where matnr = ialv-matnr.
      sort ialv2 ascending by matnr.
    endform.
    GET_DETAILS
    form get_details using index.
      read table ialv index index.
      if sy-subrc = 0.
        perform get_more_data.
        call method alv_grid2->refresh_table_display.
      endif.
    endform.

  • Urgent help ALV report

    HI,
    report zhr2.
    tables:pernr.
    type-POOLs:slis.
    INFOTYPES:0001,0004,0041.
    data: begin of itab,
          pernr type pernr-pernr,
          MASSN type p0000-MASSN,
          STAT2 type p0000-STAT2,
          STAT3 type p0000-STAT3,
          PLANS type p0001-plans,
          WERKS type p0001-werks,
          PERSG type p0001-PERSG,
          PERSK   type p0001-PERSK,
      end of itab.
    data:it_itab type STANDARD TABLE OF itab,
         wa_itab like  itab.
    DATA: alv_fieldcat TYPE slis_t_fieldcat_alv,
          alv_layout TYPE slis_layout_alv.
    DATA: filled_lines LIKE sy-index,
          stru_disvar TYPE disvariant.
    select-options:s_pernr for pernr-pernr.
    start-of-SELECTION.
    get pernr.
    describe table p0001 lines filled_lines.
    if filled_lines gt 0.
      rp_provide_from_last p0001 space pn-begda pn-endda.
    clear wa_itab.
    move-CORRESPONDING  p0001 to wa_itab.
    append wa_itab to it_itab.
    if pnp-sw-found eq 0.
       reject.
       endif.
    endif.
    end-of-SELECTION.
    PERFORM fieldcat_init USING alv_fieldcat.
      alv_layout-colwidth_optimize = 'X'.
      alv_layout-zebra             = 'X'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
            I_INTERFACE_CHECK        = ' '
            I_BUFFER_ACTIVE             = ' '
                i_callback_program       = 'ZHR2'
            I_CALLBACK_PF_STATUS_SET = ' '
            I_CALLBACK_USER_COMMAND  = ' '
            I_CALLBACK_TOP_OF_PAGE      = ' '
            I_CALLBACK_HTML_TOP_OF_PAGE = ' '
            I_CALLBACK_HTML_END_OF_LIST = ' '
             I_STRUCTURE_NAME         =  'ITAB'
            I_BACKGROUND_ID             = ' '
              I_GRID_TITLE                = 'Date Specifications'
            I_GRID_SETTINGS             =
                is_layout              = alv_layout
                it_fieldcat            = alv_fieldcat
            IT_EXCLUDING             =
            IT_SPECIAL_GROUPS        =
            IT_SORT                  =
            IT_FILTER                =
            IS_SEL_HIDE              =
             I_DEFAULT                = 'X'
             I_SAVE                  = 'A'
             IS_VARIANT              = stru_disvar
            IT_EVENTS                =
            IT_EVENT_EXIT            =
            IS_PRINT                 =
            IS_REPREP_ID             =
            I_SCREEN_START_COLUMN    = 0
            I_SCREEN_START_LINE      = 0
            I_SCREEN_END_COLUMN      = 0
            I_SCREEN_END_LINE        = 0
            IT_ALV_GRAPHICS             =
            IT_ADD_FIELDCAT             =
            IT_HYPERLINK                =
       IMPORTING
            E_EXIT_CAUSED_BY_CALLER  =
            ES_EXIT_CAUSED_BY_USER   =
      TABLES
                t_outtab               = it_itab
          EXCEPTIONS
              program_error            = 1
              OTHERS                   = 2.
      IF sy-subrc = 1.
        WRITE: 'Program error'(002).
      ENDIF.
    FORM fieldcat_init USING p_fieldcat
              TYPE slis_t_fieldcat_alv.
      DATA: ls_fieldcat TYPE slis_fieldcat_alv.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname = 'PERNR'.
      ls_fieldcat-ref_tabname = 'PERNR'.
      ls_fieldcat-key         = 'X'.
      APPEND ls_fieldcat TO p_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname = 'MASSN'.
       ls_fieldcat-ref_fieldname = 'MASSN'.
    ls_fieldcat-ref_tabname = 'P0001'.
      APPEND ls_fieldcat TO p_fieldcat.
    CLEAR ls_fieldcat.
      ls_fieldcat-fieldname = 'STAT2'.
       ls_fieldcat-ref_fieldname = 'STAT2'.
    ls_fieldcat-ref_tabname = 'P0001'.
      APPEND ls_fieldcat TO p_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname = 'STAT3'.
      ls_fieldcat-ref_tabname = 'STAT3'.
    ls_fieldcat-ref_tabname = 'P0001'.
      APPEND ls_fieldcat TO p_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname = 'PLANS'.
       ls_fieldcat-ref_fieldname = 'PLANS'.
      ls_fieldcat-ref_tabname = 'P0001'.
      APPEND ls_fieldcat TO p_fieldcat.
      CLEAR ls_fieldcat.
    ls_fieldcat-fieldname = 'WERKS'.
    ls_fieldcat-ref_fieldname = 'WERKS'.
    ls_fieldcat-ref_tabname = 'P0001'.
      APPEND ls_fieldcat TO p_fieldcat.
      CLEAR ls_fieldcat.
    ls_fieldcat-fieldname = 'PERSG'.
      ls_fieldcat-ref_fieldname = 'PERSG'.
    ls_fieldcat-ref_tabname = 'P0001'.
      APPEND ls_fieldcat TO p_fieldcat.
      CLEAR ls_fieldcat.
    ls_fieldcat-fieldname = 'PERSK'.
      ls_fieldcat-ref_fieldname = 'PERSK'.
    ls_fieldcat-ref_tabname = 'P0001'.
      APPEND ls_fieldcat TO p_fieldcat.
    ENDFORM.
    IT is going dump plz can any one help in this .
    Thanks and regards,
    Vamshi

    HI,
    report zhr2.
    tables:pernr.
    type-POOLs:slis.
    INFOTYPES:0001,0004,0041.
    data: begin of itab,
          pernr type pernr-pernr,
          MASSN type p0000-MASSN,
          STAT2 type p0000-STAT2,
          STAT3 type p0000-STAT3,
          PLANS type p0001-plans,
          WERKS type p0001-werks,
          PERSG type p0001-PERSG,
          PERSK   type p0001-PERSK,
      end of itab.
    data:it_itab type STANDARD TABLE OF itab,
         wa_itab like  itab.
    DATA: alv_fieldcat TYPE slis_t_fieldcat_alv,
          alv_layout TYPE slis_layout_alv.
    DATA: filled_lines LIKE sy-index,
          stru_disvar TYPE disvariant.
    select-options:s_pernr for pernr-pernr.
    start-of-SELECTION.
    get pernr.
    describe table p0001 lines filled_lines.
    if filled_lines gt 0.
      rp_provide_from_last p0001 space pn-begda pn-endda.
    clear wa_itab.
    move-CORRESPONDING  p0001 to wa_itab.
    append wa_itab to it_itab.
    if pnp-sw-found eq 0.
       reject.
       endif.
    endif.
    end-of-SELECTION.
    PERFORM fieldcat_init USING alv_fieldcat.
      alv_layout-colwidth_optimize = 'X'.
      alv_layout-zebra             = 'X'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
            I_INTERFACE_CHECK        = ' '
            I_BUFFER_ACTIVE             = ' '
                i_callback_program       = 'ZHR2'
            I_CALLBACK_PF_STATUS_SET = ' '
            I_CALLBACK_USER_COMMAND  = ' '
            I_CALLBACK_TOP_OF_PAGE      = ' '
            I_CALLBACK_HTML_TOP_OF_PAGE = ' '
            I_CALLBACK_HTML_END_OF_LIST = ' '
             I_STRUCTURE_NAME         =  'ITAB'
            I_BACKGROUND_ID             = ' '
              I_GRID_TITLE                = 'Date Specifications'
            I_GRID_SETTINGS             =
                is_layout              = alv_layout
                it_fieldcat            = alv_fieldcat
            IT_EXCLUDING             =
            IT_SPECIAL_GROUPS        =
            IT_SORT                  =
            IT_FILTER                =
            IS_SEL_HIDE              =
             I_DEFAULT                = 'X'
             I_SAVE                  = 'A'
             IS_VARIANT              = stru_disvar
            IT_EVENTS                =
            IT_EVENT_EXIT            =
            IS_PRINT                 =
            IS_REPREP_ID             =
            I_SCREEN_START_COLUMN    = 0
            I_SCREEN_START_LINE      = 0
            I_SCREEN_END_COLUMN      = 0
            I_SCREEN_END_LINE        = 0
            IT_ALV_GRAPHICS             =
            IT_ADD_FIELDCAT             =
            IT_HYPERLINK                =
       IMPORTING
            E_EXIT_CAUSED_BY_CALLER  =
            ES_EXIT_CAUSED_BY_USER   =
      TABLES
                t_outtab               = it_itab
          EXCEPTIONS
              program_error            = 1
              OTHERS                   = 2.
      IF sy-subrc = 1.
        WRITE: 'Program error'(002).
      ENDIF.
    FORM fieldcat_init USING p_fieldcat
              TYPE slis_t_fieldcat_alv.
      DATA: ls_fieldcat TYPE slis_fieldcat_alv.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname = 'PERNR'.
      ls_fieldcat-ref_tabname = 'PERNR'.
      ls_fieldcat-key         = 'X'.
      APPEND ls_fieldcat TO p_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname = 'MASSN'.
       ls_fieldcat-ref_fieldname = 'MASSN'.
    ls_fieldcat-ref_tabname = 'P0001'.
      APPEND ls_fieldcat TO p_fieldcat.
    CLEAR ls_fieldcat.
      ls_fieldcat-fieldname = 'STAT2'.
       ls_fieldcat-ref_fieldname = 'STAT2'.
    ls_fieldcat-ref_tabname = 'P0001'.
      APPEND ls_fieldcat TO p_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname = 'STAT3'.
      ls_fieldcat-ref_tabname = 'STAT3'.
    ls_fieldcat-ref_tabname = 'P0001'.
      APPEND ls_fieldcat TO p_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-fieldname = 'PLANS'.
       ls_fieldcat-ref_fieldname = 'PLANS'.
      ls_fieldcat-ref_tabname = 'P0001'.
      APPEND ls_fieldcat TO p_fieldcat.
      CLEAR ls_fieldcat.
    ls_fieldcat-fieldname = 'WERKS'.
    ls_fieldcat-ref_fieldname = 'WERKS'.
    ls_fieldcat-ref_tabname = 'P0001'.
      APPEND ls_fieldcat TO p_fieldcat.
      CLEAR ls_fieldcat.
    ls_fieldcat-fieldname = 'PERSG'.
      ls_fieldcat-ref_fieldname = 'PERSG'.
    ls_fieldcat-ref_tabname = 'P0001'.
      APPEND ls_fieldcat TO p_fieldcat.
      CLEAR ls_fieldcat.
    ls_fieldcat-fieldname = 'PERSK'.
      ls_fieldcat-ref_fieldname = 'PERSK'.
    ls_fieldcat-ref_tabname = 'P0001'.
      APPEND ls_fieldcat TO p_fieldcat.
    ENDFORM.
    IT is going dump plz can any one help in this .
    Thanks and regards,
    Vamshi

  • Is there anyone who can help me in alv

    hi frns,
    i have a problem in alv.
    i have 4 columns in alv and the requirments is such that
    the 4th column is empty but as soon as i selcet an item in 2nd column with f4(which i have defined in catalog) help its corresponding description should come in 4th list
    pls help me .

    Refer the threads -
    Re: ALV F4 help
    ALV Grid values updation using F4 values
    Regards,
    Amit
    Reward all helpful replies.

  • F4 help on ALV without using OO

    Hi,
    How can I get F4 help on an ALV field without using OO concept?
    That particular field does not have a value table assigned to it. So i have manually created a matchcode.
    regards
    Nishant.
    Message was edited by: Nishant Gupta

    hi,
    check these links
    http://sap.ittoolbox.com/groups/technical-functional/sap-r3-dev/f4-help-in-alv-grid-812677
    http://sap.ittoolbox.com/groups/technical-functional/sap-r3-dev/f4-help-in-alv-grid-812668
    ALV grid f4 help
    ALV F4 Help Error
    Re: Help in ALV grid

  • Vendor Statistics Report ALV

    Hi,
    I am looking for a Vendor Statistics report developed by an ABAPER which basically shows how late a PO was, If full quantity was GR etc basically a Vendor Evaluation report,
    Points will be awarded any Vendor Evaluation Type report will be helpful ALV format pref
    Thanks
    Adeel

    Hi Adeel
    you can get a start from this:
    EKPO , JSTAT will be you might be helpful
    Get the object number... for the order...
    CALL FUNCTION 'STATUS_READ'
    EXPORTING
    client = sy-mandt
    objnr = p_objnr
    only_active = 'X'
    TABLES
    status = lt_status
    EXCEPTIONS
    object_not_found = 1
    OTHERS = 2.
    SELECT txt04 FROM tj02t
    INTO lv_status
    WHERE istat EQ wa_status-stat
    AND spras EQ 'E'.
    ENDSELECT.

  • Using Classes and Methods

    Hi Experts,
    I am studying ABAP Objects, before that I need to know How to use the exsiting classes and Methods in our program and how to search for particular class and methods?
    If it explanied with example well and good.
    Thanks
    sai

    Hi Saikar,
    Here i am sending you very useful content for the usage of classes and its methods.
    It helped me a lot.
    If you find it useful then do not forget to award points.
    Table of Contents
    Applies to:......................................................................................................................................1
    Summary........................................................................................................................................1
    Author Bio......................................................................................................................................1
    Main Class – CL_SALV_TABLE......................................................................................................3
    Functions – CL_SALV_FUNCTIONS..............................................................................................4
    Display Settings – CL_SALV_DISPLAY_SETTINGS......................................................................4
    Columns – CL_SALV_COLUMNS_TABLE and CL_SALV_COLUMN_TABLE..............................5
    Sorts – CL_SALV_SORTS..............................................................................................................8
    Aggregations – CL_SALV_AGGREGATIONS..............................................................................10
    Filters – CL_SALV_FILTERS........................................................................................................12
    Layouts – CL_SALV_LAYOUT......................................................................................................14
    Related Content...........................................................................................................................15
    Disclaimer and Liability Notice.......................................................................................................16 
    ALV Object Model – Simple 2D Table - The Basics SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2006 SAP AG 3
    Main Class – CL_SALV_TABLE
    The main class used to create the simple 2D table is the class CL_SALV_TABLE. Create a reference variable for this class. Create an internal table and fill this internal table with data as show below.
    REPORT ZALVOM_DEMO1. data: ispfli type table of spfli. data: gr_table type ref to cl_salv_table. start-of-selection. select * into table ispfli from spfli.
    Next we need to create the ALV object for the 2D table. The FACTORY method allows you to create the ALV object in 3 ways. You can create the ALV Grid, as a classical list display, as a full screen grid, and finally embedded into a screen container. For this example, we will be working with the full screen grid. Create the call to the FACTORY method. We are importing the object reference into GR_TABLE and passing the internal table ISPFLI.
    cl_salv_table=>factory( importing r_salv_table = gr_table changing t_table = ispfli ).
    Next we need to display the grid, for this we use the DISPLAY method . Simply call it.
    gr_table->display( ). 
    ALV Object Model – Simple 2D Table - The Basics SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2006 SAP AG 4
    Functions – CL_SALV_FUNCTIONS
    Next, add functions to the application toolbar. For this, use the CL_SALV_FUNCTIONS class. Create the object reference variable and receive the object using the GET_FUNCTIONS method of the GR_TABLE object. Call the method SET_ALL to force the ALV grid to show all standard functions.
    report zalvom_demo1. data: ispfli type table of spfli. data: gr_table type ref to cl_salv_table. data: gr_functions type ref to cl_salv_functions. start-of-selection. select * into table ispfli from spfli. cl_salv_table=>factory( importing r_salv_table = gr_table changing t_table = ispfli ). gr_functions = gr_table->get_functions( ). gr_functions->set_all( abap_true ). gr_table->display( ).
    The result is now you have the standard buttons on the application toolbar.
    Display Settings – CL_SALV_DISPLAY_SETTINGS
    Next, we can change some display settings using the class CL_SALV_DISPLAY_SETTINGS. Create the object reference variable and receive the object using the GET_DISPLAY_SETTINGS method of the GR_TABLE object. In this example, we are setting the “Striped Pattern” for the ALV Grid rows, and setting the heading in the title bar.
    report zalvom_demo1. 
    ALV Object Model – Simple 2D Table - The Basics SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2006 SAP AG 5
    ). data: ispfli type table of spfli. data: gr_table type ref to cl_salv_table. data: gr_functions type ref to cl_salv_functions. data: gr_display type ref to cl_salv_display_settings. start-of-selection. select * into table ispfli from spfli. cl_salv_table=>factory( importing r_salv_table = gr_table changing t_table = ispfli ). gr_functions = gr_table->get_functions( ). gr_functions->set_all( abap_true ). gr_display = gr_table->get_display_settings( ). gr_display->set_striped_pattern( cl_salv_display_settings=>true ). gr_display->set_list_header( 'This is the heading' gr_table->display( ).
    Columns – CL_SALV_COLUMNS_TABLE and CL_SALV_COLUMN_TABLE
    Next, we can change some of the attributes of a specific column in the ALV grid. In this example we will change the Heading Text of a column as well as the color of a column. Create the object reference variable and receive the object using the GET_COLUMNS method of the GR_TABLE object. This will pass you the object for all columns of the ALV grid. To access just one column, call the method GET_COLUMN from the GR_COLUMNS object. In this example, we are accessing the CITYTO column and the CITYFROM column.
    report zalvom_demo1. data: ispfli type table of spfli. data: gr_table type ref to cl_salv_table. data: gr_functions type ref to cl_salv_functions. 
    ALV Object Model – Simple 2D Table - The Basics SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2006 SAP AG 6
    data: gr_display type ref to cl_salv_display_settings. data: gr_columns type ref to cl_salv_columns_table. data: gr_column type ref to cl_salv_column_table.
    data: color type lvc_s_colo.
    start-of-selection. select * into table ispfli from spfli. cl_salv_table=>factory( importing r_salv_table = gr_table changing t_table = ispfli ). gr_functions = gr_table->get_functions( ). gr_functions->set_all( abap_true ). gr_display = gr_table->get_display_settings( ). gr_display->set_striped_pattern( cl_salv_display_settings=>true ). gr_display->set_list_header( 'This is the heading' ). gr_columns = gr_table->get_columns( ). gr_column ?= gr_columns->get_column( 'CITYTO' ). gr_column->set_long_text( 'This is long text' ). gr_column->set_medium_text( 'This is med text' ).
    gr_column->set_short_text( 'This is sh' ).
    gr_column ?= gr_columns->get_column( 'CITYFROM' ). color-col = '6'. color-int = '1'. color-inv = '0'. gr_column->set_color( color ).
    gr_table->display( ). 
    ALV Object Model – Simple 2D Table - The Basics SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2006 SAP AG 7 ALV Object Model – Simple 2D Table - The Basics SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2006 SAP AG 8
    Sorts – CL_SALV_SORTS
    Next, we can add some sorting to the ALV grid. Create the object reference variable and receive the object using the GET_SORTS method of the GR_TABLE object. Next, add the sort by calling the ADD_SORT method of the GR_SORTS object.
    report zalvom_demo1. data: ispfli type table of spfli. data: gr_table type ref to cl_salv_table. data: gr_functions type ref to cl_salv_functions. data: gr_display type ref to cl_salv_display_settings. data: gr_columns type ref to cl_salv_columns_table. data: gr_column type ref to cl_salv_column_table. data: gr_sorts type ref to cl_salv_sorts.
    data: color type lvc_s_colo.
    start-of-selection. select * into table ispfli from spfli. cl_salv_table=>factory( importing r_salv_table = gr_table changing t_table = ispfli ). gr_functions = gr_table->get_functions( ). gr_functions->set_all( abap_true ). gr_display = gr_table->get_display_settings( ). gr_display->set_striped_pattern( cl_salv_display_settings=>true ). gr_display->set_list_header( 'This is the heading' ). gr_columns = gr_table->get_columns( ). gr_column ?= gr_columns->get_column( 'CITYTO' ). gr_column->set_long_text( 'This is long text' ). gr_column->set_medium_text( 'This is med text' ). gr_column->set_short_text( 'This is sh' ). gr_column ?= gr_columns->get_column( 'CITYFROM' ). color-col = '6'. color-int = '1'. color-inv = '0'. gr_column->set_color( color ). gr_sorts = gr_table->get_sorts( ). gr_sorts->add_sort 'CITYTO' ). gr_table->display( ). 
    ALV Object Model – Simple 2D Table - The Basics SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2006 SAP AG 9 ALV Object Model – Simple 2D Table - The Basics SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2006 SAP AG 10
    Aggregations – CL_SALV_AGGREGATIONS
    Since we sorted by CITYTO, we can add an aggregation to subtotal the DISTANCE by CITYTO. Create the object reference variable and receive the object using the GET_AGGREGATIONS method of the GR_TABLE object. Next, add the aggregation by calling the ADD_AGGREGATION method of the GR_SORTS object. We also need to modify the call to ADD_SORT to set the SUBTOTAL = ABAP_TRUE.
    report zalvom_demo1. data: ispfli type table of spfli. data: gr_table type ref to cl_salv_table. data: gr_functions type ref to cl_salv_functions. data: gr_display type ref to cl_salv_display_settings. data: gr_columns type ref to cl_salv_columns_table. data: gr_column type ref to cl_salv_column_table. data: gr_sorts type ref to cl_salv_sorts. data: gr_agg type ref to cl_salv_aggregations.
    data: color type lvc_s_colo.
    start-of-selection. select * into table ispfli from spfli. cl_salv_table=>factory( importing r_salv_table = gr_table changing t_table = ispfli ). gr_functions = gr_table->get_functions( ). gr_functions->set_all( abap_true ). gr_display = gr_table->get_display_settings( ). gr_display->set_striped_pattern( cl_salv_display_settings=>true ). gr_display->set_list_header( 'This is the heading' ). gr_columns = gr_table->get_columns( ). gr_column ?= gr_columns->get_column( 'CITYTO' ). gr_column->set_long_text( 'This is long text' ). gr_column->set_medium_text( 'This is med text' ). gr_column->set_short_text( 'This is sh' ). gr_column ?= gr_columns->get_column( 'CITYFROM' ). color-col = '6'. color-int = '1'. color-inv = '0'. gr_column->set_color( color ). gr_sorts = gr_table->get_sorts( ). gr_sorts->add_sort( columnname = 'CITYTO' subtotal = abap_true ). gr_agg = gr_table->get_aggregations( ). gr_agg->add_aggregation( 'DISTANCE' ). 
    ALV Object Model – Simple 2D Table - The Basics SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2006 SAP AG 11
    gr_table->display( ). 
    ALV Object Model – Simple 2D Table - The Basics SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2006 SAP AG 12
    Filters – CL_SALV_FILTERS
    Using the CL_SALV_FILTERS class we can setup some filters for the data in our ALV GRID. Create the object reference variable and receive the object using the GET_FILTERS method of the GR_TABLE object, and then simply called the method ADD_FILTER with the parameters.
    report zalvom_demo1. data: ispfli type table of spfli. data: gr_table type ref to cl_salv_table. data: gr_functions type ref to cl_salv_functions. data: gr_display type ref to cl_salv_display_settings. data: gr_columns type ref to cl_salv_columns_table. data: gr_column type ref to cl_salv_column_table. data: gr_sorts type ref to cl_salv_sorts. data: gr_agg type ref to cl_salv_aggregations. data: gr_filter type ref to cl_salv_filters.
    data: color type lvc_s_colo.
    start-of-selection. select * into table ispfli from spfli. cl_salv_table=>factory( importing r_salv_table = gr_table changing t_table = ispfli ). gr_functions = gr_table->get_functions( ). gr_functions->set_all( abap_true ). gr_display = gr_table->get_display_settings( ). gr_display->set_striped_pattern( cl_salv_display_settings=>true ). gr_display->set_list_header( 'This is the heading' ). gr_columns = gr_table->get_columns( ). gr_column ?= gr_columns->get_column( 'CITYTO' ). gr_column->set_long_text( 'This is long text' ). gr_column->set_medium_text( 'This is med text' ). gr_column->set_short_text( 'This is sh' ). gr_column ?= gr_columns->get_column( 'CITYFROM' ). color-col = '6'. color-int = '1'. color-inv = '0'. gr_column->set_color( color ). gr_sorts = gr_table->get_sorts( ). gr_sorts->add_sort( columnname = 'CITYTO' subtotal = abap_true ). gr_agg = gr_table->get_aggregations( ). gr_agg->add_aggregation( 'DISTANCE' ). 
    ALV Object Model – Simple 2D Table - The Basics SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2006 SAP AG 13
    gr_filter = gr_table->get_filters( ). gr_filter->add_filter( columnname = 'CARRID' low = 'LH' ). gr_table->display( ). 
    ALV Object Model – Simple 2D Table - The Basics SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2006 SAP AG 14
    Layouts – CL_SALV_LAYOUT
    If you want to allow the user to manage layouts of the ALV grid, you must use the class CL_SALV_LAYOUT. Create the object reference variable and receive the object using the GET_LAYOUT method of the GR_TABLE object. Then simply call the method SET_KEY with the parameters and set the save restriction using the SET_SAVE_RESTRICTION method.
    report zalvom_demo1. data: ispfli type table of spfli. data: gr_table type ref to cl_salv_table. data: gr_functions type ref to cl_salv_functions. data: gr_display type ref to cl_salv_display_settings. data: gr_columns type ref to cl_salv_columns_table. data: gr_column type ref to cl_salv_column_table. data: gr_sorts type ref to cl_salv_sorts. data: gr_agg type ref to cl_salv_aggregations. data: gr_filter type ref to cl_salv_filters. data: gr_layout type ref to cl_salv_layout. data: color type lvc_s_colo. data: key type salv_s_layout_key. start-of-selection. select * into table ispfli from spfli. cl_salv_table=>factory( importing r_salv_table = gr_table changing t_table = ispfli ). gr_functions = gr_table->get_functions( ). gr_functions->set_all( abap_true ). gr_display = gr_table->get_display_settings( ). gr_display->set_striped_pattern( cl_salv_display_settings=>true ). gr_display->set_list_header( 'This is the heading' ). gr_columns = gr_table->get_columns( ). gr_column ?= gr_columns->get_column( 'CITYTO' ). gr_column->set_long_text( 'This is long text' ). gr_column->set_medium_text( 'This is med text' ). gr_column->set_short_text( 'This is sh' ). gr_column ?= gr_columns->get_column( 'CITYFROM' ). color-col = '6'. color-int = '1'. color-inv = '0'. gr_column->set_color( color ). gr_sorts = gr_table->get_sorts( ). gr_sorts->add_sort( columnname = 'CITYTO' subtotal = abap_true ). gr_agg = gr_table->get_aggregations( ). 
    ALV Object Model – Simple 2D Table - The Basics SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2006 SAP AG 15
    gr_filter = gr_table->get_filters( ). gr_layout = gr_table->get_layout( ). gr_layout->set_key( ). gr_table->display( ). gr_agg->add_aggregation( 'DISTANCE' ). gr_filter->add_filter( columnname = 'CARRID' low = 'LH' ). key-report = sy-repid. key gr_layout->set_save_restriction( cl_salv_layout=>restrict_none ).
    Related Content
         • Help - ALV Object Model
         • Utilizing the New ALV Object Model
         • SDN ABAP Forum
    ALV Object Model – Simple 2D Table - The Basics SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2006 SAP AG 16
    Disclaimer and Liability Notice
    This document may discuss sample coding or other information that does not include SAP official interfaces and therefore is not supported by SAP. Changes made based on this information are not supported and can be overwritten during an upgrade.
    SAP will not be held liable for any damages caused by using or misusing the information, code or methods suggested in this document, and anyone using these methods does so at his/her own risk.
    SAP offers no guarantees and assumes no responsibility or liability of any type with respect to the content of this technical article or code sample, including any liability resulting from incompatibility between the content within this document and the materials and services offered by SAP. You agree that you will not hold, or seek to hold, SAP responsible or liable with respect to the content of this document.
    Regards,
    Mandeep.
    Note: Award points if contents are useful.

  • List Output in Screen

    Hi,
    I call an old style Report (not ALV ) from a Dialog Screen. I would like to display the list on the same screen, in a separate area. Subscreens don't seem to work for this purpose. Is it possible to use a custom control for this? If yes, how would I implement that?
    Thanks,
    Thomas

    yes u can do that by using custom control..
    go to sap help  ALV GRID CONTROL there u will find a sample program ... u just copy and paste that and analyse..
    i never tried that but i know , for this u can use custom control...

  • Help needed for ALV report

    Hi,
    i need to add coloums for the existing report which picks from G/L account.
    in this report I need to add some more columns from COSP-KSTAR, which shows the cost element details from G/L account.
    I need to restrict that cost element number according to the company code.
    Plz see this and let me know the things.
    1. I need to add FISCAL YEAR(COEP-GJAHR) in selection screen.
    2. I need to add column: Employee Cost (CSKS-KOSTL)
    3. add a column Staff Welfare (COSP-KSTAR) this is to restrict for the cost element 3000200 from G/L account
    4. add a column Recruitment restrict for the cost element(COSP-KSTAR) 3100040 from G/L account
    5. add a column Travels (suppressing some cost elements(COSP-KSTAR) and putting into Travels)
    6. add a column Subcontracts restrict for the cost element (COSP-KSTAR)3100360 from G/L account
    7. add a column Communication suppressing some cost elements and putting into Communication)
    8. add a column Rent restrict for the cost element (COSP-KSTAR)3100055 from G/L account
    9. add a column Back end Cost restrict for the cost element (COSP-KSTAR)3100065 from G/L account
    i can hardcode these cost elements.
    i did according to some of our sdn friends guidence but it is going to dump.
    hear i am sending the code what i changed.
    it is giving the error with the select.
    SELECT BUKRS KOKRS gjahr kstar OBJNR OBJNR_N1 PERIO  BEKNZ WKGBTR WOGBTR  FROM
    COEP  INTO TABLE
    IT_COEP FOR ALL ENTRIES IN IT_AUFK WHERE OBJNR = IT_AUFK-OBJNR and
    perio in S_PERIO.
    plz try to help me out in this issue.
    hear i am sending the complete code what i worte.
    *& Report  ZPROJECT_PROFIT2
    REPORT  ZPROJECT_PROFIT2.
    *********************MAIN DOCUMENTATION BLOCK*************************
    Project Code           :
    Program Name           :Zproject_profit1.
    Purpose of program     :This report will give the gross margin for a project as
    *a whole based on some selected input criteria.
    Author of program      :JAYA KRISHNA .B.
    INPUT/OUTPUT FILE      :nil
    TYPE-POOLS : SLIS."For ALV display.
    TABLES : COEP,  "CO Object: Line Items  (by period).
             AUFK,   "Order master data.
             csks,    "Cost center master data
             cosp.    "CO Objects
    *&  Include           ZSTRUCTURE
    types:    BEGIN OF TY_COEP ,            "structure of table COEP.
              BUKRS LIKE COEP-BUKRS,
              KOKRS LIKE COEP-KOKRS,
              OBJNR LIKE COEP-OBJNR,
               gjahr like coep-gjahr,
              kstar like coep-kstar,
              OBJNR_N1 LIKE COEP-OBJNR_N1,
              PERIO LIKE COEP-PERIO,
              BEKNZ LIKE COEP-BEKNZ,
              WKGBTR LIKE COEP-WKGBTR,
              WOGBTR LIKE COEP-WOGBTR,
              BELNR LIKE COEP-BELNR,
              END OF TY_COEP,
             BEGIN OF TY_AUFK ,             "structure of table AUFK.
             BUKRS LIKE AUFK-BUKRS,
             KOKRS LIKE AUFK-KOKRS,
             OBJNR LIKE AUFK-OBJNR,
             KTEXT LIKE AUFK-KTEXT,
             ANFAUFNR LIKE AUFK-ANFAUFNR,
             AUFEX LIKE AUFK-AUFEX,
             USER2 LIKE AUFK-USER2,
             USER0 LIKE AUFK-USER0,
             USER1 LIKE AUFK-USER1,
             USER3 LIKE AUFK-USER3,
             USER6 LIKE AUFK-USER6,
             USER7 LIKE AUFK-USER7,
             USER8 LIKE AUFK-USER8,
             ABKRS(10) TYPE C,
             USER9 LIKE AUFK-USER9,
             AUFNR LIKE AUFK-AUFNR,
           END OF TY_AUFK,
           begin of ty_csks,
           kokrs like csks-kokrs,
            kostl like csks-kostl,
            bukrs like csks-bukrs,
            objnr like csks-objnr,
                 end of ty_csks.
    DATA :   BEGIN OF IT_COSP occurs 100,
           OBJNR LIKE COSP-OBJNR,
           GJAHR LIKE COSP-GJAHR,
           KSTAR LIKE COSP-KSTAR,
           END OF IT_COSP.
    DATA : IT_COEP TYPE TABLE OF TY_COEP,     " Declaraton of tables COEP and AUFK.
           IT_AUFK TYPE TABLE OF TY_AUFK,
           IT_CSKS TYPE TABLE OF TY_CSKS.
          IT_COSP TYPE TABLE OF TY_COSP.
    DATA : WA_COEP LIKE LINE OF IT_COEP,      " Declaration of work areas for tables COEP and AUFK.
           WA_AUFK LIKE LINE OF IT_AUFK,
           WA_CSKS LIKE LINE OF IT_CSKS.
          WA_COSP LIKE LINE OF IT_COSP.
    DATA : BEGIN OF IT_DISPLAY OCCURS 0,      " Declaration of display table.
            OBJNR_N1 LIKE COEP-OBJNR_N1,
            OBJNR_N12 LIKE COEP-OBJNR_N1,
            KTEXT1 LIKE AUFK-KTEXT,
            WKGBTR LIKE COEP-WKGBTR,
            WOGBTR LIKE COEP-WOGBTR,
            WKGBTR1  LIKE COEP-WTGBTR,
            WOGBTR1 LIKE COEP-WOGBTR,
            ADDK LIKE COEP-WOGBTR,
            ADDO LIKE COEP-WOGBTR,
            ADDK1 LIKE COEP-WOGBTR,
            ADDO1 LIKE COEP-WOGBTR,
            PROFIT1 LIKE COEP-WOGBTR,
            PROFIT2 LIKE COEP-WOGBTR,
            BEKNZ LIKE COEP-BEKNZ,
            BUKRS LIKE AUFK-BUKRS,
            anfaufnr LIKE AUFK-anfaufnr,
            aufex like aufk-aufex,
            OBJNR LIKE AUFK-OBJNR,
            USER2 LIKE AUFK-USER2,
            USER0 LIKE AUFK-USER0,
            USER1 LIKE AUFK-USER1,
            USER3 LIKE AUFK-USER3,
            USER6 LIKE AUFK-USER6,
            USER7 LIKE AUFK-USER7,
            USER8 LIKE AUFK-USER8,
            ABKRS LIKE AUFK-ABKRS,
            USER9 LIKE AUFK-USER9,
            PERIO LIKE COEP-PERIO,
            AUFNR LIKE AUFK-AUFNR,
            STR(5) TYPE C,
            WORK(10) TYPE C,
           END OF IT_DISPLAY,
      : BEGIN OF IT_DISPLAY1 OCCURS 0,      " Declaration of second display table.
         OBJNR_N1 LIKE COEP-OBJNR_N1,
         OBJNR_N12 LIKE COEP-OBJNR_N1,
         KTEXT1 LIKE AUFK-KTEXT,
         WKGBTR LIKE COEP-WKGBTR,
         WOGBTR LIKE COEP-WOGBTR,
         WKGBTR1  LIKE COEP-WTGBTR,
         WOGBTR1 LIKE COEP-WOGBTR,
         ADDK LIKE COEP-WOGBTR,
         ADDO LIKE COEP-WOGBTR,
         ADDK1 LIKE COEP-WOGBTR,
         ADDO1 LIKE COEP-WOGBTR,
         PROFIT1 LIKE COEP-WOGBTR,
         PROFIT2 LIKE COEP-WOGBTR,
         BEKNZ LIKE COEP-BEKNZ,
         BUKRS LIKE AUFK-BUKRS,
         anfaufnr like aufk-anfaufnr,
         aufex like aufk-aufex,
         OBJNR LIKE AUFK-OBJNR,
         USER2 LIKE AUFK-USER2,
         USER0 LIKE AUFK-USER0,
         USER1 LIKE AUFK-USER1,
         USER3 LIKE AUFK-USER3,
         USER6 LIKE AUFK-USER6,
         USER7 LIKE AUFK-USER7,
         USER8 LIKE AUFK-USER8,
         ABKRS LIKE AUFK-ABKRS,
         USER9 LIKE AUFK-USER9,
         PERIO LIKE COEP-PERIO,
         AUFNR LIKE AUFK-AUFNR,
         STR(5) TYPE C,
         WORK(10) TYPE C,
        END OF IT_DISPLAY1.
    data : it_field type slis_fieldcat_alv,        " Declaration of ALV variables
           it_field_t type slis_t_fieldcat_alv,
            xlayout    TYPE slis_layout_alv.
    data : it_event type slis_t_event,
          wa_event like line of it_event.
    DATA : WA_TOP TYPE SLIS_LISTHEADER,
           IT_TOP TYPE SLIS_T_LISTHEADER.
    data:w_lines type i,
          w_occurs type i,
          STR(5) TYPE C,
          WORK(10) TYPE C.
          constants : c_selection type char20 value 'Selection based on'. " Declaration of a constant.
    selection-screen BEGIN OF BLOCK BLK WITH FRAME TITLE TEXT-000.
    SELECT-OPTIONS S_BUKRS FOR AUFK-BUKRS OBLIGATORY.
    SELECT-OPTIONS S_OBJNR FOR AUFK-AUFNR.
    SELECT-OPTIONS S_ANF FOR AUFK-ANFAUFNR.
    SELECT-OPTIONS S_AUFEX FOR AUFK-AUFEX.
    SELECT-OPTIONS S_USER2 FOR AUFK-USER2.
    SELECT-OPTIONS S_USER0 FOR AUFK-USER0.
    SELECT-OPTIONS S_USER1 FOR AUFK-USER1.
    SELECT-OPTIONS S_USER3 FOR AUFK-USER3.
    SELECT-OPTIONS S_USER6 FOR AUFK-USER6.
    SELECT-OPTIONS S_ABKRS FOR AUFK-ABKRS.
    SELECT-options s_gjahr for coep-gjahr obligatory.
    SELECT-OPTIONS S_PERIO FOR COEP-PERIO OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK BLK .
    SELECTION-SCREEN BEGIN OF BLOCK BLK1 WITH FRAME TITLE TEXT-001.
    PARAMETERS : ONSITE RADIOBUTTON GROUP RADI.
    PARAMETERS : OFFSHORE RADIOBUTTON GROUP RADI.
    PARAMETERS : BOTH RADIOBUTTON GROUP RADI.
    SELECTION-SCREEN END OF BLOCK BLK1 .
    start-of-selection.
    *ZAUFK
                                  " Selection of records from aufk to internal table.
    IF ONSITE EQ 'X' .
    SELECT
    BUKRS
    KOKRS
    OBJNR
    KTEXT
    anfaufnr
    aufex
    USER2
    USER0
    USER1
    USER3
    USER6
    USER7
    USER8
    ABKRS
    USER9
    AUFNR
    FROM AUFK INTO TABLE IT_AUFK WHERE BUKRS IN S_BUKRS AND
    anfaufnr IN s_anf AND
    aufex in s_aufex and
    aufnr IN S_OBJNR AND
    USER2 IN S_USER2 AND
    USER0 IN S_USER0 AND
    USER1 IN S_USER1 AND
    USER3 IN S_USER3 AND
    USER6 IN S_USER6 AND
    ABKRS IN S_ABKRS AND
    USER9 EQ 'X' .
    ENDIF.
    IF OFFSHORE EQ 'X'.
    SELECT
    BUKRS
    KOKRS
    OBJNR
    KTEXT
    anfaufnr
    aufex
    USER2
    USER0
    USER1
    USER3
    USER6
    USER7
    USER8
    ABKRS
    USER9
    AUFNR
    FROM AUFK INTO TABLE IT_AUFK WHERE BUKRS IN S_BUKRS AND
    anfaufnr IN S_anf AND
    aufex in s_aufex and
    aufnR IN S_OBJNR AND
    USER2 IN S_USER2 AND
    USER0 IN S_USER0 AND
    USER1 IN S_USER1 AND
    USER3 IN S_USER3 AND
    USER6 IN S_USER6 AND
    ABKRS IN S_ABKRS AND
    USER9 <> 'X'.
    ENDIF.
    IF BOTH EQ 'X'.
    SELECT
    BUKRS
    KOKRS
    OBJNR
    KTEXT
    anfaufnr
    aufex
    USER2
    USER0
    USER1
    USER3
    USER6
    USER7
    USER8
    ABKRS
    USER9
    AUFNR
    FROM AUFK INTO TABLE IT_AUFK WHERE BUKRS IN S_BUKRS AND
    anfaufnr IN S_anf AND
    aufex in s_aufex and
    aufNR IN S_OBJNR AND
    USER2 IN S_USER2 AND
    USER0 IN S_USER0 AND
    USER1 IN S_USER1 AND
    USER3 IN S_USER3 AND
    USER6 IN S_USER6 AND
    ABKRS IN S_ABKRS.
    ENDIF.
    *&  Include           ZCOEP
                                  " Selection of records from coep to internal table.
    SELECT BUKRS KOKRS gjahr kstar OBJNR OBJNR_N1 PERIO  BEKNZ WKGBTR WOGBTR  FROM
    COEP  INTO TABLE
    IT_COEP FOR ALL ENTRIES IN IT_AUFK WHERE OBJNR = IT_AUFK-OBJNR and
    perio in S_PERIO.
    *&  Include           ZPROFIT_CALC
                                 " Calculations for income and Profit of the employee.
    if not it_coep[] is initial.
        select objnr gjahr wrttp versn kstar from cosp into TABLE It_cosp for
    all entries in it_coep where objnr = IT_COEP-objnr .
    endif.
      LOOP AT IT_coep INTO WA_coep.
        read table IT_aufk into WA_aufk with key OBJNR = wa_coep-OBJNR.
    case it_cosp-kstar.
    when '3000200'.
    it_cosp-kstar = cosp-kstar.
    when '3100040'.
    it_cosp-kstar = cosp-kstar.
    when '3100360'.
    it_cosp-kstar = cosp-kstar.
    when '3100055'.
    it_cosp-kstar = cosp-kstar.
    when '3100065'.
    it_cosp-kstar = cosp-kstar.
    when '3100115'.
    it_cosp-kstar = cosp-kstar.
    when '3100120'.
    it_cosp-kstar = cosp-kstar.
    when '3100130'.
    it_cosp-kstar = cosp-kstar.
    when '3100135'.
    it_cosp-kstar = cosp-kstar.
    when '3100140'.
    it_cosp-kstar = cosp-kstar.
    when '3100145'.
    it_cosp-kstar = cosp-kstar.
    when '3100150'.
    it_cosp-kstar = cosp-kstar.
    when '3100155'.
    it_cosp-kstar = cosp-kstar.
    when '3100160'.
    it_cosp-kstar = cosp-kstar.
    when '3100165'.
    it_cosp-kstar = cosp-kstar.
    when '3100170'.
    it_cosp-kstar = cosp-kstar.
    endcase.
        IT_DISPLAY-BUKRS = WA_AUFK-BUKRS.
        IT_DISPLAY-anfaufnr = WA_AUFK-anfaufnr.
        it_display-aufex  = wa_aufk-aufex.
        IT_DISPLAY-OBJNR = WA_AUFK-OBJNR.
        IT_DISPLAY-USER2 = WA_AUFK-USER2.
        IT_DISPLAY-USER0 = WA_AUFK-USER0.
        IT_DISPLAY-USER1 = WA_AUFK-USER1.
        IT_DISPLAY-USER3 = WA_AUFK-USER3.
        IT_DISPLAY-USER6 = WA_AUFK-USER6.
        IT_DISPLAY-USER7 = WA_AUFK-USER7.
        IT_DISPLAY-USER8 = WA_AUFK-USER8.
        IT_DISPLAY-ABKRS = WA_AUFK-ABKRS.
        IT_DISPLAY-USER9 = WA_AUFK-USER9.
        IT_DISPLAY-KTEXT1 =  WA_AUFK-KTEXT.
        if WA_AUFK-abkrs = 01.
          IT_DISPLAY-STR = 'TM'.
        ENDIF.
        IF WA_AUFK-ABKRS = 02.
          IT_DISPLAY-STR = 'FP'.
        ENDIF.
        IF WA_AUFK-USER9 = 'X'.
          IT_DISPLAY-WORK = 'ONSITE'.
        ENDIF.
        IF WA_AUFK-USER9 <> 'X'.
          IT_DISPLAY-WORK = 'OFFSHORE'.
        ENDIF.
        it_display-ABKRS = it_display-user7.
        IF wa_coep-BEKNZ = 'S'.
          IT_DISPLAY-WKGBTR = WA_COEP-WKGBTR.
          IT_DISPLAY-WOGBTR = WA_COEP-WOGBTR.
          IT_DISPLAY-ADDK = IT_DISPLAY-ADDK + IT_DISPLAY-WKGBTR.
          IT_DISPLAY-ADDO = IT_DISPLAY-ADDO + IT_DISPLAY-WOGBTR.
          IT_DISPLAY-ADDK1 = 0.
          IT_DISPLAY-ADDO1 = 0.
          IT_DISPLAY-PROFIT1 = IT_DISPLAY-ADDK1 +  IT_DISPLAY-ADDK.
          IT_DISPLAY-PROFIT2 = IT_DISPLAY-ADDO1 +  IT_DISPLAY-ADDO.
          APPEND IT_DISPLAY.
        ENDIF.
        IF WA_COEP-BEKNZ = 'H'.
          IT_DISPLAY-WKGBTR1 = WA_COEP-WKGBTR.
          IT_DISPLAY-WOGBTR1 = WA_COEP-WOGBTR.
          IT_DISPLAY-ADDK1 = IT_DISPLAY-ADDK + IT_DISPLAY-WKGBTR1.
          IT_DISPLAY-ADDO1 = IT_DISPLAY-ADDO + IT_DISPLAY-WOGBTR1.
          IT_DISPLAY-ADDK = 0.
          IT_DISPLAY-ADDO = 0.
          IT_DISPLAY-PROFIT1 = IT_DISPLAY-ADDK1 +  IT_DISPLAY-ADDK.
          IT_DISPLAY-PROFIT2 = IT_DISPLAY-ADDO1 +  IT_DISPLAY-ADDO.
          APPEND IT_DISPLAY.
        ENDIF.
        collect it_display into it_display1.
        clear it_display.
      ENDLOOP.
                        "calc
    *&  Include           ZPROFIT_DISPLAY
      LOOP AT IT_DISPLAY1.                                         "it_display.
        read table IT_COEP into WA_COEP with key OBJNR =
        IT_DISPLAY-OBJNR.
        read table IT_AUFK into WA_AUFK with key aufnr = IT_DISPLAY-aufnr.
        if WA_AUFK-abkrs = 01.
          STR = 'TM'.
        ENDIF.
        IF WA_AUFK-ABKRS = 02.
          STR = 'FP'.
        ENDIF.
        IF WA_AUFK-USER9 = 'X'.
          WORK = 'ONSITE'.
        ENDIF.
        IF WA_AUFK-USER9 <> 'X'.
          WORK = 'OFFSHORE'.
        ENDIF.
      endloop.
      clear it_field.
      it_field-col_pos = 1.
      it_field-fieldname = 'AUFNR'.
      it_field-seltext_l = 'project id.'.
      it_field-outputlen = 15.
      append it_field to it_field_t.
      CLEAR it_field.
      clear it_field.
      it_field-col_pos = 2.
      it_field-fieldname = 'KTEXT1'.
      it_field-seltext_l = 'Project Name'.
      it_field-outputlen = 20.
      append it_field to it_field_t.
      CLEAR it_field.
      clear it_field.
      it_field-col_pos = 3.
      it_field-fieldname = 'USER7'.
      it_field-seltext_l = 'Start Date'.
      it_field-do_sum = 'X'.
      it_field-outputlen = 20.
      append it_field to it_field_t.
      CLEAR it_field.
      clear it_field.
      it_field-col_pos = 4.
      it_field-fieldname = 'USER8'.
      it_field-seltext_l = 'End Date'.
      it_field-do_sum = 'X'.
      it_field-outputlen = 20.
      append it_field to it_field_t.
      CLEAR it_field.
      clear it_field.
      it_field-col_pos = 5.
      it_field-fieldname = 'USER2'.
      it_field-seltext_l = 'Location'.
      it_field-do_sum = 'X'.
      it_field-outputlen = 20.
      append it_field to it_field_t.
      CLEAR it_field.
      clear it_field.
      it_field-col_pos = 6.
      it_field-fieldname = 'USER0'.
      it_field-seltext_l = 'Vertical'.
      it_field-do_sum = 'X'.
      it_field-outputlen = 20.
      append it_field to it_field_t.
      CLEAR it_field.
      it_field-col_pos = 7.
      it_field-fieldname = 'USER1'.
      it_field-seltext_l = 'Sub_vertical'.
      it_field-outputlen = 20.
      it_field-do_sum = 'X'.
      append it_field to it_field_t.
      CLEAR it_field.
      it_field-col_pos = 8.
      it_field-fieldname = 'USER3'.
      it_field-seltext_l = 'Technology'.
      it_field-outputlen = 20.
      it_field-do_sum = 'X'.
      append it_field to it_field_t.
      CLEAR it_field.
      it_field-col_pos = 9.
      it_field-fieldname = 'USER6'.
      it_field-seltext_l = 'Department'.
      it_field-outputlen = 20.
      it_field-do_sum = 'X'.
      append it_field to it_field_t.
      CLEAR it_field.
      it_field-col_pos = 10.
      it_field-fieldname = 'WORK'.
      it_field-seltext_l = 'Onsite/Offshore'.
      it_field-outputlen = 20.
      it_field-do_sum = 'X'.
      append it_field to it_field_t.
      CLEAR it_field.
      it_field-col_pos = 11.
      it_field-fieldname = 'STR'.
      it_field-seltext_l = 'T&M/FP'.
      it_field-outputlen = 20.
      it_field-do_sum = 'X'.
      append it_field to it_field_t.
      CLEAR it_field.
    it_field-col_pos = 12.
      it_field-fieldname = 'KOSTL'.
      it_field-seltext_l = 'EMP COST'.
      it_field-outputlen = 10.
      it_field-do_sum = 'X'.
      append it_field to it_field_t.
      CLEAR it_field.
    it_field-col_pos = 13.
      it_field-fieldname = 'KSTAR'.
      it_field-seltext_l = 'STAFF WELFARE'.
      it_field-outputlen = 10.
      it_field-do_sum = 'X'.
      append it_field to it_field_t.
      CLEAR it_field.
    it_field-col_pos = 14.
      it_field-fieldname = 'KSTAR'.
      it_field-seltext_l = 'RECRUITMENT'.
      it_field-outputlen = 10.
      it_field-do_sum = 'X'.
      append it_field to it_field_t.
      CLEAR it_field.
    it_field-col_pos = 15.
      it_field-fieldname = 'KSTAR'.
      it_field-seltext_l = 'TRAVELS'.
      it_field-outputlen = 10.
      it_field-do_sum = 'X'.
      append it_field to it_field_t.
      CLEAR it_field.
    it_field-col_pos = 16.
      it_field-fieldname = 'KSTAR'.
      it_field-seltext_l = 'SUBCONTRACT'.
      it_field-outputlen = 10.
      it_field-do_sum = 'X'.
      append it_field to it_field_t.
      CLEAR it_field.
    it_field-col_pos = 17.
      it_field-fieldname = 'KSTAR'.
      it_field-seltext_l = 'COMMUNICATION'.
      it_field-outputlen = 10.
      it_field-do_sum = 'X'.
      append it_field to it_field_t.
      CLEAR it_field.
    it_field-col_pos = 18.
      it_field-fieldname = 'KSTAR'.
      it_field-seltext_l = 'RENT'.
      it_field-outputlen = 10.
      it_field-do_sum = 'X'.
      append it_field to it_field_t.
      CLEAR it_field.
    it_field-col_pos = 19.
      it_field-fieldname = 'KSTAR'.
      it_field-seltext_l = 'BACKEND COST (PROJECT EXP)'.
      it_field-outputlen = 10.
      it_field-do_sum = 'X'.
      append it_field to it_field_t.
      CLEAR it_field.
    it_field-col_pos = 20.
      it_field-fieldname = 'ADDO'.
      it_field-seltext_l = 'Direct costs'.
      it_field-outputlen = 20.
      it_field-do_sum = 'X'.
      append it_field to it_field_t.
      CLEAR it_field.
      it_field-col_pos = 21.
      it_field-fieldname = 'ADDO1'.
      it_field-seltext_l = 'Income'.
      it_field-outputlen = 20.
      it_field-do_sum = 'X'.
      append it_field to it_field_t.
      CLEAR it_field.
      it_field-col_pos = 22.
      it_field-fieldname = 'PROFIT2'.
      it_field-seltext_l = 'Profit(income-costs)'.
      it_field-outputlen = 20.
      it_field-do_sum = 'X'.
      append it_field to it_field_t.
      CLEAR it_field.
      it_field-col_pos = 23.
      it_field-fieldname = 'ADDK'.
      it_field-seltext_l = 'Direct costs(Grp cur)'.
      it_field-outputlen = 20.
      it_field-do_sum = 'X'.
      append it_field to it_field_t.
      CLEAR it_field.
      it_field-col_pos = 24.
      it_field-fieldname = 'ADDK1'.
      it_field-seltext_l = 'Income(Grp Cur)'.
      it_field-outputlen = 20.
      it_field-do_sum = 'X'.
      append it_field to it_field_t.
      CLEAR it_field.
      it_field-col_pos = 25.
      it_field-fieldname = 'PROFIT1'.
      it_field-seltext_l = 'Profit(income-costs)'.
      it_field-outputlen = 20.
      it_field-do_sum = 'X'.
      append it_field to it_field_t.
      CLEAR it_field.
      xlayout-zebra = 'X'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
         I_CALLBACK_PROGRAM                = 'ZPROJECT_PROFIT1'
      I_CALLBACK_PF_STATUS_SET          = ' '
         I_CALLBACK_USER_COMMAND           = 'USER_COMMAND'
         I_CALLBACK_TOP_OF_PAGE            = 'TOP_OF_PAGE_PROFIT'
      I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
      I_BACKGROUND_ID                   = ' '
      I_GRID_TITLE                      =
      I_GRID_SETTINGS                   =
         IS_LAYOUT                         = xlayout
         IT_FIELDCAT                       =  it_field_t
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
         I_DEFAULT                         = 'X'
         I_SAVE                            = ' '
      IS_VARIANT                        =
      IT_EVENTS                         =
      IT_EVENT_EXIT                     =
      IS_PRINT                          =
      IS_REPREP_ID                      =
      I_SCREEN_START_COLUMN             = 0
      I_SCREEN_START_LINE               = 0
      I_SCREEN_END_COLUMN               = 0
      I_SCREEN_END_LINE                 = 0
      I_HTML_HEIGHT_TOP                 = 0
      I_HTML_HEIGHT_END                 = 0
      IT_ALV_GRAPHICS                   =
      IT_HYPERLINK                      =
      IT_ADD_FIELDCAT                   =
      IT_EXCEPT_QINFO                   =
      IR_SALV_FULLSCREEN_ADAPTER        =
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
       TABLES
          T_OUTTAB                          = IT_DISPLAY1
    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.
      clear it_field_t.
      "it_display.
    FORM USER_COMMAND using r_ucomm like sy-ucomm rs type slis_selfield.
      include zinteractive_profit."Secondary list for calling KO03.
    ENDFORM.                    "USER_COMMAND.
    Thanks & Regards,
    Lakshmi..

    Hi,
    i did according to ur suggession.
    now it is going dump.
    and it is telling like this.
    2629               i_event_name      = 'SUBTOTAL_TEXT'
    2630               is_subtottxt_info = ls_subtot_info
    2631               ip_subtot_line    = lr_data
    2632             changing
    2633               c_subtottxt       = l_subtottxt.
    2634           ls_lvc_data-value = l_subtottxt.
    2635
    2636           append ls_lvc_data to ct_lvc_data.
    2637         endif.
    2638
    2639 ************************************
    2640 * Column per Fieldcat Entry
    2641 ************************************
    2642         clear ls_lvc_data-style.
    2643         loop at it_fcat_local assigning <ls_fcat>
    2644                 where tech ne 'X' and no_out ne 'X'.
    2645           if l_invisible eq 'X'.
    2646             clear l_invisible.
    2647             if <ls_fcat>-do_sum is initial.
    2648               continue.
    2649             else.
    2650               clear ls_lvc_data-col_pos.
    2651             endif.
    2652           endif.
    2653
    2654           add 1 to ls_lvc_data-col_pos.
    2655
    2656           assign component <ls_fcat>-fieldname
    2657                            of structure <ls_data> to <l_field_val
    2658           if sy-subrc ne 0.
    >>>>>             message x000(0k).
    2660           endif.
    2661
    2662 *... work on average
    2663           if <ls_fcat>-do_sum eq 'C'.
    2664             clear l_entries.
    2665
    2666             assign space to <l_unit>.
    2667             if not <ls_fcat>-cfieldname is initial.
    2668               assign component <ls_fcat>-cfieldname
    2669                      of structure <ls_data> to <l_unit>.
    2670             endif.
    2671             if not <ls_fcat>-qfieldname is initial.
    2672               assign component <ls_fcat>-qfieldname
    2673                      of structure <ls_data> to <l_unit>.
    2674             endif.
    2675
    2676             l_from = ls_grpl-index_from.
    2677             l_to   = ls_grpl-index_to.
    2678             if ls_grpl-index_from is initial and
    plz any of u help me to come out with solution.
    Thanks & Regards,
    Lakshmi..

  • Kindly help to develop alv grid display

    Hi ,
    I have a requirement in which I need to display ALV GRID display and in its tool bar 4 butons are required. In the same view down to alv display i want to develop a tabstrip and its functionalities.I have designed classic alv using SALV_WD_TABLE component. I want a good GRID Display, not like flat field names that comes in list display, looking for bulged fields(like what comes for ALV GRID in normal abap)  display with print version etc hidden and buttons at the top of ALV.  Kindly help
    Highly rewarded
    Kindly help
    Regards,
    Lakshmi
    Edited by: Lakshmi Menon on Nov 27, 2008 4:49 PM

    Well Web Dynpro is generally output in HTML so the output formatting is never going to quite look like a desktop application (which is the case with the ALV Grid).  You have very little control over the look of the column headers.  In fact you can only manipulate what is available via the Portal Theme. 
    There is a new Tradeshow Plus theme available in NetWeaver 7.01 which uses a gradiant background for the column headers.  This gives them a little more depth:
    http://www.flickr.com/photos/tjung/3068850120/
    The other option is next year when NetWeaver Business Client version 3.0 comes out, you will be able to render Web Dynpro applications using the NWBC Smart Client Rendering.  This will render Web Dynpro applications using desktop libraries instead of HTML/Browser. This gives Web Dynpro a more SAPGUI/Desktop appears of course.
    http://www.flickr.com/photos/tjung/2685619882/in/set-72157606418550143/

  • Help needed Displaying ALV  Secondary list without using oops concept

    Hi Experts
    Help needed Displaying ALV  Secondary list without using oops concept.
    its urgent
    regds
    rajasekhar

    hi chk this code
    ******************TABLES DECLARATION*****************
    TABLES : VBAP,MARA.
    *****************TYPE POOLS**************************
    TYPE-POOLS : SLIS.
    ****************INTERNAL TABLES**********************
    DATA : BEGIN OF IT_VBAP OCCURS 0,
    VBELN LIKE VBAP-VBELN, "SALES DOCUMENT
    POSNR LIKE VBAP-POSNR, "SALES DOCUMENT ITEM
    MATNR LIKE VBAP-MATNR, "MATERIAL NUMBER
    END OF IT_VBAP.
    ****************TEMPORARY VARIABLES******************
    DATA : V_VBELN LIKE VBAP-VBELN."SALES DOCUMENT
    DATA : V_MTART LIKE MARA-MTART. "MATERIAL TYPE
    *****************FIELD CATALOG***********************
    DATA : IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
           WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
    ****************LAYOUT*******************************
    DATA : WA_LAYOUT TYPE SLIS_LAYOUT_ALV.
    ***************VARIANT*******************************
    DATA : G_VARIANT LIKE DISVARIANT.
    ****************SAVE*********************************
    DATA : G_SAVE(1) TYPE C.
    *****************EVENTS******************************
    DATA : XS_EVENTS TYPE SLIS_ALV_EVENT,
           G_EVENTS TYPE SLIS_T_EVENT.
    ******************PF STATUS**************************
    DATA : PF_STATUS TYPE SLIS_FORMNAME VALUE 'SET_PF_STATUS'.
    ******************USER COMMAND************************
    DATA : USER_COMMAND TYPE SLIS_FORMNAME VALUE 'SET_USER_COMMAND',
           R_UCOMM LIKE SY-UCOMM.
    ****************SELECTION SCREEN************************
    SELECT-OPTIONS : S_VBELN FOR VBAP-VBELN.
    ***************AT SELECTION SCREEN*********************
    AT SELECTION-SCREEN.
      PERFORM VALIDATE.
    **************START-OF-SELECTION**************************
    START-OF-SELECTION.
      PERFORM GET_DETAILS.
      PERFORM FIELDCAT.
      PERFORM LAYOUT.
      PERFORM VARIANT.
      PERFORM SAVE.
      PERFORM EVENTS.
      PERFORM ALV_DISPLAY.
    *********************FORMS*******************************************
    *&      Form  validate
          text
    -->  p1        text
    <--  p2        text
    FORM VALIDATE .
      SELECT SINGLE VBELN
                    FROM VBAP
                    INTO V_VBELN
                    WHERE VBELN IN S_VBELN.
      IF SY-SUBRC <> 0.
        MESSAGE E000 WITH 'enter valid vbeln'.
      ENDIF.
    ENDFORM.                    " validate
    *&      Form  get_details
          text
    -->  p1        text
    <--  p2        text
    FORM GET_DETAILS .
      SELECT VBELN
             POSNR
             MATNR
             FROM VBAP
             INTO TABLE IT_VBAP
             WHERE VBELN IN S_VBELN.
      IF SY-SUBRC <> 0.
        MESSAGE E000 WITH 'no details found'.
      ENDIF.
    ENDFORM.                    " get_details
    *&      Form  fieldcat
          text
    -->  p1        text
    <--  p2        text
    FORM FIELDCAT .
      WA_FIELDCAT-TABNAME = 'IT_VBAP'.
      WA_FIELDCAT-FIELDNAME = 'VBELN'.
      WA_FIELDCAT-OUTPUTLEN = 10.
      WA_FIELDCAT-SELTEXT_L = 'SALES DOC'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'IT_VBAP'.
      WA_FIELDCAT-FIELDNAME = 'POSNR'.
      WA_FIELDCAT-OUTPUTLEN = 6.
      WA_FIELDCAT-SELTEXT_L = 'ITEM'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'IT_VBAP'.
      WA_FIELDCAT-FIELDNAME = 'MATNR'.
      WA_FIELDCAT-OUTPUTLEN = 18.
      WA_FIELDCAT-SELTEXT_L = 'MATERIAL NO'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
    ENDFORM.                    " fieldcat
    *&      Form  LAYOUT
          text
    -->  p1        text
    <--  p2        text
    FORM LAYOUT .
      WA_LAYOUT-ZEBRA = 'X'.
    ENDFORM.                    " LAYOUT
    *&      Form  VARIANT
          text
    -->  p1        text
    <--  p2        text
    FORM VARIANT .
      CLEAR G_VARIANT.
      G_VARIANT-REPORT = SY-REPID.
    ENDFORM.                    " VARIANT
    *&      Form  SAVE
          text
    -->  p1        text
    <--  p2        text
    FORM SAVE .
      CLEAR G_SAVE.
      G_SAVE = 'A'.
    ENDFORM.                    " SAVE
    *&      Form  EVENTS
          text
    -->  p1        text
    <--  p2        text
    FORM EVENTS .
      CLEAR XS_EVENTS.
      XS_EVENTS-NAME = SLIS_EV_TOP_OF_PAGE.
      XS_EVENTS-FORM = 'TOP_OF_PAGE'.
      APPEND XS_EVENTS TO G_EVENTS.
    ENDFORM.                    " EVENTS
    *&      Form  TOP_OF_PAGE
          text
    FORM TOP_OF_PAGE.
      WRITE :/ ' INTELLI GROUP'.
    ENDFORM.                    "TOP_OF_PAGE
    *&      Form  ALV_DISPLAY
          text
    -->  p1        text
    <--  p2        text
    FORM ALV_DISPLAY .
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
       EXPORTING
      I_INTERFACE_CHECK              = ' '
      I_BYPASSING_BUFFER             =
      I_BUFFER_ACTIVE                = ' '
         I_CALLBACK_PROGRAM             = SY-REPID
         I_CALLBACK_PF_STATUS_SET       = PF_STATUS
         I_CALLBACK_USER_COMMAND        = USER_COMMAND
      I_STRUCTURE_NAME               =
         IS_LAYOUT                      = WA_LAYOUT
         IT_FIELDCAT                    = IT_FIELDCAT
      IT_EXCLUDING                   =
      IT_SPECIAL_GROUPS              =
      IT_SORT                        =
      IT_FILTER                      =
      IS_SEL_HIDE                    =
      I_DEFAULT                      = 'X'
         I_SAVE                         = G_SAVE
         IS_VARIANT                     = G_VARIANT
         IT_EVENTS                      = G_EVENTS
      IT_EVENT_EXIT                  =
      IS_PRINT                       =
      IS_REPREP_ID                   =
      I_SCREEN_START_COLUMN          = 0
      I_SCREEN_START_LINE            = 0
      I_SCREEN_END_COLUMN            = 0
      I_SCREEN_END_LINE              = 0
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER        =
      ES_EXIT_CAUSED_BY_USER         =
        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.
    ENDFORM.                    " ALV_DISPLAY
    *&      Form  SET_PF_STATUS
          text
    FORM SET_PF_STATUS USING EXTAB TYPE SLIS_T_EXTAB.
      SET PF-STATUS 'Z50651_PFSTATUS' EXCLUDING EXTAB.
    ENDFORM.                    "SET_PF_STATUS
    *&      Form  SET_USER_COMMAND
          text
    FORM SET_USER_COMMAND USING R_UCOMM
                                RS_SELFIELD TYPE SLIS_SELFIELD.
      CASE R_UCOMM.
        WHEN 'DC'.
          READ TABLE IT_VBAP INDEX RS_SELFIELD-TABINDEX.
          IF SY-SUBRC = 0.
            SELECT SINGLE MTART
                          FROM MARA
                          INTO V_MTART
                          WHERE MATNR = IT_VBAP-MATNR.
            IF SY-SUBRC <> 0.
       MESSAGE E000 WITH 'NO MATERIAL DESCRIPTION FOR SELECTED MATERIAL NO'.
            ELSE.
              WRITE :/ 'MATERIAL NO :',IT_VBAP-MATNR.
              WRITE :/ 'MATERIAL TYPE :' , V_MTART.
            ENDIF.
          ENDIF.
        WHEN 'BACK'.
          LEAVE TO SCREEN 0.
        WHEN 'EXIT'.
          LEAVE TO SCREEN 0.
        WHEN 'CLOSE'.
          CALL TRANSACTION 'SE38'.
      ENDCASE.
    REPORT  Z_ALV_INTERACTIVE  MESSAGE-ID ZMSG_50651
                                    LINE-SIZE 100
                                    LINE-COUNT 60
                                    NO STANDARD PAGE HEADING.
    ******************TABLES DECLARATION*****************
    TABLES : VBAP,MARA.
    *****************TYPE POOLS**************************
    TYPE-POOLS : SLIS.
    ****************INTERNAL TABLES**********************
    DATA : BEGIN OF IT_VBAP OCCURS 0,
    VBELN LIKE VBAP-VBELN, "SALES DOCUMENT
    POSNR LIKE VBAP-POSNR, "SALES DOCUMENT ITEM
    MATNR LIKE VBAP-MATNR, "MATERIAL NUMBER
    END OF IT_VBAP.
    ****************TEMPORARY VARIABLES******************
    DATA : V_VBELN LIKE VBAP-VBELN."SALES DOCUMENT
    DATA : V_MTART LIKE MARA-MTART. "MATERIAL TYPE
    *****************FIELD CATALOG***********************
    DATA : IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
           WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
    ****************LAYOUT*******************************
    DATA : WA_LAYOUT TYPE SLIS_LAYOUT_ALV.
    ***************VARIANT*******************************
    DATA : G_VARIANT LIKE DISVARIANT.
    ****************SAVE*********************************
    DATA : G_SAVE(1) TYPE C.
    *****************EVENTS******************************
    DATA : XS_EVENTS TYPE SLIS_ALV_EVENT,
           G_EVENTS TYPE SLIS_T_EVENT.
    ******************PF STATUS**************************
    DATA : PF_STATUS TYPE SLIS_FORMNAME VALUE 'SET_PF_STATUS'.
    ******************USER COMMAND************************
    DATA : USER_COMMAND TYPE SLIS_FORMNAME VALUE 'SET_USER_COMMAND',
           R_UCOMM LIKE SY-UCOMM.
    ****************SELECTION SCREEN************************
    SELECT-OPTIONS : S_VBELN FOR VBAP-VBELN.
    ***************AT SELECTION SCREEN*********************
    AT SELECTION-SCREEN.
      PERFORM VALIDATE.
    **************START-OF-SELECTION**************************
    START-OF-SELECTION.
      PERFORM GET_DETAILS.
      PERFORM FIELDCAT.
      PERFORM LAYOUT.
      PERFORM VARIANT.
      PERFORM SAVE.
      PERFORM EVENTS.
      PERFORM ALV_DISPLAY.
    *********************FORMS*******************************************
    *&      Form  validate
          text
    -->  p1        text
    <--  p2        text
    FORM VALIDATE .
      SELECT SINGLE VBELN
                    FROM VBAP
                    INTO V_VBELN
                    WHERE VBELN IN S_VBELN.
      IF SY-SUBRC <> 0.
        MESSAGE E000 WITH 'enter valid vbeln'.
      ENDIF.
    ENDFORM.                    " validate
    *&      Form  get_details
          text
    -->  p1        text
    <--  p2        text
    FORM GET_DETAILS .
      SELECT VBELN
             POSNR
             MATNR
             FROM VBAP
             INTO TABLE IT_VBAP
             WHERE VBELN IN S_VBELN.
      IF SY-SUBRC <> 0.
        MESSAGE E000 WITH 'no details found'.
      ENDIF.
    ENDFORM.                    " get_details
    *&      Form  fieldcat
          text
    -->  p1        text
    <--  p2        text
    FORM FIELDCAT .
      WA_FIELDCAT-TABNAME = 'IT_VBAP'.
      WA_FIELDCAT-FIELDNAME = 'VBELN'.
      WA_FIELDCAT-OUTPUTLEN = 10.
      WA_FIELDCAT-SELTEXT_L = 'SALES DOC'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'IT_VBAP'.
      WA_FIELDCAT-FIELDNAME = 'POSNR'.
      WA_FIELDCAT-OUTPUTLEN = 6.
      WA_FIELDCAT-SELTEXT_L = 'ITEM'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'IT_VBAP'.
      WA_FIELDCAT-FIELDNAME = 'MATNR'.
      WA_FIELDCAT-OUTPUTLEN = 18.
      WA_FIELDCAT-SELTEXT_L = 'MATERIAL NO'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
    ENDFORM.                    " fieldcat
    *&      Form  LAYOUT
          text
    -->  p1        text
    <--  p2        text
    FORM LAYOUT .
      WA_LAYOUT-ZEBRA = 'X'.
    ENDFORM.                    " LAYOUT
    *&      Form  VARIANT
          text
    -->  p1        text
    <--  p2        text
    FORM VARIANT .
      CLEAR G_VARIANT.
      G_VARIANT-REPORT = SY-REPID.
    ENDFORM.                    " VARIANT
    *&      Form  SAVE
          text
    -->  p1        text
    <--  p2        text
    FORM SAVE .
      CLEAR G_SAVE.
      G_SAVE = 'A'.
    ENDFORM.                    " SAVE
    *&      Form  EVENTS
          text
    -->  p1        text
    <--  p2        text
    FORM EVENTS .
      CLEAR XS_EVENTS.
      XS_EVENTS-NAME = SLIS_EV_TOP_OF_PAGE.
      XS_EVENTS-FORM = 'TOP_OF_PAGE'.
      APPEND XS_EVENTS TO G_EVENTS.
    ENDFORM.                    " EVENTS
    *&      Form  TOP_OF_PAGE
          text
    FORM TOP_OF_PAGE.
      WRITE :/ ' INTELLI GROUP'.
    ENDFORM.                    "TOP_OF_PAGE
    *&      Form  ALV_DISPLAY
          text
    -->  p1        text
    <--  p2        text
    FORM ALV_DISPLAY .
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
       EXPORTING
      I_INTERFACE_CHECK              = ' '
      I_BYPASSING_BUFFER             =
      I_BUFFER_ACTIVE                = ' '
         I_CALLBACK_PROGRAM             = SY-REPID
       I_CALLBACK_PF_STATUS_SET         = PF_STATUS
         I_CALLBACK_USER_COMMAND        = USER_COMMAND
      I_STRUCTURE_NAME               =
         IS_LAYOUT                      = WA_LAYOUT
         IT_FIELDCAT                    = IT_FIELDCAT
      IT_EXCLUDING                   =
      IT_SPECIAL_GROUPS              =
      IT_SORT                        =
      IT_FILTER                      =
      IS_SEL_HIDE                    =
      I_DEFAULT                      = 'X'
         I_SAVE                         = G_SAVE
        IS_VARIANT                      = G_VARIANT
         IT_EVENTS                      = G_EVENTS
      IT_EVENT_EXIT                  =
      IS_PRINT                       =
      IS_REPREP_ID                   =
      I_SCREEN_START_COLUMN          = 0
      I_SCREEN_START_LINE            = 0
      I_SCREEN_END_COLUMN            = 0
      I_SCREEN_END_LINE              = 0
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER        =
      ES_EXIT_CAUSED_BY_USER         =
        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.
    ENDFORM.                    " ALV_DISPLAY
    *&      Form  SET_PF_STATUS
          text
    FORM SET_PF_STATUS USING EXTAB TYPE SLIS_T_EXTAB.
      SET PF-STATUS 'STANDARD' EXCLUDING EXTAB.
    ENDFORM.                    "SET_PF_STATUS
    *&      Form  SET_USER_COMMAND
          text
    FORM SET_USER_COMMAND USING R_UCOMM
                                RS_SELFIELD TYPE SLIS_SELFIELD.
      CASE R_UCOMM.
        WHEN 'DC'.
          READ TABLE IT_VBAP INDEX RS_SELFIELD-TABINDEX.
          IF SY-SUBRC = 0.
            SELECT SINGLE MTART
                          FROM MARA
                          INTO V_MTART
                          WHERE MATNR = IT_VBAP-MATNR.
            IF SY-SUBRC <> 0.
       MESSAGE E000 WITH 'NO MATERIAL DESCRIPTION FOR SELECTED MATERIAL NO'.
            ELSE.
              WRITE :/ 'MATERIAL NO :',IT_VBAP-MATNR.
              WRITE :/ 'MATERIAL TYPE :' , V_MTART.
      SUBMIT SLIS_DUMMY WITH P_MATNR EQ IT_VBAP-MATNR
                        WITH P_MTART EQ V_MTART.
            ENDIF.
          ENDIF.
        WHEN 'BACK'.
          LEAVE TO SCREEN 0.
        WHEN 'EXIT'.
          LEAVE TO SCREEN 0.
        WHEN 'CLOSE'.
          CALL TRANSACTION 'SE38'.
      ENDCASE.
    plz reward if useful

  • Search help (PREM) for personal no. is not coming in ALV grid table control

    hi experts,
    Search help (PREM) for personal no. is not coming in ALV grid table control.
    i have assigned the srch help (prem) to my 'ZFIEXP_PROJALLOC' table for the emp_id.
    but in output it is now showing the help.
    ls_fcat-fieldname = 'EMPLOYEE CODE'.
      ls_fcat-ref_table = 'ZFIEXP_PROJALLOC'.
      ls_fcat-ref_field = 'EMP_ID'.
      ls_fcat-outputlen = '10'.
      ls_fcat-key = 'X'.
      ls_fcat-edit = 'X'.
      ls_fcat-coltext = 'EMPLOYEE CODE'.
      ls_fcat-seltext = 'EMPLOYEE CODE'.
      append ls_fcat to pt_fieldcat.
      clear ls_fcat.
    Then i tried to solve it using the PA0002 . ie.,
    ls_fcat-fieldname = 'EMPLOYEE CODE'.
      ls_fcat-ref_table = 'PA0002'.
      ls_fcat-ref_field = 'PERNR'.
      ls_fcat-outputlen = '10'.
      ls_fcat-key = 'X'.
      ls_fcat-edit = 'X'.
      ls_fcat-coltext = 'EMPLOYEE CODE'.
      ls_fcat-seltext = 'EMPLOYEE CODE'.
      append ls_fcat to pt_fieldcat.
      clear ls_fcat.
    with this it is showing the help in employee code, but, when i click on an empl number, it is not added to my table control and allowing me to add the number by typing them.
    plz help me.
    thanks.

    Hi 
    In the layout give layout-sel_mode  = 'A'.  and
    pass  'A'    to  i_save  exporting parameter to method  set_table_for_first_display.
    The same thing if you are working with function module
    reuse_alv_grid_display.
    Reward points for useful answer.
    Venkat

  • OO ALV - No Output, Please help

    hello all...
    in this alv.. i used the static call instead of creating a custom container.
    i couldn't get the output. please help.
    <code part too large, removed by moderator, please stay below 5000 characters, counting each single one ;)>
    Edited by: Thomas Zloch on Feb 9, 2011 1:23 PM

    re submission of the code from fieldcatalog to the method call for better clarity of view.
    dgw_it_fieldcatalog-fieldname = 'VBELN'.
    dgw_it_fieldcatalog-col_pos = 1.
    dgw_it_fieldcatalog-outputlen = 20.
    dgw_it_fieldcatalog-emphasize = 'X'.
    APPEND dgw_it_fieldcatalog TO dgmst_it_fieldcatalog.
    CLEAR dgw_it_fieldcatalog.
    dgw_it_fieldcatalog-fieldname = 'ERNAM'.
    dgw_it_fieldcatalog-col_pos = 1.
    dgw_it_fieldcatalog-outputlen = 20.
    dgw_it_fieldcatalog-emphasize = 'X'.
    APPEND dgw_it_fieldcatalog TO dgmst_it_fieldcatalog.
    CLEAR dgw_it_fieldcatalog.
    dgw_it_fieldcatalog-fieldname = 'ERDAT'.
    dgw_it_fieldcatalog-col_pos = 2.
    dgw_it_fieldcatalog-outputlen = 10.
    dgw_it_fieldcatalog-emphasize = 'X'.
    APPEND dgw_it_fieldcatalog TO dgmst_it_fieldcatalog.
    CLEAR dgw_it_fieldcatalog.
    dgw_it_fieldcatalog-fieldname = 'POSNR'.
    dgw_it_fieldcatalog-col_pos = 3.
    dgw_it_fieldcatalog-just = 'L'.
    dgw_it_fieldcatalog-outputlen = 10.
    dgw_it_fieldcatalog-emphasize = 'X'.
    APPEND dgw_it_fieldcatalog TO dgmst_it_fieldcatalog.
    CLEAR dgw_it_fieldcatalog.
    dgw_it_fieldcatalog-fieldname = 'MATNR'.
    dgw_it_fieldcatalog-col_pos = 4.
    dgw_it_fieldcatalog-outputlen = 15.
    dgw_it_fieldcatalog-emphasize = 'X'.
    APPEND dgw_it_fieldcatalog TO dgmst_it_fieldcatalog.
    CLEAR dgw_it_fieldcatalog.
    dgw_it_fieldcatalog-fieldname = 'MAKTX'.
    dgw_it_fieldcatalog-col_pos = 5.
    dgw_it_fieldcatalog-outputlen = 40.
    dgw_it_fieldcatalog-emphasize = 'X'.
    APPEND dgw_it_fieldcatalog TO dgmst_it_fieldcatalog.
    CLEAR dgw_it_fieldcatalog.
    CREATE OBJECT r_grid
      EXPORTING
    *    i_shellstyle      = 0
    *    i_lifetime        =
         i_parent          = cl_gui_custom_container=>screen0.
    *    i_appl_events     = space
    *    i_parentdbg       =
    *    i_applogparent    =
    *    i_graphicsparent  =
    *     i_name            =
    *    i_fcat_complete   = space
    *  EXCEPTIONS
    *    error_cntl_create = 1
    *    error_cntl_init   = 2
    *    error_cntl_link   = 3
    *    error_dp_create   = 4
    *    others            = 5
    IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CALL METHOD r_grid->set_table_for_first_display
    *   EXPORTING
    *    i_buffer_active               =
    *    i_bypassing_buffer            =
    *    i_consistency_check           =
    *    i_structure_name              =
    *    is_variant                    =
    *    i_save                        =
    *    i_default                     = 'X'
    *    is_layout                     =
    *    is_print                      =
    *    it_special_groups             =
    *    it_toolbar_excluding          =
    *    it_hyperlink                  =
    *    it_alv_graphics               =
    *    it_except_qinfo               =
    *    ir_salv_adapter               =
      CHANGING
         it_outtab                     = dgmst_order
         it_fieldcatalog               = dgmst_it_fieldcatalog
    *    it_sort                       =
    *    it_filter                     =
    *  EXCEPTIONS
    *    invalid_parameter_combination = 1
    *    program_error                 = 2
    *    too_many_lines                = 3
    *    others                        = 4
    IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

  • Help required on ALV REPORT

    Hi,
    Please help with a solution:
    my requirement is to add the following to an existing program.
    i need to add 3 fields from a new table(a table which is not used in the program).
    the fields are :
    Vendor Part No. : Field ZWTYVND-Z_WTY_MAT_VPN
    Mail To Vendor No.:  Field ZWTYVND-Z_WTY_LIFNR_MAIL
    Mail To Vendor Name:  Field ZWTYVND-WTY_NAME1
    here is the program code:
    REPORT  zwtyrep008
            LINE-SIZE 500
            MESSAGE-ID zpp02.
    *& Report  ZWTYREP008                                                  *
    *$*$----------------------------------------------------------------$*$*
    *$*$---T A B L E S--------------------------------------------------$*$*
    *$*$----------------------------------------------------------------$*$*
    TABLES: wty_pnwtyh_dia,    "
            wty_pnwtyv_dia,
            mara,
            usr21,
            pnwtyv,
            adrp,
            s084.
    *$*$----------------------------------------------------------------$*$*
    *$*$ CONSTANTS
    *$*$----------------------------------------------------------------$*$*
    CONSTANTS: true(1)                                VALUE 'X',
               false(1)                               VALUE ' '.
    CONSTANTS: c_year_low(4)                          VALUE '1960',
               c_year_high(4)                         VALUE '9999',
               c_zero        LIKE wty_pvwty_dia-valiv VALUE '0.00',
               c_claim_to_process TYPE i              VALUE 3000.
    CONSTANTS: c_save(1)               VALUE 'U'.
    *$*$----------------------------------------------------------------$*$*
    *$*$ TYPES
    *$*$----------------------------------------------------------------$*$*
    TYPE-POOLS: slis, pwty.
    TYPES: BEGIN OF lt_period,
                   year(4),
                   poper(2),
                   start     TYPE d,
                   end       TYPE d,
          END   OF lt_period.
    TYPES: BEGIN OF tp_charac_value,
                 atwrt LIKE cawn-atwrt,
           END   OF tp_charac_value.
    TYPES: BEGIN OF tp_submit_records,
                 header_guid   LIKE wty_pnwtyv_dia-header_guid,
                 versn         LIKE wty_pnwtyv_dia-versn,
                 prev_version  LIKE wty_pnwtyv_dia-prev_version,
                 kateg         LIKE wty_pnwtyv_dia-kateg,
                 aktiv         LIKE wty_pnwtyv_dia-aktiv,
                 pnguid        LIKE wty_pnwtyv_dia-pnguid,
                 knumv         LIKE wty_pnwtyv_dia-knumv,
           END   OF tp_submit_records.
    TYPES: BEGIN OF tp_cond_table,
                 kschl  LIKE konv-kschl,
                 zaehk  LIKE konv-zaehk,
                 kinak  LIKE konv-kinak,
                 kbetr  LIKE konv-kbetr,
           END   OF tp_cond_table.
    *$*$----------------------------------------------------------------$*$*
    *$*$---I N T E R N A L   T A B L E S--------------------------------$*$*
    *$*$----------------------------------------------------------------$*$*
    * Report table to display with ALV
    DATA: t_detail_info TYPE STANDARD TABLE OF zwty_claim_avg_rep_det
                        WITH HEADER LINE
                        INITIAL SIZE 0.
    FIELD-SYMBOLS:<fs_detail_info> LIKE LINE OF t_detail_info.
    DATA: t_summary_alv TYPE STANDARD TABLE OF zwty_claim_avg_rep_sum
                        WITH HEADER LINE
                        INITIAL SIZE 0.
    FIELD-SYMBOLS:<fs_summary_alv>  LIKE LINE OF t_summary_alv.
    DATA: t_detail_alv  TYPE STANDARD TABLE OF zwty_claim_avg_rep_det
                        WITH HEADER LINE
                        INITIAL SIZE 0.
    FIELD-SYMBOLS:<fs_detail_alv> LIKE LINE OF t_detail_alv.
    DATA: it_submit_records TYPE HASHED TABLE OF tp_submit_records
                           WITH UNIQUE KEY header_guid versn
                           WITH HEADER LINE
                           INITIAL SIZE 0.
    FIELD-SYMBOLS: <fs_submit_rec_vs2> TYPE tp_submit_records.
    DATA: it_period TYPE HASHED TABLE OF lt_period
                    WITH UNIQUE KEY year poper
                    WITH HEADER LINE
                    INITIAL SIZE 0.
    FIELD-SYMBOLS: <fs_it_period>      LIKE LINE OF it_period.
    DATA: it_pvwty_dia_all  TYPE wty_pvwty_dia_tab.
    FIELD-SYMBOLS: <fs_pvwty_dia_es3> LIKE LINE OF it_pvwty_dia_all.
    DATA: it_cond_table TYPE STANDARD TABLE OF tp_cond_table
                        WITH HEADER LINE
                        INITIAL SIZE 0.
    FIELD-SYMBOLS: <fs_cond_table> TYPE tp_cond_table.
    *$*$----------------------------------------------------------------$*$*
    *$*$---G L O B A L  D A T A  ---------------------------------------$*$*
    *$*$----------------------------------------------------------------$*$*
    DATA: gt_fieldcat_sum   TYPE slis_t_fieldcat_alv,
          gt_fieldcat_det  TYPE slis_t_fieldcat_alv,
          gtw_fieldcat     LIKE LINE OF gt_fieldcat_sum,
          gt_top_of_page   TYPE slis_t_listheader,
          gtw_top_of_page  LIKE LINE OF gt_top_of_page,
          gt_end_of_page   TYPE slis_t_listheader,
          gtw_end_of_page  LIKE LINE OF gt_end_of_page,
          gs_layout        TYPE slis_layout_alv,
          gt_excluding     TYPE slis_t_extab,
          gtw_excluding    LIKE LINE OF gt_excluding,
          gs_variant1       TYPE disvariant,
          gs_variant2       TYPE disvariant,
          eventcat         TYPE slis_t_event,         "EVENEMENT
          eventcat_ln      LIKE LINE OF eventcat,     "LIGNE D'EVENEMENT
          gt_sort          TYPE slis_t_sortinfo_alv,
          gtw_sort         LIKE LINE OF gt_sort.
    DATA: wa_lis_progname  LIKE sy-cprog,
          wa_low_date      TYPE d,
          wa_high_date     TYPE d,
          wa_index_mat     TYPE i,
          wa_index_link    TYPE i,
          wa_level_alv     TYPE i.
    DATA: g_callback_pgm(40)          TYPE c,
          g_callback_user_command(30) TYPE c.
    DATA: my_print TYPE  slis_print_alv.
    FIELD-SYMBOLS: <fs_pvwty_dia> TYPE wty_pvwty_dia.
    * SELECTION SCREEN                                          *
    SELECTION-SCREEN SKIP 1.
    SELECTION-SCREEN BEGIN OF BLOCK post WITH FRAME TITLE text-001.
    SELECT-OPTIONS: s_cpudt FOR s084-spmon NO-EXTENSION,
                    s_postdt FOR  wty_pnwtyv_dia-fkdat NO-EXTENSION.
    SELECTION-SCREEN END   OF BLOCK post.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-002.
    SELECT-OPTIONS: s_vend  FOR pnwtyv-v_parnr NO INTERVALS.
    SELECT-OPTIONS: s_clgrp FOR wty_pnwtyh_dia-clmgrp.
    SELECTION-SCREEN SKIP 1.
    SELECT-OPTIONS: s_model  FOR  wty_pnwtyh_dia-z_wty_model.
    SELECT-OPTIONS: s_matnr  FOR  mara-matnr.
    SELECTION-SCREEN END   OF BLOCK b1.
    SELECTION-SCREEN BEGIN OF BLOCK lay WITH FRAME TITLE text-004.
    PARAMETERS: varn1  TYPE slis_vari MEMORY ID fit_alv_gl,  "Dis. variant
                varn2  TYPE slis_vari.
    SELECTION-SCREEN END   OF BLOCK lay.
    *$*$----------------------------------------------------------------$*$*
    *$*$---A T  S E L E C T I O N - S C R E E N-------------------------$*$*
    *$*$----------------------------------------------------------------$*$*
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR varn1.
      PERFORM alv_variant_f4 USING '0001' CHANGING varn1.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR varn2.
      PERFORM alv_variant_f4 USING '0002' CHANGING varn2.
    AT SELECTION-SCREEN ON BLOCK post.  "Validate posting parameters
      PERFORM validate_posting_parameter.
    AT SELECTION-SCREEN ON s_model.     "Validate model
      PERFORM validate_model.
    AT SELECTION-SCREEN ON s_vend.      "Validate vendor
      PERFORM validate_vendor.
    AT SELECTION-SCREEN ON s_matnr.      "Validate material
      PERFORM validate_material.
    AT SELECTION-SCREEN ON s_clgrp.     "Validate claim group
      PERFORM validate_claim_group.
    AT SELECTION-SCREEN OUTPUT.
    * Initialization.
    INITIALIZATION.
    * Initialize default display variant for ALV report
      CLEAR gs_variant1.
      MOVE sy-repid TO: gs_variant1-report,
                        gs_variant2-report.
      gs_variant1-handle = '0001'.
      gs_variant2-handle = '0002'.
      wa_lis_progname   = sy-repid.
      PERFORM set_default_variant CHANGING gs_variant1
                                           varn1.
      PERFORM set_default_variant CHANGING gs_variant2
                                           varn2.
      PERFORM get_fin_period USING c_year_low c_year_high.
      PERFORM set_period_to_analyse.
    *$*$----------------------------------------------------------------$*$*
    *$*$---S T A R T - O F - S E L E C T I O N--------------------------$*$*
    *$*$----------------------------------------------------------------$*$*
    START-OF-SELECTION.
      PERFORM select_claim_to_process.
    *$*$----------------------------------------------------------------$*$*
    *$*$---E N D - O F - S E L E C T I O N------------------------------$*$*
    *$*$----------------------------------------------------------------$*$*
    END-OF-SELECTION.
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
       EXPORTING
    *        PERCENTAGE       = 0
         text             =  text-m02.
      IF sy-batch = 'X'.
        PERFORM set_print_alv_grid.
      ENDIF.
      PERFORM show_alv_grid.
    *&      Form  PRINT_DETAIL_ALV
    FORM show_alv_grid.
    * Prepare ALV_GRID before display
    * ===============================
      PERFORM init_field.
      PERFORM init_layout.
      PERFORM init_fieldcat.
      PERFORM init_excluding.
      PERFORM init_event.
    *  SORT report_data BY bukrs werks.
      PERFORM call_alv_list_display_level_1.
    ENDFORM.                    " PRINT_DETAIL
    *&      Form  VARIANT_F4   copied from RPCWCCK3
    *       Display a list of all available display variants for the ALV.
    *      <--P_varn1  Return the selected variant and return
    FORM variant_f4 CHANGING p_varn1 TYPE disvariant-variant.
      DATA: l_variant LIKE disvariant.
    * Get the list of available variants for the report
      l_variant-report = sy-repid.
      CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
        EXPORTING
          is_variant = l_variant
          i_save     = 'A'
        IMPORTING
          es_variant = l_variant.
      p_varn1 = l_variant-variant.
    ENDFORM.                               " VARIANT_F4
    *&      Form  INIT_FIELD
    FORM init_field.
      MOVE sy-repid          TO g_callback_pgm.
      MOVE 'MY_USER_COMMAND' TO g_callback_user_command.
    ENDFORM.                    " INIT_FIELD
    *&      Form  INIT_LAYOUT
    FORM init_layout.
      gs_layout-window_titlebar   = sy-title.
      gs_layout-colwidth_optimize = 'X'.
      gs_layout-expand_all        = 'X'.
      gs_layout-no_subtotals      = ''.
      gs_layout-key_hotspot       = 'X'.         " Afficher Hotspot
      gs_layout-zebra             = 'X'.
      gs_layout-group_change_edit = 'X'.
      gs_layout-f2code            = 'DISPLAY'.
    * gs_layout-max_linesize      = 400.
    * gs_layout-totals_only       = 'X'.
    ENDFORM.                    " INIT_LAYOUT
    *&      Form  INIT_FIELDCAT
    FORM init_fieldcat.
      DATA: lt_fieldcatalog    TYPE lvc_t_fcat,
            ltw_fieldcatalog   TYPE lvc_s_fcat.
      REFRESH: lt_fieldcatalog,
               gt_fieldcat_sum,
               gt_fieldcat_det.
      CLEAR   gtw_sort.
      REFRESH gt_sort.
    * ==============================================
    * Set the label column for summary report leve 1
    * ==============================================
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
          i_structure_name       = 'ZWTY_CLAIM_AVG_REP_SUM'
          i_client_never_display = 'X'
        CHANGING
          ct_fieldcat            = lt_fieldcatalog.
    *                             FIELD     pos sub  up  down Group
      PERFORM create_sort USING: 'V_PARNR'   1  'X'  'X'  ' '   'X',
                                 'NAME'      2  'X'  'X'  ' '   'X',
                                 'MAKTX'     3  'X'  'X'  ' '   'X',
                                 'MATNR'     4  'X'  'X'  ' '   'X'.
      LOOP AT lt_fieldcatalog INTO ltw_fieldcatalog.
        CLEAR: gtw_fieldcat.
        MOVE-CORRESPONDING ltw_fieldcatalog TO gtw_fieldcat.
        PERFORM set_alv_field_desc USING  ltw_fieldcatalog '1'.
        APPEND gtw_fieldcat TO gt_fieldcat_sum.
      ENDLOOP.
      PERFORM set_hot_spot TABLES gt_fieldcat_sum USING 'CLAIM_NB'.
    * =========================================
    * Field Catalog for Detail report (level 2)
    * =========================================
      REFRESH: lt_fieldcatalog.
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
          i_structure_name       = 'ZWTY_CLAIM_AVG_REP_DET'
          i_client_never_display = 'X'
        CHANGING
          ct_fieldcat            = lt_fieldcatalog.
      LOOP AT lt_fieldcatalog INTO ltw_fieldcatalog.
        CLEAR: gtw_fieldcat.
        MOVE-CORRESPONDING ltw_fieldcatalog TO gtw_fieldcat.
        PERFORM set_alv_field_desc USING  ltw_fieldcatalog '2'.
        APPEND gtw_fieldcat TO gt_fieldcat_det.
      ENDLOOP.
      PERFORM set_hot_spot TABLES gt_fieldcat_det USING 'CLMNO'.
    ENDFORM.                    " INIT_FIELDCAT
    *&      Form  INIT_SORT
    FORM create_sort USING  p_fieldname p_spos
                            p_subtot            TYPE char1
                            p_up                TYPE char1
                            p_down              TYPE char1
                            p_group             TYPE char1.
      CLEAR: gtw_sort.
      gtw_sort-fieldname = p_fieldname.
      gtw_sort-spos      = p_spos.
      gtw_sort-subtot    = p_subtot.
      gtw_sort-up        = p_up.
      gtw_sort-down      = p_down.
      gtw_sort-group     = p_group.
      APPEND gtw_sort TO gt_sort.
    ENDFORM.                    "create_sort
    *&      Form  INIT_EXCLUDING
    *       Exclude des option de l'application tool bar
    FORM init_excluding.
      CLEAR   gtw_excluding.
      REFRESH gt_excluding.
      gtw_excluding-fcode   = '&ABC'.
      APPEND gtw_excluding TO gt_excluding.
    ENDFORM.                    " INIT_EXCLUDING
    *&      Form  call_alv_list_display_level_1
    FORM call_alv_list_display_level_1.
    * DATA: l_i_save  VALUE 'U'.   "User-specific variants only
      DATA: l_i_save  VALUE 'A'.   "Any type of variants
      gs_variant1-report  = sy-repid.
      gs_variant1-variant = varn1.
      gs_layout-colwidth_optimize = true.
      wa_level_alv = 1.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program      = g_callback_pgm
          i_callback_user_command = g_callback_user_command
          is_layout               = gs_layout
          it_fieldcat             = gt_fieldcat_sum
          it_excluding            = gt_excluding
          it_sort                 = gt_sort
          i_save                  = l_i_save
          is_variant              = gs_variant1
          it_events               = eventcat
          is_print                = my_print
        TABLES
          t_outtab                = t_summary_alv
        EXCEPTIONS
          program_error           = 1
          OTHERS                  = 2.
    ENDFORM.                    " call_alv_list_display_level_1
    *&      Form  INIT_EVENT
    *       Determine quelle routine a executer selon l'event
    FORM init_event.
      eventcat_ln-name = 'TOP_OF_PAGE'.
      eventcat_ln-form = 'ALV_PAGE_HEADER'.
      APPEND eventcat_ln TO eventcat.
      eventcat_ln-name = 'END_OF_PAGE'.
      eventcat_ln-form = 'FOOTER_PAGE'.
      APPEND eventcat_ln TO eventcat.
    ENDFORM.                    " INIT_EVENT
    *&      Form  ALV_PAGE_HEADER
    FORM alv_page_header.
      DATA: l_date_time(22),
            l_char7(7),
            l_char10(10).
      DATA: p_date(10) TYPE c.
      DATA: p_time(8)  TYPE c.
      DATA: p_name(80) TYPE c.
    * Format current date and time
      WRITE sy-datum TO p_date USING EDIT MASK '____/__/__'.
      WRITE sy-uzeit TO p_time USING EDIT MASK '__:__:__'.
      CONCATENATE p_date '-' p_time
                  INTO l_date_time SEPARATED BY space.
    * Set the user name
      SELECT SINGLE
             persnumber addrnumber INTO (usr21-persnumber, usr21-addrnumber)
                 FROM  usr21
                 WHERE bname = sy-uname.
      SELECT SINGLE name_first name_last
             INTO   (adrp-name_first, adrp-name_last )
             FROM   adrp
             WHERE  persnumber = usr21-persnumber.
      CONCATENATE adrp-name_first adrp-name_last INTO p_name
      SEPARATED BY space.
      REFRESH gt_top_of_page.
      CLEAR   gtw_top_of_page.
    * Program title ------------------------------------------------
      CLEAR gtw_top_of_page.
      gtw_top_of_page-typ  = 'H'.
      gtw_top_of_page-info = sy-title.
      APPEND gtw_top_of_page TO gt_top_of_page.
      CLEAR gtw_top_of_page.
      gtw_top_of_page-typ     = 'S'.
      gtw_top_of_page-key  = 'Parameters :'.
    * Period / Posting Date -----------------------------------------
      IF s_cpudt[] IS INITIAL.
        WRITE s_postdt-low TO l_char10.
        CONCATENATE gtw_top_of_page-info
                    text-104
                    l_char10
               INTO gtw_top_of_page-info SEPARATED BY space.
        IF NOT s_postdt-high IS INITIAL.
          WRITE s_postdt-high TO l_char10.
          CONCATENATE gtw_top_of_page-info
                      text-105
                      l_char10
                      INTO gtw_top_of_page-info SEPARATED BY space.
        ENDIF.
        APPEND gtw_top_of_page TO gt_top_of_page.
      ELSE.
        CONCATENATE s_cpudt-low(4) '/' s_cpudt-low+4(2)
                    INTO l_char7 .
        CONCATENATE gtw_top_of_page-info
                    text-103
                    l_char7
                    INTO gtw_top_of_page-info SEPARATED BY space.
        IF s_cpudt-high NE space.
          CONCATENATE s_cpudt-high(4) '/' s_cpudt-high+4(2)
                      INTO l_char7 .
          CONCATENATE gtw_top_of_page-info
                      text-105
                      l_char7
                      INTO gtw_top_of_page-info SEPARATED BY space.
        ENDIF.
        APPEND gtw_top_of_page TO gt_top_of_page.
      ENDIF.
    * Display wich level we display -----------------------------
    *  IF wa_level_alv > 1.
    *    CLEAR gtw_top_of_page.
    *    IF wa_level_alv = 2.
    *      gtw_top_of_page-info = t_summary_alv-v_parnr.
    *      SHIFT gtw_top_of_page-info LEFT DELETING LEADING '0'.
    *    ENDIF.
    *    gtw_top_of_page-typ     = 'S'.
    *    gtw_top_of_page-key  = 'Partner:'.
    *    APPEND gtw_top_of_page TO gt_top_of_page.
    *  ENDIF.
    * Executed by -----------------------------------------------
      CLEAR gtw_top_of_page.
      gtw_top_of_page-typ     = 'S'.
      gtw_top_of_page-key  = 'Report executed by :'.
      gtw_top_of_page-info =  p_name.
    * * Date & time of execution --------------------------------
      APPEND gtw_top_of_page TO gt_top_of_page.
      gtw_top_of_page-key  = 'DATE :'.
      gtw_top_of_page-info = l_date_time.
      APPEND gtw_top_of_page TO gt_top_of_page.
    * Name of the report ----------------------------------------
      CLEAR gtw_top_of_page.
      gtw_top_of_page-typ  = 'A'.
    * LS_LINE-KEY:  not used for this type
      gtw_top_of_page-info = sy-repid.
      APPEND gtw_top_of_page TO gt_top_of_page.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = gt_top_of_page.
    *  IF sy-batch = 'X' AND sy-linsz > 255 AND l_ctr_newpage = 0.
    *    NEW-PAGE PRINT ON LINE-SIZE 255.   "Pour wrapper !!!!!!
    *  ENDIF.
    ENDFORM.                    "ALV_PAGE_HEADER
    *&      Form  footer_page
    FORM footer_page.
      DATA: l_footer(300),
            l_page_no(5).
      l_page_no   = sy-pagno.
      CONCATENATE 'Page' l_page_no INTO l_footer SEPARATED BY space.
      SKIP 2.
      WRITE:/001 l_footer(sy-linsz) CENTERED.
    ENDFORM.                    "footer_page
    *&      Form  MY_USER_COMMAND
    *       text
    *      -->P_SY_UCOMM  text
    *      -->P_GS_SELFIELD  text
    FORM my_user_command USING    p_sy_ucomm
                                  p_gs_selfield TYPE slis_selfield.
      DATA: l_claim_no         LIKE mcshier-hiername,
            lv_tcode_last(15).
    * ======================================================
    * Call TX WTY to display the claim. Only possible at the
    * detail report(level 3)
    * ======================================================
      CASE p_gs_selfield-fieldname.
        WHEN 'CLMNO'.
          READ TABLE t_detail_alv INDEX p_gs_selfield-tabindex.
          SHIFT t_detail_alv-clmno LEFT DELETING LEADING '0'.
          l_claim_no = t_detail_alv-clmno.
          CONCATENATE sy-tcode syst-modno
                      INTO lv_tcode_last.
          EXPORT wty_tcode_last_memoid FROM lv_tcode_last TO MEMORY
                                       ID    'WTY_TCODE_LAST_MEMOID'.
          SET PARAMETER ID 'CLMNO' FIELD l_claim_no.
          CALL TRANSACTION 'WTY' AND SKIP FIRST SCREEN.
        WHEN 'CLAIM_NB'.
    *     =====================================
    *     Display the next level of information
    *     =====================================
          CASE  wa_level_alv.
            WHEN 1.
              REFRESH: t_detail_alv.
              wa_level_alv = 2.
              READ TABLE t_summary_alv INDEX p_gs_selfield-tabindex.
              LOOP AT t_detail_info
                      ASSIGNING <fs_detail_info>
                      WHERE v_parnr    EQ t_summary_alv-v_parnr
                        AND crncy      EQ t_summary_alv-crncy
                        AND item_type  EQ t_summary_alv-item_type
                        AND ov_meinh   EQ t_summary_alv-ov_meinh
                        AND iv_meinh   EQ t_summary_alv-iv_meinh
                        AND matnr      EQ t_summary_alv-matnr.
                MOVE-CORRESPONDING <fs_detail_info> TO t_detail_alv.
                APPEND t_detail_alv.
              ENDLOOP.
              CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
                EXPORTING
                  i_callback_program      = g_callback_pgm
                  i_callback_user_command = g_callback_user_command
                  is_layout               = gs_layout
                  it_fieldcat             = gt_fieldcat_det
                  it_excluding            = gt_excluding
    *              it_sort                 = gt_sort
                  i_save                  = c_save
                  is_variant              = gs_variant2
                  it_events               = eventcat
                  is_print                = my_print
                TABLES
                  t_outtab                = t_detail_alv
                EXCEPTIONS
                  program_error           = 1
                  OTHERS                  = 2.
              wa_level_alv = 1.
          ENDCASE.
      ENDCASE.
    ENDFORM.                    " MY_USER_COMMAND
    *       FORM PRINT_ALV_GRID                                           *
    *       Print the report not on screen for special batch processing.  *
    *  -->  IT         Table to print  -   Z_HRF_BEN_CONF_FLEX
    FORM set_print_alv_grid.
      my_print-print              = 'X'.  "Force printing
      my_print-no_print_selinfos  = 'X'.
      my_print-no_print_listinfos = 'X'.
      my_print-no_new_page        = ''.   "Separate spool files
      my_print-prnt_title         = 'X'.
      my_print-prnt_info          = 'X'.
      my_print-reserve_lines      = 3.
    ENDFORM.                    "set_print_alv_grid
    *&      Form  ALV_VARIANT_F4
    FORM alv_variant_f4 USING    p_handle
                        CHANGING p_vari.
      DATA: rs_variant LIKE disvariant.
      DATA: nof4 TYPE c.
      CLEAR nof4.
      LOOP AT SCREEN.
        IF screen-name = p_vari.
          IF screen-input = 0.
            nof4 = 'X'.
          ENDIF.
        ENDIF.
      ENDLOOP.
      rs_variant-report   = sy-repid.
      rs_variant-username = sy-uname.
      rs_variant-handle   = p_handle.
      CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
        EXPORTING
          is_variant = rs_variant
          i_save     = 'A'
        IMPORTING
          es_variant = rs_variant
        EXCEPTIONS
          OTHERS     = 1.
      IF sy-subrc = 0 AND nof4 EQ space.
        p_vari = rs_variant-variant.
      ENDIF.
    ENDFORM.                               " ALV_VARIANT_F4
    *&      Form  validate_model
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM validate_model .
      DATA: l_matnr LIKE mara-matnr.
      SELECT SINGLE matnr
             INTO  l_matnr
             FROM  mara
             WHERE matnr IN s_model
               AND mtart EQ 'ZKMA'.
      IF sy-subrc NE 0.
        MESSAGE e000 WITH text-e07.
      ENDIF.
    ENDFORM.                    " validate_model
    *&      Form  select_claim_to_process
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM select_claim_to_process .
      DATA: lt_pnwtyh_dia     TYPE wty_pnwtyh_dia_tab,
            lt_pnwtyv_dia     TYPE wty_pnwtyv_dia_tab,
            lt_pvwty_dia      TYPE wty_pvwty_dia_tab,
            lt_pnwtyh_dia_tmp TYPE wty_pnwtyh_dia_tab,
            lt_pnwtyv_dia_tmp TYPE wty_pnwtyv_dia_tab,
            lt_pvwty_dia_tmp  TYPE wty_pvwty_dia_tab,
            lt_pvwty_dia_mat  TYPE wty_pvwty_dia_tab,
            lt_sel_fkdat      TYPE pwty_sel_fkdat_pt,
            lt_sel_v_parnr    TYPE pwty_sel_v_parnr_pt,
            lt_sel_clmty      TYPE pwty_sel_clmty_pt,
            lt_sel_clmgrp     TYPE pwty_sel_clmgrp_pt.
      DATA: lst_sel_fkdat LIKE LINE OF lt_sel_fkdat,
            lst_sel_clmty LIKE LINE OF lt_sel_clmty.
      DATA: BEGIN OF lt_clmno OCCURS 0,
                  clmno   LIKE pnwtyh-clmno,
            END   OF lt_clmno,
            lt_clmno_tmp   LIKE lt_clmno OCCURS 0,
            lt_claim    TYPE pwty_sel_clmno_pt,
            wa_clmno    LIKE LINE OF lt_claim.
      DATA: l_nb_claim         TYPE i.
      RANGES: lr_model FOR wty_pnwtyh_dia-z_wty_model.
      FIELD-SYMBOLS: <lfs_pnwtyh_dia>    LIKE LINE OF lt_pnwtyh_dia,
                     <lfs_pnwtyv_dia>    LIKE LINE OF lt_pnwtyv_dia,
                     <lfs_pvwty_dia_es2> LIKE LINE OF lt_pvwty_dia,
                     <lfs_pvwty_dia_mat> LIKE LINE OF lt_pvwty_dia_mat.
      REFRESH: lt_pnwtyh_dia, lt_pnwtyv_dia,lt_pvwty_dia, lt_sel_clmty,
               lr_model, t_detail_info, t_summary_alv, lt_pvwty_dia_mat.
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
       EXPORTING
    *    PERCENTAGE       = 0
         text             =  text-m01. "Extracting claim
    * ========================
    * Get the Claim to process
    * ========================
    *  SELECT clmno
    *         INTO  TABLE lt_clmno
    *         FROM  pnwtyh
    *         WHERE z_wty_convflg  EQ space
    *           AND z_wty_error    EQ space
    *  wa_clmno-sign   = 'I'.
    *  wa_clmno-option = 'EQ'.
    *  LOOP AT lt_clmno.
    *    wa_clmno-low     = lt_clmno-clmno.
    *    APPEND wa_clmno  TO lt_claim.
    *  ENDLOOP.
      lst_sel_fkdat-sign   = 'I'.
      lst_sel_fkdat-option = 'BT'.
      lst_sel_fkdat-low    = wa_low_date.
      lst_sel_fkdat-high   = wa_high_date.
      APPEND lst_sel_fkdat TO lt_sel_fkdat.
      lst_sel_clmty-sign   = 'E'.
      lst_sel_clmty-option = 'EQ'.
      lst_sel_clmty-low    = 'ZSBC'.
      APPEND lst_sel_clmty TO lt_sel_clmty.
      lt_sel_v_parnr[] = s_vend[].
      lt_sel_clmgrp[]  = s_clgrp[].
      CALL FUNCTION 'PVSDBWTY_CLAIM_SELECT'
        EXPORTING
          it_sel_fkdat     = lt_sel_fkdat
          it_sel_clmgrp    = lt_sel_clmgrp
          it_sel_v_parnr   = lt_sel_v_parnr
          it_sel_clmty     = lt_sel_clmty
    *      it_sel_clmno     = lt_claim
        IMPORTING
          et_pnwtyh_dia    = lt_pnwtyh_dia
          et_pnwtyv_dia    = lt_pnwtyv_dia
          et_pvwty_dia     = lt_pvwty_dia
        EXCEPTIONS
          no_entry_found   = 1
          authority_failed = 2
          OTHERS           = 3.
      IF sy-subrc = 3 .
        MESSAGE e309(wty) .
      ENDIF .
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
       EXPORTING
    *    PERCENTAGE       = 0
         text             =  text-m03. "Extracting claim
      LOOP AT lt_pvwty_dia
           ASSIGNING <fs_pvwty_dia>
           WHERE poskt_cust = 'MAT'.
        INSERT <fs_pvwty_dia> INTO TABLE lt_pvwty_dia_mat.
      ENDLOOP.
      it_pvwty_dia_all[] = lt_pvwty_dia[].
      SORT lt_pnwtyh_dia     BY pnguid.
      SORT lt_pvwty_dia      BY version_guid z_wty_posnr_hier.
      SORT lt_pvwty_dia_mat  BY version_guid.
      SORT it_pvwty_dia_all  BY version_guid posnr.
    * Keep Version record OC or IV in a separate table for later use
      LOOP AT lt_pnwtyv_dia
              ASSIGNING <lfs_pnwtyv_dia>.
        it_submit_records-header_guid  = <lfs_pnwtyv_dia>-header_guid.
        it_submit_records-versn        = <lfs_pnwtyv_dia>-versn.
        it_submit_records-prev_version = <lfs_pnwtyv_dia>-prev_version.
        it_submit_records-kateg        = <lfs_pnwtyv_dia>-kateg.
        it_submit_records-aktiv        = <lfs_pnwtyv_dia>-aktiv.
        it_submit_records-knumv        = <lfs_pnwtyv_dia>-knumv.
        it_submit_records-pnguid       = <lfs_pnwtyv_dia>-pnguid.
        INSERT TABLE it_submit_records.
      ENDLOOP.
    * =============
    * Process Claim
    * =============
      LOOP AT lt_pnwtyv_dia
              ASSIGNING <lfs_pnwtyv_dia>
              WHERE aktiv        EQ true   "Active version only
                AND kateg        EQ 'IV'   "Category
                AND fi_doc_exist EQ 'X'.
        CLEAR: t_detail_info, t_summary_alv.
    *   Read Header detail
        READ TABLE lt_pnwtyh_dia
             WITH KEY pnguid = <lfs_pnwtyv_dia>-header_guid
             ASSIGNING <lfs_pnwtyh_dia>
             BINARY SEARCH.
    *   Claim must be without error -----------------------------
        IF sy-subrc                      NE 0      OR
           <lfs_pnwtyh_dia>-z_wty_error   = true   OR
           <lfs_pnwtyh_dia>-z_wty_convflg = true.
          CONTINUE. "Rejected this Claim
        ENDIF.
    *   Check Model
        IF <lfs_pnwtyh_dia>-z_wty_model IN s_model.
        ELSE.
          CONTINUE. "Rejected this Claim
        ENDIF.
    *   Read first "MAT" Item information ------------------
        READ TABLE lt_pvwty_dia_mat
             WITH KEY version_guid = <lfs_pnwtyv_dia>-pnguid
             ASSIGNING <lfs_pvwty_dia_mat>
             BINARY SEARCH.
        wa_index_mat = sy-tabix.
        IF sy-subrc NE 0.
          CONTINUE. "Rejected this Claim
        ENDIF.
    *   ====================================================
    *   Process all item "MAT" linked to the current version
    *   ====================================================
        WHILE sy-subrc                     = 0
              AND
              <lfs_pvwty_dia_mat>-version_guid = <lfs_pnwtyv_dia>-pnguid.
          IF <lfs_pvwty_dia_mat>-matnr IN s_matnr.
    *       ======================================
    *       Process Items linked to the "MAT" Item
    *       ======================================
            READ TABLE lt_pvwty_dia
                 WITH KEY version_guid     = <lfs_pnwtyv_dia>-pnguid
                          z_wty_posnr_hier = <lfs_pvwty_dia_mat>-posnr
                 ASSIGNING <lfs_pvwty_dia_es2>
                 BINARY SEARCH.
            wa_index_link = sy-tabix.
            DO. "Execute only ONCE (to process all items linked to the)
              "MAT Item
              IF sy-subrc NE 0.
                EXIT.  "Exit the DO loop
              ENDIF.
              WHILE sy-subrc                     = 0
                    AND
                   <lfs_pvwty_dia_es2>-version_guid =
                           <lfs_pnwtyv_dia>-pnguid
                    AND
                   <lfs_pvwty_dia_es2>-z_wty_posnr_hier =
                           <lfs_pvwty_dia_mat>-posnr.
                IF <lfs_pvwty_dia_es2>-valiv EQ c_zero.
                ELSE.
    *             Initialize the detail information to display ---------
                  CLEAR: t_detail_info.
                  t_detail_info-v_parnr    = <lfs_pnwtyv_dia>-v_parnr.
                  t_detail_info-matnr      = <lfs_pvwty_dia_mat>-matnr.
                  t_detail_info-item_type  = <lfs_pvwty_dia_es2>-poskt_cust.
                  t_detail_info-iv_versn   = <lfs_pnwtyv_dia>-versn.
                  t_detail_info-clmno      = <lfs_pnwtyh_dia>-clmno.
                  t_detail_info-crncy      = <lfs_pnwtyv_dia>-v_crncy.
                  t_detail_info-iv_meinh   = <lfs_pvwty_dia_es2>-meinh.
                  t_detail_info-z_wty_model = <lfs_pnwtyh_dia>-z_wty_model.
                  ADD  <lfs_pvwty_dia_es2>-quant TO
                                                 t_detail_info-iv_appr_qty.
                  SELECT SINGLE kbetr
                         INTO   t_detail_info-iv_appr_rate
                         FROM   konv
                         WHERE  knumv  = <lfs_pnwtyv_dia>-knumv
                           AND  kposn  = <lfs_pvwty_dia_es2>-posnr
                           AND  kschl  = 'ZVAP'
                           AND  kinak  = space.
    *              t_detail_info-flat_indic   = <lfs_pnwtyh_dia>-z_wty_model
    *             t_detail_info-pric_indic   = <lfs_pnwtyh_dia>-z_wty_serno
                  PERFORM get_the_submit_record
                          USING <lfs_pnwtyv_dia>-header_guid
                                <lfs_pnwtyv_dia>-prev_version
                                <lfs_pnwtyh_dia>-clmno
                                <lfs_pvwty_dia_es2>-posnr.
                ENDIF.
    *           =====================
    *           Read next Linked item
    *           =====================
                PERFORM read_next_item  TABLES   lt_pvwty_dia
                                        CHANGING wa_index_link.
                IF sy-subrc = 0.
                  ASSIGN <fs_pvwty_dia> TO <lfs_pvwty_dia_es2>.
                ENDIF.
              ENDWHILE.
              EXIT.  "Exit the DO loop
            ENDDO.
          ENDIF.
    *     ====================
    *     Read next "MAT" item
    *     ====================
          PERFORM read_next_item  TABLES   lt_pvwty_dia_mat
                                  CHANGING wa_index_mat.
          IF sy-subrc = 0.
            ASSIGN <fs_pvwty_dia> TO <lfs_pvwty_dia_mat>.
          ENDIF.
        ENDWHILE.
      ENDLOOP.
    * ========================
    * Get the description text
    * ========================
      LOOP AT t_detail_info
           ASSIGNING <fs_detail_info>.
    *   Get the model text -------------------------------------
        SELECT SINGLE mfrpn
               INTO   <fs_detail_info>-z_wty_model
               FROM   mara
               WHERE  matnr = <fs_detail_info>-z_wty_model.
    *   Set Node name to regroup later by group -----------------
        SELECT SINGLE name1
               INTO   <fs_detail_info>-name
               FROM   lfa1
               WHERE  lifnr = <fs_detail_info>-v_parnr.
    *   Set Node name to regroup later by group -----------------
        SELECT SINGLE maktx
               INTO   <fs_detail_info>-maktx
               FROM   makt
               WHERE  matnr = <fs_detail_info>-matnr
                 AND  spras = sy-langu.
        MOVE-CORRESPONDING <fs_detail_info> TO t_summary_alv.
        t_summary_alv-claim_nb = 1.
        COLLECT t_summary_alv.
      ENDLOOP.
    * ===========================================
    * Calculate the average of the summary report
    * ===========================================
      LOOP AT t_summary_alv
           ASSIGNING <fs_summary_alv>.
        DIVIDE <fs_summary_alv>-ov_prop_qty   BY <fs_summary_alv>-claim_nb.
        DIVIDE <fs_summary_alv>-ov_prop_rate  BY <fs_summary_alv>-claim_nb.
        DIVIDE <fs_summary_alv>-ov_submit_qty  BY <fs_summary_alv>-claim_nb.
        DIVIDE <fs_summary_alv>-ov_submit_rate BY <fs_summary_alv>-claim_nb.
        DIVIDE <fs_summary_alv>-iv_appr_qty    BY <fs_summary_alv>-claim_nb.
        DIVIDE <fs_summary_alv>-iv_appr_rate   BY <fs_summary_alv>-claim_nb.
      ENDLOOP.
      DELETE t_summary_alv WHERE v_parnr NOT IN s_vend.
    ENDFORM.                    " select_claim_to_process
    *&      Form  SET_HOT_SPOT
    *       text
    *      -->P_0287   text
    FORM set_hot_spot  TABLES   p_fieldcat     TYPE slis_t_fieldcat_alv
                       USING    value(p_field).
      FIELD-SYMBOLS: <lfs_field_cat> LIKE LINE OF gt_fieldcat_sum.
      READ TABLE p_fieldcat WITH KEY fieldname  = p_field
           ASSIGNING <lfs_field_cat>.
      IF sy-subrc = 0.
        <lfs_field_cat>-hotspot = 'X'.
        <lfs_field_cat>-key     = 'X'.
      ENDIF.
    ENDFORM.                    " SET_HOT_SPOT
    *&      Form  set_screen_text
    *       text
    *      -->P_0997   text
    FORM set_screen_text  USING    p_label
                                   p_text.
      MOVE p_label TO :gtw_fieldcat-seltext_l,
                       gtw_fieldcat-seltext_m,
                       gtw_fieldcat-seltext_s,
                       gtw_fieldcat-reptext_ddic.
      IF p_text NE space.
        gtw_fieldcat-ddictxt = p_text.
      ENDIF.
    ENDFORM.                    " set_screen_text
    *&      Form  set_default_variant
    *       text
    *      -->P_0822   text
    *      <--P_GS_VARIANT1  text
    FORM set_default_variant  CHANGING p_variant     TYPE disvariant
                                       p_disvar      TYPE slis_vari.
    * Get default variant
      CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
        EXPORTING
          i_save     = c_save
        CHANGING
          cs_variant = p_variant
        EXCEPTIONS
          not_found  = 2.
      IF sy-subrc = 0.
        p_disvar =  p_variant-variant.
      ENDIF.
    ENDFORM.                    " set_default_variant
    *&      Form  validate_vendor
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM validate_vendor.
      DATA: l_lifnr LIKE lfa1-lifnr.
      IF s_vend[] IS INITIAL.
      ELSE.
        SELECT SINGLE lifnr
               INTO   l_lifnr
               FROM   lfa1
               WHERE  lifnr IN s_vend.
        IF sy-subrc NE 0.
          MESSAGE e000 WITH text-e01.
        ENDIF.
      ENDIF.
    ENDFORM.                    " validate_vendor
    *&      Form  inform_claim_error
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM inform_claim_error USING value(p_claim_no)
                                  value(p_version).
      DATA: l_text1(50),
            l_text2(50).
      CONCATENATE text-301
                  p_claim_no
                  INTO l_text1 SEPARATED BY space.
      CONCATENATE text-302
                  p_version
                  text-303
                  INTO l_text2 SEPARATED BY space.
      CALL FUNCTION 'POPUP_TO_INFORM'
        EXPORTING
          titel = text-200
          txt1  = l_text1
          txt2  = l_text2
          txt3  = ' '
          txt4  = text-304.
    ENDFORM.                    " inform_claim_error
    *&      Form  validate_posting_parameter
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM validate_posting_parameter .
      DATA: l_low_date  TYPE d,
            l_high_date TYPE d.
      CLEAR: wa_low_date, wa_high_date.
    * Posting parameters must be entered
      IF s_cpudt[] IS INITIAL AND s_postdt[] IS INITIAL.
        MESSAGE e000 WITH text-e04.
      ENDIF.
    * Posting paramters can't be intered at the same time
      IF s_cpudt[] IS INITIAL OR s_postdt[] IS INITIAL.
      ELSE.
        MESSAGE e000 WITH text-e03.
      ENDIF.
    * Validate posting period ---------------------------------------------
      IF s_postdt[] IS INITIAL.
        READ TABLE s_cpudt INDEX 1.
        IF s_cpudt-low IS INITIAL.
          MESSAGE e000 WITH text-e03.
        ENDIF.
        PERFORM validate_period USING    s_cpudt-low
                                CHANGING l_low_date
                                         l_high_date.
        wa_low_date  = l_low_date.
        wa_high_date = l_high_date.
        IF s_cpudt-high IS INITIAL.
        ELSE.
          PERFORM validate_period USING    s_cpudt-high
                                  CHANGING l_low_date
                                           l_high_date.
          IF s_cpudt-high LT s_cpudt-low.
            MESSAGE ID 'DB' TYPE 'E' NUMBER '650' .
          ENDIF.
          wa_high_date = l_high_date.
        ENDIF.
      ELSE.
    *   Validate posting date --------------------------------------------
        READ TABLE s_postdt INDEX 1.
        wa_low_date  = s_postdt-low.
        IF s_postdt-high IS INITIAL.
          wa_high_date = wa_low_date.
        ELSE.
          wa_high_date = s_postdt-high.
        ENDIF.
      ENDIF.
    ENDFORM.                    " validate_posting_parameter
    *&      Form  get_fin_period
    *       Get the financial period from 1960 to 9999
    *  -->  p1        text
    *  <--  p2        text
    FORM get_fin_period USING value(p_year_low)
                              value(p_year_high).
      DATA : BEGIN OF fp_table OCCURS 0,
                   periv LIKE t009b-periv, "FINANCIAL YEAR VARIANT
                   bdatj LIKE t009b-bdatj, "CALENDAR YEAR
                   bumon LIKE t009b-bumon, "MONTH
                   butag LIKE t009b-butag, "DAY OF MONTH
                   poper LIKE t009b-poper, "COST PERIOD
                   reljr LIKE t009b-reljr, "YEAR SHIFT
             END OF fp_table.
      DATA: l_fin_bdatj       LIKE t009b-bdatj,
            l_period_start    TYPE d,
            l_period_end      TYPE d,
            l_prev_period_end TYPE d,
            l_prev_fin_bdatj  LIKE t009b-bdatj,
            l_prev_poper      LIKE t009b-poper,
            l_count           TYPE n.
    * Get the Fiscal year variant periods
      SELECT periv bdatj bumon butag poper reljr
             INTO  TABLE fp_table
             FROM  t009b
             WHERE periv = 'ZB'.
      LOOP AT fp_table.
        IF l_prev_period_end NE '00000000'.
          l_period_start = l_prev_period_end + 1.
        ENDIF.
        CONCATENATE fp_table-bdatj fp_table-bumon fp_table-butag
                    INTO l_period_end.
        l_prev_period_end = l_period_end.
        l_fin_bdatj       = fp_table-bdatj + fp_table-reljr.
        IF c_year_low NE ''      AND l_fin_bdatj LT p_year_low.
          CONTINUE.
        ELSEIF p_year_high NE '' AND l_fin_bdatj GT p_year_high.
          CONTINUE.
        ELSEIF p_year_low NE '' AND p_year_high EQ '' AND
               l_fin_bdatj  GT c_year_low.
          CONTINUE.
        ENDIF.
        IF l_prev_fin_bdatj EQ l_fin_bdatj         AND
           l_prev_poper     EQ fp_table-poper.
          it_period-end    = l_period_end.
          MODIFY it_period TRANSPORTING  end
                 WHERE year  = it_period-year
                   AND poper = it_period-poper.
        ELSE.
          it_period-year   = l_fin_bdatj.
          it_period-poper  = fp_table-poper+1.
          it_period-start  = l_period_start.
          it_period-end    = l_period_end.
          INSERT TABLE it_period.
        ENDIF.
        l_prev_fin_bdatj = l_fin_bdatj.
        l_prev_poper     = fp_table-poper.
        IF l_count EQ 0.
          l_count = l_count + 1.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " get_fin_period
    *&      Form  set_period_to_analyse
    *       Find the fiscal period for a specific date
    *  -->  p1        text
    *  <--  p2        text
    FORM set_period_to_analyse.
      LOOP AT it_period
           ASSIGNING <fs_it_period>
           WHERE start LE sy-datum
             AND end   GE sy-datum.
        CONCATENATE <fs_it_period>-year
                    <fs_it_period>-poper
                    INTO s_cpudt-low.
        s_cpudt-sign   = 'I'.
        s_cpudt-option = 'EQ'.
        APPEND s_cpudt.
        EXIT.
      ENDLOOP.
    ENDFORM.                    " set_period_to_analyse
    *&      Form  validate_material
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM validate_material .
      DATA: l_matnr LIKE mara-matnr.
      IF s_matnr[] IS INITIAL.
      ELSE.
        SELECT SINGLE matnr
               INTO   l_matnr
               FROM   mara
               WHERE  matnr IN s_matnr.
        IF sy-subrc NE 0.
          MESSAGE e000 WITH text-e02.
        ENDIF.
      ENDIF.
    ENDFORM.                    " validate_material
    *&      Form  validate_claim_group
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM validate_claim_group .
      DATA: l_clmgrp LIKE cwty006-clmgrp.
      IF s_clgrp[] IS INITIAL.
      ELSE.
        SELECT SINGLE clmgrp
               INTO   l_clmgrp
               FROM   cwty006
               WHERE  clmgrp IN s_clgrp.
        IF sy-subrc NE 0.
          MESSAGE e000 WITH text-e06.
        ENDIF.
      ENDIF.
    ENDFORM.                    " validate_claim_group
    *&      Form  set_alv_field_desc
    *       text
    *      -->P_LTW_FIELDCATALOG  text
    *      <--P_GTW_FIELDCAT  text
    FORM set_alv_field_desc USING value(p_fieldcat) TYPE lvc_s_fcat
                                  value(p_level).
      gtw_fieldcat-seltext_l    = p_fieldcat-scrtext_l.
      gtw_fieldcat-seltext_m    = p_fieldcat-scrtext_m.
      gtw_fieldcat-seltext_s    = p_fieldcat-scrtext_s.
      gtw_fieldcat-reptext_ddic = p_fieldcat-reptext.
      CASE p_fieldcat-fieldname.
        WHEN 'NAME'.
          PERFORM set_screen_text USING 'Vendor Name'           'L'.
        WHEN 'MAKTX'.
          PERFORM set_screen_text USING 'Material Description'  'L'.
        WHEN 'CLAIM_NB'.
          PERFORM set_screen_text USING '#Claims'               'L'.
        WHEN 'IV_MEINH'.
          PERFORM set_screen_text USING 'IV UoM'                'L'.
        WHEN 'OV_MEINH'.
          PERFORM set_screen_text USING 'OV UoM'                'L'.
        WHEN 'FLAT_INDIC'.
          PERFORM set_screen_text USING 'Flat Rate Ind.'        'L'.
        WHEN 'PRIC_INDIC'.
          PERFORM set_screen_text USING 'Price Ind.'            'L'.
        WHEN 'OV_PROP_QTY'.
          IF p_level = 1. "Summary report
    *BEGIN OF TR#D03K935718
    *        PERFORM set_screen_text USING 'OV avg. Prop. Qty'    'L'.
             PERFORM set_screen_text USING 'Avg Prop Qty Sub'    'L'.  "RFC2917
    *END OF TR#D03K935718
          ELSE.
            PERFORM set_screen_text USING 'OV Prop. Qty'         'L'.
          ENDIF.
        WHEN 'OV_PROP_RATE'.
          IF p_level = 1. "Summary report
    *BEGIN OF TR#D03K935718
    *        PERFORM set_screen_text USING 'OV avg. Prop. Rate $'  'L'.
             PERFORM set_screen_text USING 'Avg Prop Rate Sub'  'L'.    "RFC2917
    *END OF TR#D03K935718
          ELSE.
            PERFORM set_screen_text USING 'OV Prop. Rate $'       'L'.
          ENDIF.
        WHEN 'OV_SUBMIT_QTY'.
          IF p_level = 1. "Summary report
    *BEGIN OF TR#D03K935718
    *        PERFORM set_screen_text USING 'OV avg. Submit Qty'    'L'.
             PERFORM set_screen_text USING 'Avg Qty Sub'    'L'.          "RFC2917
    *END OF TR#D03K935718
          ELSE.
            PERFORM set_screen_text USING 'OV Submit Qty'         'L'.
          ENDIF.
        WHEN 'OV_SUBMIT_RATE'.
          IF p_level = 1. "Summary report
    *BEGIN OF TR#D03K935718
    *        PERFORM set_screen_text USING 'OV avg. Submit Rate $' 'L'.
            PERFORM set_screen_text USING 'Avg Rate Sub' 'L'.        "RFC2917
    *END OF TR#D03K935718
          ELSE.
            PERFORM set_screen_text USING 'OV Submit Rate $'      'L'.
          ENDIF.
        WHEN 'IV_APPR_QTY'.
          IF p_level = 1. "Summary report
    *BEGIN OF TR#D03K935718
    *        PERFORM set_screen_text USING 'IV Avg. Appr. Qty'     'L'.
            PERFORM set_screen_text USING 'Avg Qty Pd'     'L'.     "RFC2917
    *END OF TR#D03K935718
          ELSE.
            PERFORM set_screen_text USING 'IV Appr. Qty'          'L'.
          ENDIF.
        WHEN 'IV_APPR_RATE'.
          IF p_level = 1. "Summary report
    *BEGIN OF TR#D03K935718
    *        PERFORM set_screen_text USING 'IV Avg. Appr. Rate $'  'L'.
            PERFORM set_screen_text USING 'Avg Rate Pd'  'L'.   "RFC2917
    *END OF TR#D03K935718
          ELSE.
            PERFORM set_screen_text USING 'IV Appr. Rate $'       'L'.
          ENDIF.
        WHEN 'OV_VERSN'.
          PERFORM set_screen_text USING 'OV Versn.'               'L'.
        WHEN 'IV_VERSN'.
          PERFORM set_screen_text USING 'IV Versn.'               'L'.
        WHEN OTHERS.
          gtw_fieldcat-ddictxt      = p_fieldcat-selddictxt.
      ENDCASE.
    *   Initialisation des Labels des entetes de colonne -------------------
      gtw_fieldcat-no_out       = p_fieldcat-no_out.
      gtw_fieldcat-emphasize    = p_fieldcat-emphasize.
      gtw_fieldcat-fix_column   = p_fieldcat-fix_column.
      gtw_fieldcat-icon         = p_fieldcat-icon.
      gtw_fieldcat-no_zero      = 'X'.
      gtw_fieldcat-do_sum       = p_fieldcat-do_sum.
    ENDFORM.                    " set_alv_field_desc
    *&      Form  validate_period
    *       text
    *      -->P_S_CPUDT_LOW  text
    FORM validate_period  USING value(p_period)
                          CHANGING p_low_date    TYPE d
                                   p_high_date   TYPE d.
      DATA: l_year(4),
            l_poper(2).
      l_year  = p_period(4).
      l_poper = p_period+4(2).
      READ TABLE it_period WITH KEY year  = l_year
                                    poper = l_poper
                 ASSIGNING <fs_it_period>.
      IF sy-subrc NE 0.
        MESSAGE e000 WITH text-e04.
      ENDIF.
      p_low_date  = <fs_it_period>-start.
      p_high_date = <fs_it_period>-end.
    ENDFORM.                    " validate_period
    *&      Form  read_next_item
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM read_next_item  TABLES pt_pvwty_dia     STRUCTURE wty_pvwty_dia
                         CHANGING p_index TYPE i.
      p_index = p_index + 1.
    *     Read next Item information ------------------------------
      READ TABLE pt_pvwty_dia INDEX p_index
           ASSIGNING <fs_pvwty_dia>.
    ENDFORM.                    " read_next_item
    *&      Form  get_the_submit_record
    *       text
    *      -->P_<LFS_PNWTYV_DIA>_HEADER_GUID  text
    *      -->P_<LFS_PNWTYV_DIA>_PREV_VERSION  text
    FORM get_the_submit_record  USING    p_header_guid
                                         p_prev_version
                                         p_claim_no
                                         p_posnr.
      DATA: l_nb_while       TYPE i,
            l_zaehk          LIKE konv-zaehk,
            l_submit_found(1).
    * ... USD1092841 - Add Start
      FIELD-SYMBOLS: <fs_submit_rec_vs3> TYPE tp_submit_records.
    * ... USD1092841 - Add End
      CLEAR: l_submit_found, l_nb_while.
      READ TABLE it_submit_records
           WITH KEY header_guid  = p_header_guid
                    versn        = p_prev_version
           ASSIGNING <fs_submit_rec_vs2>.
      WHILE sy-subrc = 0 .
        ADD 1 TO l_nb_while.
    *   if more than 30 loop(endless loop), it means som

    Hi Siddarth
    As per query, if you want to display sums automatically when you report is displayed for the first time, you'll have to modify your field catalog a bit.
    To acheive this, you need to identify the field for which the totals are calculated ex- for every new material num, or for every new documnet number etc.
    once you have this info, you identify the field that has to be totaled.
    then while building your fieldcatalog, set this parameter :
    l_wa_fieldcat-do_sum     =  'X' for the field that has to be totaled.
    and when you build a sort table then set this parameter:
    l_t_sort           TYPE slis_t_sortinfo_alv.
    l_s_sort-subtot    = 'X'. for the field for which totals are calculated.
    Hope this helps.
    Cheers
    Ravish
    Reward if helpful

Maybe you are looking for

  • Google  is a total mess on the iPad

    The website is horrible and the app is worse. There's so many things wrong with it I can't take the time here to completely describe everything that is wrong. But navigation is horribly unintuitive. There are google plus reviews of businesses, but no

  • Why can I only load https pages, Safari and Maverick?

    Hi I can't load http web pages in Safari, but can load https pages. Have similar problem with Opera, but no problem loading http web pages on my iPad. The problem started yesterday and is on my iMac.  So am guessing that it is a mavericks setting iss

  • AccessClassInPackage.sun.awt.geom

    My class imports sun.awt.geom.Crossings in order to implement a similar-to-java.awt.Polygon intersects method, upon float values. This takes place in an applet. The all known error message appears in the java console: java.security.AccessControlExcep

  • Oracle and XML Parser

    Hi friends I'm trying to load xmlparserv2.jar into the database using loadjava..it is creating and loading the classes successfully but while resolving it's giving an error i.e. referenced object SCOTT.oracle/xml/parser/v2/<ClassName> could not be re

  • Search Genre by Release Date?

    Is there a way I can search by release date in iTunes store? For example, if I wanted to find all Soul/R&B released in the last week, does iTunes store allow that kind of search?