TOP-OF-PAGE During line-selection in alv report

Hi Expart
In intractive Alv report u using top-of-page during line-selection . If u using so u give me one example with codeing .
Regards
Bhabani

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

Similar Messages

  • How To Print Field Value in TOP-OF-PAGE During Line Selection.

    How To Print Field Value in TOP-OF-PAGE During Line Selection when double click on field.

    (If my memory serves me well (not used for long time ago)
    Assign values to system fields sy-tvar0 - sy-tvar9, they will replace the placeholders "&0" through "&9" in the list headers and column headers.
    TOP-OF-PAGE DURING LINE-SELECTION.
         WRITE: / 'Interactive Report &3'.
      WRITE record-vbeln TO sy-tvar3.
    Regards,
    Raymond

  • Page number in Top of page during line selection

    Hi All,
    I am generating an interactive report.
    I want to display the same header at each page break.
    How to restrict the page size in At line-selection?
    I want to display page in format Page X of Y for each page break?How to handle it?
    Thanks in advance.
    Regards,
    Sandy

    Hi,
    Try the code:
    REPORT ZPAGETEST NO STANDARD PAGE HEADING LINE-SIZE 40
    LINE-COUNT 20.
    DATA:COUNT(6) TYPE N.
    DATA: LAST_PAGE_NO LIKE SY-PAGNO.
    DATA: TOTPAGE(6) TYPE C .
    TOP-OF-PAGE.
    WRITE:20 SY-PAGNO ,'of', '££££££'.
    START-OF-SELECTION.
    DO 100 TIMES.
    WRITE: / COUNT.
    COUNT = COUNT + 1.
    ENDDO.
    LAST_PAGE_NO = SY-PAGNO.
    TOTPAGE = SY-PAGNO.
    DO LAST_PAGE_NO TIMES.
    READ LINE 1 OF PAGE SY-INDEX .
    REPLACE '££££££' WITH TOTPAGE INTO SY-LISEL.
    MODIFY CURRENT LINE.
    ENDDO.
    Regards,
    Sesh

  • At line selection in alv report

    hi,
    i had developed a code in which at 1st execution the normal output is displayed and if i click on a purticular Itemid it displays the whole of items  and i want to display only that item's data which i had clicked on.
    following is the code which i am using for the at line-selection.
    **BEGIN - TEST CODE FOR LINE SELECTION**
    data: fld LIKE ITAB-ITEMID,
          val LIKE ITAB-ITEMID.
    at line-selection.
      get cursor field fld value val.
      IF fld = 'ITAB-ITEMID'.
            SET PARAMETER ID 'ANR' FIELD val.
            CLEAR ITAB-ITEMID.
      ENDIF.
        PERFORM PRN_SMSTOCK_ALV USING VAL.
        IF SY-SUBRC <> 0.
          MESSAGE 'NO RECORD FOUND' TYPE 'W'.
        ENDIF.
      FORM PRN_SMSTOCK_ALV USING VAL.
    *****END OF TEST CODE FOR LINE SELECTION******
    plzz help me out by providing the solution for this problem.

    Hi,
    You need to add extra piece of code as below:
    call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                i_callback_program      = gd_repid
                i_callback_top_of_page   = 'TOP-OF-PAGE'
                I_callback_user_command = 'USER_COMMAND'   "see FORM
                is_layout               = gd_layout
                it_fieldcat             = fieldcatalog[]
                i_save                  = 'X'
           tables
                t_outtab                = it_ekko
           exceptions
                program_error           = 1
                others                  = 2.
    *       FORM USER_COMMAND                                          *
    *       --> R_UCOMM                                                *
    *       --> RS_SELFIELD                                            *
    FORM user_command USING r_ucomm LIKE sy-ucomm
                      rs_selfield TYPE slis_selfield.
    * Check function code
      CASE r_ucomm.
        WHEN '&IC1'.
    *   Check field clicked on within ALVgrid report
        IF rs_selfield-fieldname = 'EBELN'.
    *     Read data table, using index of row user clicked on
          READ TABLE it_ekko INTO wa_ekko INDEX rs_selfield-tabindex.
    *     Set parameter ID for transaction screen field
          SET PARAMETER ID 'BES' FIELD wa_ekko-ebeln.
    *     Sxecute transaction ME23N, and skip initial data entry screen
          CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
        ENDIF.
      ENDCASE.
    ENDFORM.
    "For further information please refer the link below :
    http://www.sapdev.co.uk/reporting/alv/alvgrid_ucomm.htm
    Thanks,
    Sriram Ponna.

  • Top-of-page for list display thru ALV

    Hi All,
    I was suppose to write a detail report thru ALV, this I have handled thru hotspot and in the user_command,I am have the below code.. for ALv I am using FM REUSE_ALV_GRID_DISPLAY
    FORM User_command.
    WHEN '&IC1'.
    PERFORM LIST_DISPLAY using RS_SELFIELD-tabindex.
    ENDFORM.
    FORM LIST_DISPLAY USING    P_INDEX.
    LEAVE TO LIST-PROCESSING AND RETURN TO SCREEN 500.
    SET PF-STATUS space.
    SUPPRESS DIALOG.
    Read table g_t_sum index p_index.
    loop at g_t_emp where code = g_t_sum-code and
                          keyfld = g_t_sum-keyfld
      write :/ g_t_emp-pernr, 10(25) g_t_emp-sname.
    endloop.
    ENDFORM.
    The above write statment is not trigerring either top-of-page ot top-od-page during line-selection.
    I have even tried pushing the event and form name into it it_events..
    Kindly suggest how to go about this, I need to get top-of-page for this list-display.
    Thanks in advance
    Regards,
    Mangalagi S V

    Hi All,
    Thanks for all your replies.
    I am not looking at top_of_page for GRID, it's working for me but I need top_of_page for the list display that is for the list which I am generating when the users double click it particular row.
    By default I am getting the below header automatically.
    Dynamic data selection                         1
    Though I have coded the header in top-of-page during line selection since I am writing the list under USER_COMMAND, I thought I will get the header but it's not..
    The FM is attached below..
    Ausgaberoutine mit FB REUSE_ALV_GRID_DISPLAY
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
              i_callback_program          = g_f_repid
              i_callback_pf_status_set    = 'SET_PF_STATUS'
              i_callback_user_command     = 'USER_COMMAND'
              i_callback_top_of_page      = 'TOP_OF_PAGE'
              is_layout                   = g_r_layout
              it_fieldcat                 = g_t_fcat
              i_save                      = 'A'
             is_variant                  = s_variant         "70492INF0039
              is_variant                  = g_f_variant        "70492INF0039
              is_events                   = it_events[]
           TABLES
               t_outtab                    = g_t_sum.
          FORM USER_COMMAND                                             *
         Callbackroutine: Ausgabe Fehlerliste             XDGL9CK069538 *
    FORM USER_COMMAND USING R_UCOMM
                            RS_SELFIELD TYPE SLIS_SELFIELD.
    case r_ucomm.
    when 'OK'.
    WHEN '&IC1'.
    PERFORM LIST_DISPLAY using RS_SELFIELD-tabindex.
    endcase.
    ENDFORM.
    Kindly suggest
    Thanks in advance.
    Regards,
    Mangalagi S V

  • What happens exactly during line selection

    Hi,
    What happens exactly during line selection of a report.
    I mean suppose I display 20 purchase orders with data in a list.When I select one line say I call ME23N.
    How will only that PO be called.
    What happens internally?
    Regards,
    Subhashini

    Each time you use HIDE statement, data are stored in special HIDE Area . The system inserts field name you are hiding together with its value. Current output line (SY-LINNO) is used to populate which index that entry will receive in Hide Area. That's
    why HIDE statement must be entered before beginning a new line.
    During line selection system variable SY-LILLI is read (index of selected line), then corresponding line in Hide Area is read and values are transported back to corresponding fields (data objects) you have hidden.
    What is also important is that each list (basic, detailed) has its own Hide Area, that's why you can even use HIDE when you are already in AT LINE-SELECTION event block, hence create subsequent detialed lists. This will fill new Hide Area of detailed list and so on.
    This topic is well discussed in BC405 course.
    Regards
    Marcin

  • How to display horizontal line in top-of-page by using object oriented ALV?

    How to display horizontal line in top-of-page by using object oriented ALV.
    I am created top-of-page in object oriented alv.
    But not be successes in showing horizontal line in it.
    Can any one pls give solution for this..
    Thanks and regards..

    Hi
    Try like this
    data: gt_list_top_of_page type slis_t_listheader. " Top of page text. 
    Initialization. 
    perform comment_build using gt_list_top_of_page[]. 
    form top_of_page. 
    * Note to self: the gif must be loaded into transaction OAOR with 
    * classname 'PICTURES' AND TYPE 'OT' to work with ALV GRID Functions. 
    * I Loaded NOVALOGO2 into system. 
    call function 'REUSE_ALV_COMMENTARY_WRITE' 
         exporting 
    * I_LOGO = 'NOVALOGO2' 
    * i_logo = 'ENJOYSAP_LOGO' 
             it_list_commentary = gt_list_top_of_page. 
    endform. " TOP_OF_PAGE 
    form comment_build using e04_lt_top_of_page type slis_t_listheader. 
    data: ls_line type slis_listheader. 
          clear ls_line. 
          ls_line-typ = 'A'. 
          ls_line-info = 'Special'(001). 
          fgrant = xgrant. 
          concatenate ls_line-info fgrant 
          'Stock Option Report to the board'(002) 
                 into ls_line-info separated by space. 
                        condense ls_line-info. 
          append ls_line to e04_lt_top_of_page. 
    endform. " COMMENT_BUILD
    Use following syntex for footer print in alv:
    * For End of Page
    form END_OF_PAGE.
      data: listwidth type i,
            ld_pagepos(10) type c,
            ld_page(10)    type c.
      write: sy-uline(50).
      skip.
      write:/40 'Page:', sy-pagno .
    endform.
    *  For End of Report
    form END_OF_LIST.
      data: listwidth type i,
            ld_pagepos(10) type c,
            ld_page(10)    type c.
      skip.
      write:/40 'Page:', sy-pagno .
    endform.
    check this link
    http://abapprogramming.blogspot.com/
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/5dc3e690-0201-0010-1ebf-b85b3bed962d
    Changing width of a custom container dynamically
    Display Page numbers in ALV
    Insert picture in selection screen.
    Logo in OO ALV Grid
    Reward all helpfull answers
    Regards
    Pavan

  • AT line selection in ALV

    Hi Experts,
    How to apply the below logic in ALV. ( how to apply at line selection in ALV )
    AT LINE-SELECTION.
      DATA NO TYPE I.
      DATA F(16).
      DATA G(16).
      CASE SY-LSIND.
        WHEN 1.
          GET CURSOR FIELD F.
          IF F EQ 'IT_FIRST-MATNR'.
            PERFORM DRILL_DOWN.
          ENDIF.
      ENDCASE.
    FORM DRILL_DOWN.
    LOOP AT IT_EBAN WHERE MATNR = IT_FIRST-MATNR
                        AND WERKS = IT_FIRST-WERKS.
    WRITE: /2 IT_EBAN-BANFN,
               15 IT_EBAN-FKZTX,
               35 IT_EBAN-MENGE,
               55 IT_EBAN-MEINS.
      ENDLOOP.
    ENDFORM.

    Hi,
    When an Interactive Report is needed in Classical Display, we go for AT LINE-SELECTION. But when the same is needed in ALV Display, this method won't work. Instead, we need to use other way which is explained below:
    We use REUSE_ALV_GRID_DISPLAY for ALV Display. Now, normally we call that FM in the following way:
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    i_callback_program = 'PROGRAM_NAME'
    it_fieldcat = tb_fieldcat
    TABLES
    t_outtab = tb_output.
    When it is needed to get an Interactive ALV, call the same FM in the following manner:
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    i_callback_program = 'ZTEST75599_1'
    it_fieldcat = tb_fieldcat
    i_callback_user_command = 'USER_COMMAND'
    TABLES
    t_outtab = tb_output.
    Now, in the report, create a subroutine with the name USER_COMMAND as follows:
    FORM user_command USING p_ucomm LIKE sy-ucomm
    p_selfield TYPE slis_selfield.
    CASE p_ucomm.
    WHEN '&IC1'. " &IC1 - SAP standard code for double-clicking
    Based on the requirement, write the logic *
    ENDCASE.
    ENDFORM.
    No need to call the subroutine as PERFORM user_command. This will be takane care by REUSE_ALV_GRID_DISPLAY. We need to just write the subroutine in the report. That suffices.
    Some more useful points for Interactive ALV:
    1. If Hotspot is needed, then that should be done by declaring hotspot (one field in slis_t_fieldcat_alv) as 'X' in tb_fieldcat which is of type slis_t_fieldcat_alv. When hotspot is active, single click will be enough or else you should double click on the output data.
    2. In Classical Display, when it is needed to read the record on which we double clicked, we do that in following way:
    AT LINE-SELECTION.
    GET CURSOR LINE wf_line. " wf_line gives the line number on which it has been clicked
    READ LINE wf_line OF CURRENT PAGE.
    But this won't work for ALV. Instead, the following logic can be used:
    FORM user_command USING p_ucomm LIKE sy-ucomm
    p_selfield TYPE slis_selfield.
    CASE p_ucomm.
    WHEN '&IC1'. " &IC1 - SAP standard code for double-clicking
    READ TABLE tb_output INTO wa_output INDEX p_selfield-tabindex.
    IF sy-subrc EQ 0.
    Based on the requirement, write the logic *
    ENDIF.
    ENDCASE.
    ENDFORM.
    Hope this helps you...

  • At Line-selection in ALV for more than one field.

    How to use At Line-selection in ALV Basic Report where there are more than one field for displaying Secondary Lists.
    Ex: In Basic List there are 3 fields Volume_m Volume_y and Volume_i.When i click on any of the field i need to display the secondary list for that particular field.

    Hi Pavan,
                  Use User-command event of ALV.
    Refer this code :
    form BUILD_EVENTCAT  using    p_i_eventcat TYPE SLIS_T_EVENT.
    DATA: I_EVENT TYPE SLIS_ALV_EVENT.
    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    EXPORTING
       I_LIST_TYPE           = 0
    IMPORTING
       ET_EVENTS             = P_I_EVENTCAT
    EXCEPTIONS
      LIST_TYPE_WRONG       = 1
      OTHERS                = 2
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
      clear I_event.
      read table p_i_eventcat with key name = slis_ev_user_command into I_event.
      if sy-subrc = 0.
        move 'USER_COMMAND' to I_event-form.
        append I_event to p_i_eventcat.
      endif.
    form USER_COMMAND' using p_ucomm type sy-ucomm
                               p_selfield type slis_selfield.
      case p_ucomm.
      WHEN '&IC1'.                       "&IC1 is the Fcode for double click
    Use  P_ELFIELD-VALUE  for further processing . this  will contain the value on which u will double click
    endcase.
    Reward points if helpful.
    Regards,
    Hemant

  • To hide some headings in top of page during sorting of fields...

    dear experts,
    I have a report in which i am fetching multiple company codes in report and in o/p they are displayed according to company codes, but during sorting of any field in list i want to hide some of the headings in top of page...for any of the radio buttons the headings which i want to hide are...
    1) company code
    2) opening balance and
    3) closing balance
    please help...my code is as follows...
    TYPE-POOLS:slis.
    TABLES:bkpf,bseg,kna1,bsid.
    TYPES:BEGIN OF ty_bsad,
    bukrs TYPE bsad-bukrs,
    gjahr TYPE bsad-gjahr,
    kunnr TYPE bsad-kunnr,
    belnr TYPE bsad-belnr,
    budat TYPE bsad-budat,
    xblnr TYPE bsad-xblnr,
    bldat TYPE bsad-bldat,
    augdt TYPE bsad-augdt,
    dmbtr type bsad-dmbtr,
    END OF ty_bsad.
    TYPES:BEGIN OF ty_kna1,
    kunnr TYPE kna1-kunnr,
    name1 TYPE kna1-name1,
    city  TYPE kna1-ort01,
    END OF ty_kna1.
    TYPES:BEGIN OF ty_knb1,
    kunnr TYPE knb1-kunnr,
    bukrs TYPE knb1-bukrs,
    vzskz TYPE knb1-vzskz,
    END OF ty_knb1.
    TYPES:BEGIN OF ty_bkpf,
    bukrs TYPE bkpf-bukrs,
    gjahr TYPE bkpf-gjahr,
    hwaer TYPE bkpf-hwaer,
    kursf TYPE bkpf-kursf,
    bktxt TYPE bkpf-bktxt,
    belnr TYPE bkpf-belnr,
    budat TYPE bkpf-budat,
    xblnr TYPE bkpf-xblnr,
    bldat TYPE bkpf-bldat,
    waers TYPE bkpf-waers,
    END OF ty_bkpf.
    TYPES:BEGIN OF ty_bsid,
    bukrs TYPE bsid-bukrs,
    gjahr TYPE bsid-gjahr,
    kunnr TYPE bsid-kunnr,
    belnr TYPE bsid-belnr,
    budat TYPE bsid-budat,
    xblnr TYPE bsid-xblnr,
    bldat TYPE bsid-bldat,
    augdt TYPE bsid-augdt,
    dmbtr type bsid-dmbtr,
    END OF ty_bsid.
    TYPES:BEGIN OF ty_bseg,
    bukrs TYPE bseg-bukrs,
    gjahr TYPE bseg-gjahr,
    belnr TYPE bseg-belnr,
    kunnr TYPE bseg-kunnr,
    werks TYPE bseg-werks,
    umskz TYPE bseg-umskz,
    zuonr TYPE bseg-zuonr,
    dmbtr TYPE bseg-dmbtr,
    zbd1t TYPE bseg-zbd1t,
    sgtxt TYPE bseg-sgtxt,
    shkzg TYPE bseg-shkzg,
    zterm TYPE bseg-zterm,
    zfbdt TYPE bseg-zfbdt,
    END OF ty_bseg.
    TYPES:BEGIN OF ty_open,
    bukrs TYPE bsid-bukrs,
    shkzg TYPE bsid-shkzg,
    dmbtr TYPE bsid-dmbtr,
    umskz TYPE bsid-umskz,
    END OF ty_open.
    **Main internal Table
    **For both open & cleared Customer
    DATA:BEGIN OF it_main_all OCCURS 0,
    bukrs TYPE bsad-bukrs,
    gjahr TYPE bsad-gjahr,
    kunnr TYPE bsad-kunnr,
    belnr TYPE bsad-belnr,
    budat TYPE bsad-budat,
    xblnr TYPE bsad-xblnr,
    bldat TYPE bsad-bldat,
    augdt TYPE bsad-augdt,
    dmbtr type bsad-dmbtr,
    hwaer TYPE bkpf-hwaer,
    kursf TYPE bkpf-kursf,
    bktxt TYPE bkpf-bktxt,
    name TYPE kna1-name1,
    city TYPE kna1-ort01,
    vzskz TYPE knb1-vzskz,
    lights TYPE c,
    END OF it_main_all.
    **For Opening balance
    DATA:BEGIN OF it_main_open1 OCCURS 0,
    bukrs TYPE bsid-bukrs,
    opening TYPE p DECIMALS 2,
    END OF it_main_open1.
    **Internal tables
    DATA : t_bsad TYPE STANDARD TABLE OF ty_bsad,
    w_bsad TYPE ty_bsad,
    t_bkpf TYPE STANDARD TABLE OF ty_bkpf,
    w_bkpf TYPE ty_bkpf,
    t_kna1 TYPE STANDARD TABLE OF ty_kna1,
    w_kna1 TYPE ty_kna1,
    t_knb1 TYPE STANDARD TABLE OF ty_knb1,
    w_knb1 TYPE ty_knb1,
    t_bsid TYPE STANDARD TABLE OF ty_bsid,
    w_bsid TYPE ty_bsid,
    t_bseg TYPE STANDARD TABLE OF ty_bseg,
    w_bseg TYPE ty_bseg,
    t_open TYPE STANDARD TABLE OF ty_open,
    w_open TYPE ty_open.
    **ALV display variables
    DATA:fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE,
    gd_layout TYPE slis_layout_alv,
    gt_events TYPE slis_t_event,
    gt_list_top_of_page TYPE slis_t_listheader,
    heading TYPE slis_t_listheader,
    g_save(1) TYPE c,
    g_exit(1) TYPE c,
    g_variant TYPE disvariant,
    gx_variant TYPE disvariant,
    it_sort TYPE slis_t_sortinfo_alv,
    x_sort TYPE slis_sortinfo_alv.
    **Selection Screens
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS:s_bukrs FOR bkpf-bukrs OBLIGATORY,
    s_gjahr FOR bkpf-gjahr OBLIGATORY NO-EXTENSION NO INTERVALS,
    s_kunnr FOR bseg-kunnr OBLIGATORY NO-EXTENSION NO INTERVALS,
    s_name1 FOR kna1-name1 NO-EXTENSION NO INTERVALS,
    s_date FOR bkpf-budat OBLIGATORY,
    s_umskz FOR bsid-umskz.
    SELECTION-SCREEN END OF BLOCK b1.
    SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-003.
    PARAMETERS:xnorm AS CHECKBOX DEFAULT 'X',
    xshbv AS CHECKBOX.
    SELECTION-SCREEN END OF BLOCK b3.
    DATA:golive TYPE d VALUE '20080401',
    date TYPE d,
    date1 TYPE d,
    closing TYPE p DECIMALS 2 VALUE 0,
    opening TYPE p DECIMALS 2 VALUE 0.
    **Start Of Selection
    START-OF-SELECTION.
    PERFORM get_data.
    PERFORM events.
    PERFORM f_layout.
    PERFORM display.
    FORM get_data .
    **Open Customers master data
    SELECT
    bukrs gjahr kunnr belnr budat xblnr bldat augdt dmbtr
    FROM bsid
    INTO TABLE t_bsid
    WHERE bukrs IN s_bukrs
    AND gjahr IN s_gjahr
    AND kunnr IN s_kunnr
    AND budat IN s_date
    AND umskz IN s_umskz.
    **Clear Customers master data
    SELECT
    bukrs gjahr kunnr belnr budat xblnr bldat augdt dmbtr
    FROM bsad
    INTO TABLE t_bsad
    WHERE bukrs IN s_bukrs
    AND gjahr IN s_gjahr
    AND kunnr IN s_kunnr
    AND budat IN s_date
    AND umskz IN s_umskz.
    ****Open Customers data
    IF NOT t_bsid[] IS INITIAL.
    SORT t_bsid BY bukrs bldat.
    SELECT
    bukrs gjahr hwaer kursf bktxt belnr
    FROM bkpf
    INTO CORRESPONDING FIELDS OF TABLE t_bkpf
    FOR ALL ENTRIES IN t_bsid
    WHERE bukrs = t_bsid-bukrs
    AND gjahr = t_bsid-gjahr
    AND belnr = t_bsid-belnr.
    SORT t_bkpf.
    SELECT
    kunnr name1 ort01
    FROM kna1
    INTO TABLE t_kna1
    FOR ALL ENTRIES IN t_bsid
    WHERE kunnr = t_bsid-kunnr
    AND name1 IN s_name1.
    SORT t_kna1.
    SELECT
    kunnr bukrs vzskz
    FROM knb1
    INTO TABLE t_knb1
    FOR ALL ENTRIES IN t_bsid
    WHERE kunnr = t_bsid-kunnr
    AND bukrs = t_bsid-bukrs.
    SORT t_knb1.
    LOOP AT t_bsid INTO w_bsid.
    it_main_all-bukrs = w_bsid-bukrs.
    it_main_all-kunnr = w_bsid-kunnr.
    it_main_all-gjahr = w_bsid-gjahr.
    it_main_all-belnr = w_bsid-belnr.
    it_main_all-budat = w_bsid-budat.
    it_main_all-xblnr = w_bsid-xblnr.
    it_main_all-bldat = w_bsid-bldat.
    READ TABLE t_bkpf INTO w_bkpf WITH KEY bukrs = w_bsid-bukrs gjahr = w_bsid-gjahr belnr = w_bsid-belnr BINARY SEARCH.
    IF sy-subrc EQ 0.
    it_main_all-hwaer = w_bkpf-hwaer.
    it_main_all-kursf = w_bkpf-kursf.
    it_main_all-bktxt = w_bkpf-bktxt.
    ENDIF.
    READ TABLE t_kna1 INTO w_kna1 WITH KEY kunnr = w_bsid-kunnr BINARY SEARCH.
    IF sy-subrc EQ 0.
    it_main_all-name = w_kna1-name1.
    it_main_all-city = w_kna1-city.
    ENDIF.
    READ TABLE t_knb1 INTO w_knb1 WITH KEY kunnr = w_bsid-kunnr BINARY SEARCH.
    IF sy-subrc EQ 0.
    it_main_all-vzskz = w_knb1-vzskz.
    ENDIF.
    it_main_all-lights = '1'.
    APPEND it_main_all.
    CLEAR it_main_all.
    CLEAR : w_bsid, w_bkpf, w_kna1, w_knb1.
    ENDLOOP .
    ENDIF.
    **Clear customers data
    IF NOT t_bsad[] IS INITIAL.
    SORT t_bsad BY bukrs bldat.
    SELECT
    bukrs gjahr hwaer kursf bktxt belnr
    FROM bkpf
    INTO CORRESPONDING FIELDS OF TABLE t_bkpf
    FOR ALL ENTRIES IN t_bsad
    WHERE bukrs = t_bsad-bukrs
    AND gjahr = t_bsad-gjahr
    AND belnr = t_bsad-belnr.
    SORT t_bkpf.
    SELECT
    kunnr name1 ort01
    FROM kna1
    INTO TABLE t_kna1
    FOR ALL ENTRIES IN t_bsad
    WHERE kunnr = t_bsad-kunnr
    AND name1 IN s_name1.
    SORT t_kna1.
    SELECT
    kunnr bukrs vzskz
    FROM knb1
    INTO TABLE t_knb1
    FOR ALL ENTRIES IN t_bsad
    WHERE kunnr = t_bsad-kunnr
    AND bukrs = t_bsad-bukrs.
    SORT t_knb1.
    LOOP AT t_bsad INTO w_bsad.
    it_main_all-bukrs = w_bsad-bukrs.
    it_main_all-gjahr = w_bsad-gjahr.
    it_main_all-kunnr = w_bsad-kunnr.
    it_main_all-belnr = w_bsad-belnr.
    it_main_all-budat = w_bsad-budat.
    it_main_all-xblnr = w_bsad-xblnr.
    it_main_all-bldat = w_bsad-bldat.
    READ TABLE t_bkpf INTO w_bkpf WITH KEY bukrs = w_bsad-bukrs gjahr = w_bsad-gjahr belnr = w_bsad-belnr BINARY SEARCH.
    IF sy-subrc EQ 0.
    it_main_all-hwaer = w_bkpf-hwaer.
    it_main_all-kursf = w_bkpf-kursf.
    it_main_all-bktxt = w_bkpf-bktxt.
    ENDIF.
    READ TABLE t_kna1 INTO w_kna1 WITH KEY kunnr = w_bsad-kunnr BINARY SEARCH.
    IF sy-subrc EQ 0.
    it_main_all-name = w_kna1-name1.
    it_main_all-city = w_kna1-city.
    ENDIF.
    READ TABLE t_knb1 INTO w_knb1 WITH KEY kunnr = w_bsad-kunnr BINARY SEARCH.
    IF sy-subrc EQ 0.
    it_main_all-vzskz = w_knb1-vzskz.
    ENDIF.
    it_main_all-lights = '3'.
    APPEND it_main_all.
    CLEAR : w_bsad, w_bkpf, w_kna1, w_knb1.
    ENDLOOP .
    ENDIF.
    ENDFORM.                    " get_data
    *&      Form  events
    FORM events .
    DATA : l_i_event TYPE slis_alv_event.
    l_i_event-name = 'TOP_OF_PAGE' .
    l_i_event-form = 'TOP2' .
    APPEND l_i_event TO gt_events .
    CLEAR l_i_event .
    ENDFORM.                    " events
    *&      Form  f_layout
    FORM f_layout .
    CLEAR gd_layout.
    gd_layout-detail_popup = 'X'.
    gd_layout-zebra = 'X'.
    gd_layout-no_vline = ' '.
    gd_layout-lights_fieldname = 'LIGHTS'.
    gd_layout-colwidth_optimize = 'X'.
    ENDFORM.                    " f_layout
    *&      Form  display
    FORM display .
    fieldcatalog-fieldname = 'BUKRS'.
    fieldcatalog-tabname = 'IT_MAIN_ALL'.
    fieldcatalog-seltext_m = 'Company Code'.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'GJAHR'.
    fieldcatalog-tabname = 'IT_MAIN_ALL'.
    fieldcatalog-seltext_m = 'Fiscal year'.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'BELNR'.
    fieldcatalog-tabname = 'IT_MAIN_ALL'.
    fieldcatalog-seltext_m = 'Doc No.'.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'BLDAT'.
    fieldcatalog-tabname = 'IT_MAIN_ALL'.
    fieldcatalog-seltext_m = 'Doc Date'.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'BUDAT'.
    fieldcatalog-tabname = 'IT_MAIN_ALL'.
    fieldcatalog-seltext_m = 'Posting date'.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'DMBTR'.
    fieldcatalog-tabname = 'IT_MAIN_ALL'.
    fieldcatalog-seltext_m = 'Amt in local cur.'.
    fieldcatalog-do_sum = 'X'.
    fieldcatalog-just = 'R'.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    **For Subtotal of fields
    x_sort-fieldname = 'BUKRS' .
    x_sort-group     = '*'.
    x_sort-subtot    = 'X'.
    APPEND x_sort TO it_sort.
    CLEAR x_sort .
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    i_callback_program      = sy-repid
    is_layout               = gd_layout
    it_fieldcat             = fieldcatalog[]
    it_sort                 = it_sort
    i_default               = 'X'
    it_events               = gt_events[]
    TABLES
    t_outtab                = it_main_all
    EXCEPTIONS
    program_error           = 1
    OTHERS                  = 2.
    IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    ENDFORM.
    *&      Form  top_of_page
    FORM top_of_page.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
    i_logo             = 'RUCHI_LOGO'
    it_list_commentary = heading[].
    ENDFORM.
    *&      Form  opening
    FORM opening USING p_bukrs TYPE bsid-bukrs.
    DATA : opdate TYPE d.
    IF s_date-low < golive.
    opening = 0.
    ELSE.
    opdate = s_date-low - 1.
    SELECT
    bukrs shkzg dmbtr umskz
    FROM bsid
    INTO TABLE t_open
    WHERE bukrs IN s_bukrs
    AND kunnr IN s_kunnr
    AND gjahr IN s_gjahr
    AND budat <= opdate.
    LOOP AT t_open INTO w_open.
    IF w_open-shkzg = 'S'.
    opening = opening + w_open-dmbtr.
    ELSEIF w_open-shkzg = 'H'.
    w_open-dmbtr = w_open-dmbtr * ( -1 ).
    opening = opening + w_open-dmbtr .
    ENDIF.
    CLEAR : w_open.
    ENDLOOP.
    SELECT
    bukrs shkzg dmbtr umskz
    FROM bsad
    INTO TABLE t_open
    WHERE bukrs IN s_bukrs
    AND kunnr IN s_kunnr
    AND gjahr IN s_gjahr
    AND budat <= opdate.
    LOOP AT t_open INTO w_open.
    IF w_open-shkzg = 'S'.
    opening = opening + w_open-dmbtr.
    ELSEIF w_open-shkzg = 'H'.
    w_open-dmbtr = w_open-dmbtr * ( -1 ).
    opening = opening + w_open-dmbtr.
    ENDIF.
    CLEAR w_open.
    ENDLOOP.
    ENDIF.
    ENDFORM.
    *&      Form  top2
    FORM top2 .
    date  = s_date-low.
    date1 = s_date-high.
    WRITE : / 'CUSTOMER LEDGER FOR ALL ITEMS' COLOR 7.
    WRITE : / 'Customer Code:', it_main_all-kunnr.
    WRITE : / 'Customer Name:', it_main_all-name.
    WRITE : / 'Customer City:', it_main_all-city.
    ON CHANGE OF it_main_all-bukrs.
    WRITE : / 'Company Code:' COLOR 3 , it_main_all-bukrs COLOR 3.
    PERFORM opening USING it_main_all-bukrs.
    PERFORM closing USING it_main_all-bukrs.
    WRITE : / 'Opening Balance : Rs.' , opening .
    WRITE : / 'Closing Balance : Rs.' , closing .
    ENDON.
    CLEAR : closing, opening.
    IF date1 IS INITIAL.
    WRITE : / 'Date:', date DD/MM/YYYY.
    ELSE.
    WRITE : / 'Date:' , date DD/MM/YYYY, ' to ', date1 DD/MM/YYYY.
    ENDIF.
    ENDFORM.
    *&Form  closing
    FORM closing USING c_bukrs TYPE bsid-bukrs.
    LOOP AT it_main_all WHERE bukrs = c_bukrs.
    closing = closing + it_main_all-dmbtr.
    ENDLOOP .
    closing = closing + opening .
    ENDFORM.
    Edited by: Vishu on Apr 20, 2009 9:32 AM

    it can be done with the help of a system code 'sy-xcode'. it is initialised the time list is sorted so just keeping a check point, we can solve this problem.
    Vishu Khandelwal

  • Multilple line selection in alv

    Hi All,
    I am dispalying a simple alv grid report using function module
    reuse_alv_grid_display.i have used check box for selection but it is only applicable for single selection.Could anybody tell me how to select multiple line items at a time without using control key.if somebody provide the sample code it will be more helpful.
    Regards
    Lalit

    Hi,
    Please refer to the standard demo program.
    BCALV_EDIT_05
    or Search as BCALV_EDIT* and press F4.
    OR
    Please refer to the code below:
    *& Report  ZDEMO_ALVGRID_SELROW                                        *
    *& Example of a simple ALV Grid Report                                 *
    *& The basic ALV grid, Enhanced to display capture each row a user has *
    *& selected                                                            *
    REPORT  zdemo_alvgrid_selrow                 .
    TABLES:     ekko.
    type-pools: slis.                                 "ALV Declarations
    *Data Declaration
    TYPES: BEGIN OF t_ekko,
      SEl,                         "stores which row user has selected
      ebeln TYPE ekpo-ebeln,
      ebelp TYPE ekpo-ebelp,
      statu TYPE ekpo-statu,
      aedat TYPE ekpo-aedat,
      matnr TYPE ekpo-matnr,
      menge TYPE ekpo-menge,
      meins TYPE ekpo-meins,
      netpr TYPE ekpo-netpr,
      peinh TYPE ekpo-peinh,
    END OF t_ekko.
    DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
          wa_ekko TYPE t_ekko.
    *ALV data declarations
    data: fieldcatalog type slis_t_fieldcat_alv with header line,
          gd_tab_group type slis_t_sp_group_alv,
          gd_layout    type slis_layout_alv,
          gd_repid     like sy-repid.
    *Start-of-selection.
    START-OF-SELECTION.
    perform data_retrieval.
    perform build_fieldcatalog.
    perform build_layout.
    perform display_alv_report.
    *&      Form  BUILD_FIELDCATALOG
    *       Build Fieldcatalog for ALV Report
    form build_fieldcatalog.
    * There are a number of ways to create a fieldcat.
    * For the purpose of this example i will build the fieldcatalog manualy
    * by populating the internal table fields individually and then
    * appending the rows. This method can be the most time consuming but can
    * also allow you  more control of the final product.
    * Beware though, you need to ensure that all fields required are
    * populated. When using some of functionality available via ALV, such as
    * total. You may need to provide more information than if you were
    * simply displaying the result
    *               I.e. Field type may be required in-order for
    *                    the 'TOTAL' function to work.
      fieldcatalog-fieldname   = 'EBELN'.
      fieldcatalog-seltext_m   = 'Purchase Order'.
      fieldcatalog-col_pos     = 0.
      fieldcatalog-outputlen   = 10.
      fieldcatalog-emphasize   = 'X'.
      fieldcatalog-key         = 'X'.
    *  fieldcatalog-do_sum      = 'X'.
    *  fieldcatalog-no_zero     = 'X'.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'EBELP'.
      fieldcatalog-seltext_m   = 'PO Item'.
      fieldcatalog-col_pos     = 1.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'STATU'.
      fieldcatalog-seltext_m   = 'Status'.
      fieldcatalog-col_pos     = 2.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'AEDAT'.
      fieldcatalog-seltext_m   = 'Item change date'.
      fieldcatalog-col_pos     = 3.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MATNR'.
      fieldcatalog-seltext_m   = 'Material Number'.
      fieldcatalog-col_pos     = 4.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MENGE'.
      fieldcatalog-seltext_m   = 'PO quantity'.
      fieldcatalog-col_pos     = 5.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MEINS'.
      fieldcatalog-seltext_m   = 'Order Unit'.
      fieldcatalog-col_pos     = 6.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'NETPR'.
      fieldcatalog-seltext_m   = 'Net Price'.
      fieldcatalog-col_pos     = 7.
      fieldcatalog-outputlen   = 15.
      fieldcatalog-do_sum      = 'X'.        "Display column total
      fieldcatalog-datatype     = 'CURR'.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'PEINH'.
      fieldcatalog-seltext_m   = 'Price Unit'.
      fieldcatalog-col_pos     = 8.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
    endform.                    " BUILD_FIELDCATALOG
    *&      Form  BUILD_LAYOUT
    *       Build layout for ALV grid report
    form build_layout.
      gd_layout-box_fieldname     = 'SEL'.
                                     "set field name to store row selection
      gd_layout-edit              = 'X'. "makes whole ALV table editable
      gd_layout-zebra             = 'X'.
    endform.                    " BUILD_LAYOUT
    *&      Form  DISPLAY_ALV_REPORT
    *       Display report using ALV grid
    form display_alv_report.
      gd_repid = sy-repid.
      call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                i_callback_program      = gd_repid
    *            i_callback_top_of_page   = 'TOP-OF-PAGE'  "see FORM
                i_callback_user_command = 'USER_COMMAND'
    *            i_grid_title           = outtext
                is_layout               = gd_layout
                it_fieldcat             = fieldcatalog[]
    *            it_special_groups       = gd_tabgroup
    *            IT_EVENTS                = GT_XEVENTS
                i_save                  = 'X'
    *            is_variant              = z_template
           tables
                t_outtab                = it_ekko
           exceptions
                program_error           = 1
                others                  = 2.
      if sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      endif.
    endform.                    " DISPLAY_ALV_REPORT
    *&      Form  DATA_RETRIEVAL
    *       Retrieve data form EKPO table and populate itab it_ekko
    form data_retrieval.
    select ebeln ebelp statu aedat matnr menge meins netpr peinh
    up to 10 rows
      from ekpo
      into corresponding fields of table it_ekko.
    endform.                    " DATA_RETRIEVAL
    *       FORM USER_COMMAND                                          *
    *       --> R_UCOMM                                                *
    *       --> RS_SELFIELD                                            *
    FORM user_command USING r_ucomm LIKE sy-ucomm
                      rs_selfield TYPE slis_selfield.
    * Check function code
      CASE r_ucomm.
        WHEN '&IC1'.
    *   Check field clicked on within ALVgrid report
        IF rs_selfield-fieldname = 'EBELN'.
    *     Read data table, using index of row user clicked on
          READ TABLE it_ekko INTO wa_ekko INDEX rs_selfield-tabindex.
    *     Set parameter ID for transaction screen field
          SET PARAMETER ID 'BES' FIELD wa_ekko-ebeln.
    *     Sxecute transaction ME23N, and skip initial data entry screen
          CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
        ENDIF.
        WHEN '&DATA_SAVE'.  "user presses SAVE
        loop at it_ekko into wa_ekko.
          if wa_ekko-sel EQ 'X'.
    *       Process records that have been selected
          endif.
        endloop.
      ENDCASE.
    ENDFORM.
    Thanks,
    Sriram Ponna
    Edited by: Sriram Ponna on Feb 8, 2008 9:31 PM

  • At Line Selection on ALV Grid

    Hi guys: I need to double click on a field in the ALV report that should bring up another structure (which I have created) called s_det
    s_det has only document number & company code.
    Please provide the code for doing this in ALV. I know I cant use At Line Selection. Please give me simple code.
    thanks so much
    Brian

    Hi
    take this as an example for ur solution.
    In this if we double click on first level display then it opens second level display.Just have a look on the following code.
    This is Interactive ALV report of displaying each row with colours and Headers.
    TYPE-POOLS SLIS.
    TYPES: BEGIN OF I_EKKO,
           EBELN LIKE EKKO-EBELN,
           AEDAT LIKE EKKO-AEDAT,
           BUKRS LIKE EKKO-BUKRS,
           BSART LIKE EKKO-BSART,
           LIFNR LIKE EKKO-LIFNR,
           L_COLOR(4) TYPE C,
           END OF I_EKKO.
    DATA: IT_EKKO TYPE STANDARD TABLE OF I_EKKO INITIAL SIZE 0,
          WA_EKKO TYPE I_EKKO.
    TYPES: BEGIN OF I_EKPO,
           EBELN LIKE EKPO-EBELN,
           EBELP LIKE EKPO-EBELP,
           MATNR LIKE EKPO-MATNR,
           MENGE LIKE EKPO-MENGE,
           MEINS LIKE EKPO-MEINS,
           NETPR LIKE EKPO-NETPR,
           L_COLOR1(4) TYPE C,
           END OF I_EKPO.
    DATA: IT_EKPO TYPE STANDARD TABLE OF I_EKPO INITIAL SIZE 0,
          WA_EKPO TYPE I_EKPO.
    DATA: V_REPID TYPE SY-REPID,
          I_FLDCAT TYPE SLIS_T_FIELDCAT_ALV,
          WA_FLDCAT TYPE SLIS_FIELDCAT_ALV,
          I_EVENTS TYPE SLIS_T_EVENT,
          WA_EVENT TYPE SLIS_ALV_EVENT,
          GD_LAYOUT TYPE SLIS_LAYOUT_ALV,
          GD_LAYOUT1 TYPE SLIS_LAYOUT_ALV.
    DATA: I_TITLE_EKKO TYPE LVC_TITLE VALUE 'FIRST ALV REPORT',
          I_TITLE_EKPO TYPE LVC_TITLE VALUE 'SECONDARY ALV REPORT'.
    INITIALIZATION.
    V_REPID = SY-REPID.
    PERFORM FLDCATALOG.
    PERFORM CALL_EVENTS.
    PERFORM POPULATE_EVENT.
    PERFORM BLD_LAYOUT.
    PERFORM BLD_LAYOUT1.
    START-OF-SELECTION.
    PERFORM DATA_RETRIEVAL.
    PERFORM DISPLAY_ALV_REPORT.
    FORM FLDCATALOG.
    WA_FLDCAT-TABNAME = 'IT_EKKO'.
    WA_FLDCAT-FIELDNAME = 'EBELN'.
    WA_FLDCAT-SELTEXT_M = 'PO NUMBER'.
    APPEND WA_FLDCAT TO I_FLDCAT.
    CLEAR WA_FLDCAT.
    WA_FLDCAT-TABNAME = 'IT_EKKO'.
    WA_FLDCAT-FIELDNAME = 'AEDAT'.
    WA_FLDCAT-SELTEXT_M = 'DATE'.
    APPEND WA_FLDCAT TO I_FLDCAT.
    CLEAR WA_FLDCAT.
    WA_FLDCAT-TABNAME = 'IT_EKKO'.
    WA_FLDCAT-FIELDNAME = 'BUKRS'.
    WA_FLDCAT-SELTEXT_M = 'DOCUMENT TYPE'.
    APPEND WA_FLDCAT TO I_FLDCAT.
    CLEAR WA_FLDCAT.
    WA_FLDCAT-TABNAME = 'IT_EKKO'.
    WA_FLDCAT-FIELDNAME = 'LIFNR'.
    WA_FLDCAT-SELTEXT_M = 'VENDOR CODE'.
    APPEND WA_FLDCAT TO I_FLDCAT.
    CLEAR WA_FLDCAT.
    ENDFORM.
    FORM CALL_EVENTS.
    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    EXPORTING
       I_LIST_TYPE           = 0
    IMPORTING
       ET_EVENTS             = I_EVENTS
    EXCEPTIONS
      LIST_TYPE_WRONG       = 1
      OTHERS                = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDFORM.
    FORM POPULATE_EVENT.
    *READ TABLE I_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
    *IF SY-SUBRC = 0.
    WA_EVENT-FORM = 'TOP_OF_PAGE'.
    MODIFY I_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME = WA_EVENT-FORM.
    *ENDIF.
    READ TABLE I_EVENTS INTO WA_EVENT WITH KEY NAME = 'USER_COMMAND'.
    IF SY-SUBRC = 0.
      WA_EVENT-FORM = 'USER_COMMAND'.
      MODIFY I_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME = WA_EVENT-NAME.
    ENDIF.
    ENDFORM.
    FORM BLD_LAYOUT.
    GD_LAYOUT-INFO_FIELDNAME = 'L_COLOR'.
    ENDFORM.
    FORM DATA_RETRIEVAL.
    DATA LN_COLOR(1) TYPE C.
    SELECT EBELN AEDAT BUKRS BSART LIFNR
    FROM EKKO INTO TABLE IT_EKKO.
    LOOP AT IT_EKKO INTO WA_EKKO.
    LN_COLOR = LN_COLOR + 1.
    IF LN_COLOR = 8.
      LN_COLOR = 1.
    ENDIF.
    CONCATENATE 'C' LN_COLOR '11' INTO WA_EKKO-L_COLOR.
    MODIFY IT_EKKO FROM WA_EKKO.
    ENDLOOP.
    ENDFORM.
    FORM DISPLAY_ALV_REPORT.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
       I_CALLBACK_PROGRAM                = V_REPID
      I_CALLBACK_PF_STATUS_SET          = ' '
       I_CALLBACK_USER_COMMAND           = 'USER_COMMAND'
       I_CALLBACK_TOP_OF_PAGE            = 'TOP_OF_PAGE'
      I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
      I_BACKGROUND_ID                   = ' '
       I_GRID_TITLE                      = I_TITLE_EKKO
      I_GRID_SETTINGS                   =
       IS_LAYOUT                         = GD_LAYOUT
       IT_FIELDCAT                       = I_FLDCAT[]
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         = 'X'
       I_SAVE                            = 'A'
      IS_VARIANT                        =
       IT_EVENTS                         = I_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_EKKO
    EXCEPTIONS
      PROGRAM_ERROR                     = 1
      OTHERS                            = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDFORM.
    FORM TOP_OF_PAGE.
    DATA: T_HEADER TYPE SLIS_T_LISTHEADER,
          WA_HEADER TYPE SLIS_LISTHEADER.
    WA_HEADER-TYP = 'H'.
    WA_HEADER-INFO = 'THIS IS MY FIRST ALV'.
    APPEND WA_HEADER TO T_HEADER.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
      EXPORTING
        IT_LIST_COMMENTARY       = T_HEADER
      I_LOGO                   =
      I_END_OF_LIST_GRID       =
      I_ALV_FORM               =
    ENDFORM.
    FORM USER_COMMAND USING R_COMM TYPE SY-UCOMM
    RS_SELFIELD TYPE SLIS_SELFIELD.
      CASE R_COMM.
        WHEN '&IC1'.
          READ TABLE IT_EKKO INTO WA_EKKO INDEX RS_SELFIELD-TABINDEX.
          PERFORM FLDCAT_EKPO.
          PERFORM CALL_EVENT_EKPO.
         PERFORM POPULATE_EVENT_EKPO.
          PERFORM DATA_RETRIEVAL_EKPO.
          PERFORM DISPLAY_ALV_REPORT_EKPO.
      ENDCASE.
    ENDFORM.
    FORM FLDCAT_EKPO.
    WA_FLDCAT-TABNAME = 'IT_EKPO'.
    WA_FLDCAT-FIELDNAME = 'EBELN'.
    WA_FLDCAT-SELTEXT_M = 'PO NUMBER'.
    APPEND WA_FLDCAT TO I_FLDCAT.
    CLEAR WA_EKPO.
    WA_FLDCAT-TABNAME = 'IT_EKPO'.
    WA_FLDCAT-FIELDNAME = 'EBELP'.
    WA_FLDCAT-SELTEXT_M = 'LINE NO'.
    APPEND WA_FLDCAT TO I_FLDCAT.
    CLEAR WA_EKPO.
    WA_FLDCAT-TABNAME = 'IT_EKPO'.
    WA_FLDCAT-FIELDNAME = 'MATNR'.
    WA_FLDCAT-SELTEXT_M = 'MATERIAL NUMBER'.
    APPEND WA_FLDCAT TO I_FLDCAT.
    CLEAR WA_FLDCAT.
    WA_FLDCAT-TABNAME = 'IT_EKPO'.
    WA_FLDCAT-FIELDNAME = 'MENGE'.
    WA_FLDCAT-SELTEXT_M = 'QUANTITY'.
    APPEND WA_FLDCAT TO I_FLDCAT.
    CLEAR WA_FLDCAT.
    WA_FLDCAT-TABNAME = 'IT_EKPO'.
    WA_FLDCAT-FIELDNAME = 'MEINS'.
    WA_FLDCAT-SELTEXT_M = 'BASE UNIT OF MEASURE'.
    APPEND WA_FLDCAT TO I_FLDCAT.
    CLEAR WA_FLDCAT.
    WA_FLDCAT-TABNAME = 'IT_EKPO'.
    WA_FLDCAT-FIELDNAME = 'NETPR'.
    WA_FLDCAT-SELTEXT_M = 'PRICE'.
    APPEND WA_FLDCAT TO I_FLDCAT.
    CLEAR WA_FLDCAT.
    ENDFORM.
    FORM CALL_EVENT_EKPO.
    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    EXPORTING
       I_LIST_TYPE           = 0
    IMPORTING
       ET_EVENTS             = I_EVENTS
    EXCEPTIONS
      LIST_TYPE_WRONG       = 1
      OTHERS                = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDFORM.
    *FORM POPULATE_EVENT_EKPO.
    *READ TABLE I_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
    *IF SY-SUBRC = 0.
    WA_EVENT-FORM = 'TOP_OF_PAGE'.
    MODIFY I_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME = WA_EVENT-FORM.
    *ENDIF.
    *ENDFORM.
    FORM BLD_LAYOUT1.
    GD_LAYOUT1-INFO_FIELDNAME = 'L_COLOR1'.
    ENDFORM.
    FORM DATA_RETRIEVAL_EKPO.
    DATA LN_COLOR1(1) TYPE C.
    SELECT EBELN EBELP MATNR MENGE MEINS NETPR
    INTO TABLE IT_EKPO
    FROM EKPO.
    LOOP AT IT_EKPO INTO WA_EKPO.
    LN_COLOR1 = LN_COLOR1 + 1.
    IF LN_COLOR1 = 8.
      LN_COLOR1 = 1.
    ENDIF.
    CONCATENATE 'C' LN_COLOR1 '11' INTO WA_EKPO-L_COLOR1.
    MODIFY IT_EKPO FROM WA_EKPO.
    ENDLOOP.
    ENDFORM.
    FORM DISPLAY_ALV_REPORT_EKPO.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
       I_CALLBACK_PROGRAM                = V_REPID
      I_CALLBACK_PF_STATUS_SET          = ' '
      I_CALLBACK_USER_COMMAND           = ' '
       I_CALLBACK_TOP_OF_PAGE            = 'TOP_OF_PAGE1'
      I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
      I_BACKGROUND_ID                   = ' '
       I_GRID_TITLE                      = I_TITLE_EKPO
      I_GRID_SETTINGS                   =
       IS_LAYOUT                         = GD_LAYOUT1
       IT_FIELDCAT                       = I_FLDCAT[]
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         = 'X'
       I_SAVE                            = 'A'
      IS_VARIANT                        =
       IT_EVENTS                         = I_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_EKPO
    EXCEPTIONS
      PROGRAM_ERROR                     = 1
      OTHERS                            = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDFORM.
    FORM TOP_OF_PAGE1.
    DATA: T_HEADER1 TYPE SLIS_T_LISTHEADER,
          WA_HEADER1 TYPE SLIS_LISTHEADER.
    WA_HEADER1-TYP = 'H'.
    WA_HEADER1-INFO = 'SECONDARY ALV LEVEL'.
    APPEND WA_HEADER1 TO T_HEADER1.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
      EXPORTING
        IT_LIST_COMMENTARY       = T_HEADER1
      I_LOGO                   =
      I_END_OF_LIST_GRID       =
      I_ALV_FORM               = .
    ENDFORM.
    reward points,if it is useful.
    Thanks,
    chandu.

  • How to print the top of page part along with the ALV list and generate PDF

    HI all,
             I have created one ALV by using oops concept .
             and also am able to get the top of page where I have One standard logo on the right hand side
             and some details on the left side .
               Now my requirement is to while printing the list the logo and other top of page details should appear
               In the PDF output but currently while am pressing the print preview button only the alv data is coming
              am already using the method
        handle_top_of_page
          FOR EVENT print_top_of_page
                 OF cl_gui_alv_grid,
    may be am missing something ... How to get the top of page along with the logo printed ?

    Hi  Surya,
    After generating the grid display  click on print button,
    a spool number is generated. capture the spool number and convert it to pdf using the fm:
    CONVERT_ABAPSPOOLJOB_2_PDF  and save the file
    Hope this will solve your problem.
    Regards,
    R K.

  • How to process Line Selection on ALV Table in ABAP WebDynpro

    Hi there,
    I have a view with an ALV table whose context node retrieves its data from a Service Call for a method.
    The method provides certain data of a database table which the ALV displays.
    Now I would like to be able to select one row of that ALV table and after pressing a button or doubleclicking on the row or whatever a different view (as for me it is also ok on the same view) should appear to display the details of that selection.
    I only need to know how to retrieve the selected data.
    Or its index within the internal table.
    I am already looking for hours for a useful thread and actually there is one which obviously is about a similar issue apart from the multiple selection part: 
    How to process multiple row selection in ALV table in Wendynpro ABAP? Help!
    but i am afraid that i don't understand it. Or at least I misunderstand it since it does not work with me.
    The system example mentioned in the thread does not help me either because it somehow does not correspond to my needs, does it?
    It would be GREAT if somebody could help me with that. Please keep it simple for I am not an expert in webdynpro yet (obviously ^^) and also please explain in detail what I have to do with the context nodes since I am not sure whether the selection is stored in my already existing node or whether I need a special one for that.
    Thanks!!
    christina

    Hi Christina,
    If you just want to get one column data of the line that user clicked, use the Web Dynpro Code Wizard to Read Context of attibute you needed, then you will get code as follow:
    * Define data for read attribute
        node_alv TYPE REF TO if_wd_context_node,
        elem_alv TYPE REF TO if_wd_context_element,
        stru_alv TYPE if_view_display=>element_alv ,
        item_column_name  LIKE stru_alv-column_name.
    * navigate from <CONTEXT> to <ALV> via lead selection
      node_alv = wd_context->get_child_node( name = if_view_display=>wdctx_alv ).
    * get element via lead selection
      elem_alv = node_alv->get_element(  ).
    * get single attribute
      elem_alv->get_attribute(
        EXPORTING
          name =  `COLUMN_NAME'
        IMPORTING
          value = item_column_name ).
    The value of column_name is stored in item_column_name.
    If you need the index that the user clicked, try this:
    * Definition of field symbol for index
      FIELD-SYMBOLS : <fs_index> TYPE data.
    * Get the selected index
      ASSIGN r_param->index->* TO <fs_index>.
    The index of clicked line is stored in field symbol <fs_index>.
    Hope it will help.
    Best Regards,
    Stephanie

  • TOP OF PAGE printing according to SORT - ALV main internal table

    Hi guys
    I manage to solve my previous issues but 1 minor problem here
    Lets say I have an itab which has 3 records
    Sales Order | Purchase No, | Distributor
    1                  |   123               | abc
    1                  |   123               | abc
    2                  |   456               | TGIF
    I'm using FM REUSE_ALV_BLOCK_LIST_APPEND to display the ALV
    its working for the main INTERNAL TABLE but  when it comes to top of page, it doesn't follow the sort
    I want it to print
    Sales Order: 1
    Purchase No: 123
    Distributor: abc
    TABLE 1
    Sales Order: 2
    Purchase No: 456
    Distributor: TGIF
    TABLE 2
    But now its printing
    Sales Order: 1
    Purchase No: 123
    Distributor: abc
    TABLE 1
    Sales Order: 1
    Purchase No: 123
    Distributor: abc
    TABLE 2
    Sales Order: 2
    Purchase No: 456
    Distributor: TGIF
    TABLE <empty table>
    My codes was working previously but its not longer the same.
      READ TABLE it_report INTO l_report INDEX SY-tabix
      WRITE: text-003,          "Sales Order Number
            AT 22 l_report-ebeln.
      WRITE: / text-004,        "Purchase Order Number
             AT 25 l_report-purch_no.
      WRITE: / text-005,        "Distributor Number
             AT 22 l_report-kunnr.
      WRITE: / text-006,        "Ship to Name
             AT 16 l_report-wename1.
      WRITE: / text-007,        "Order Date
             AT 14 l_report-vdate.
      WRITE: / text-008,        "Delivery Date
             AT 17 i_vdatu.
    Can anyone help me out here?  How do I make it print just like the SORT for ALV?

    Refresh the work areas then it work fine

Maybe you are looking for

  • Checking for Certain Purchases

    Alright well I was downloading a few albums and my itunes crashed. I clicked check for purchases, and pulled up about 6 episodes of Los Season 3 that one -of my family members must have bought. I tried to pause the episodes to let my song downloads a

  • Can i download ibooks author on laptop

    Can i download ibooks author on laptop. I have both a laptop (osx 10.6.7) and an iPad and can't seem to download iBooks Author to either.

  • OTL - Hwo to change the error message

    Hi When someone submits time beyond the valids project and task dates, we get teh followign error. We want to change the text of this message to give more meaningful text. How do i change that in OTL The expenditure item date is not within the active

  • How do I get this program to automatically delete the messages it pulls from my online email off my online email?

    When the emails get downloaded from my online email they stay on my online email causing it do past its storage limit. How can I set this to delete the emails from my online account once it has emailed?

  • E-mailing users when data has been loaded.

    Does anyone have some information on setting up FDM to e-mail certain users when data has been loaded for certain locations? Not sure what steps need to be taken to setup the FDM server, FDM and just wondering if there are any generic scripts that ca