User command in hierarchical list

hi, i have displayed data in hierarchical list using oo prog.
i made use of classes like cl_salv_herseq_table
i wanted a functionality which in non OO prog using 'REUSE_ALV_HIERSEQ_LIST_DISPLAY' can be done by sending
the parameter in I_CALLBACK_USER_COMMAND.
the function that we send to I_CALLBACK_USER_COMMAND has two parameters of type sy-ucomm and slis_selfield .
using object oriented prog  i found a method get_events with the help of which i could trigger the even on mouseclicks
and getting appropriate functionkey in the parameter i_ucomm. But i want the slis_selffield option as well using OO prog
that could get the details of the item clicked.

Check out this code:
REPORT ztest_sourav16. TYPE-POOLS: slis. TYPES: BEGIN OF x_mara, matnr TYPE matnr, ersda TYPE ersda, ernam TYPE ernam, laeda TYPE laeda, aenam TYPE aenam, vpsta TYPE vpsta, pstat TYPE pstat_d, lvorm TYPE lvoma, check TYPE char1, END OF x_mara, BEGIN OF x_marc, matnr TYPE matnr, werks TYPE werks_d, END OF x_marc. DATA: i_mara TYPE STANDARD TABLE OF x_mara INITIAL SIZE 0, i_marc TYPE STANDARD TABLE OF x_marc INITIAL SIZE 0, wa_alv_keyinfo TYPE slis_keyinfo_alv, i_fieldcat TYPE slis_t_fieldcat_alv, wa_layout TYPE slis_layout_alv. START-OF-SELECTION. SELECT matnr werks FROM marc INTO TABLE i_marc UP TO 100 ROWS. IF sy-subrc = 0. SELECT matnr ersda ernam laeda aenam vpsta pstat lvorm FROM mara INTO TABLE i_mara FOR ALL ENTRIES IN i_marc WHERE matnr = i_marc-matnr. IF sy-subrc = 0. ENDIF. ENDIF. END-OF-SELECTION. DATA: i_callback_program TYPE syrepid VALUE sy-repid. PERFORM sub_populate_fcat. wa_alv_keyinfo-header01 = 'MATNR'. wa_alv_keyinfo-item01 = 'MATNR'. wa_alv_keyinfo-item02 = 'WERKS'. wa_layout-box_fieldname = 'CHECK'. wa_layout-box_tabname = 'I_MARA'. CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY' EXPORTING * I_INTERFACE_CHECK = 'X' i_callback_program = i_callback_program i_callback_pf_status_set = 'SUB_SET_PF_STATUS' i_callback_user_command = 'SUB_USER_COMMAND' is_layout = wa_layout it_fieldcat = i_fieldcat * IT_EXCLUDING = * IT_SPECIAL_GROUPS = * IT_SORT = * IT_FILTER = * IS_SEL_HIDE = * I_SCREEN_START_COLUMN = 0 * I_SCREEN_START_LINE = 0 * I_SCREEN_END_COLUMN = 0 * I_SCREEN_END_LINE = 0 * I_DEFAULT = 'X' * I_SAVE = ' ' * IS_VARIANT = * IT_EVENTS = * IT_EVENT_EXIT = i_tabname_header = 'I_MARA' i_tabname_item = 'I_MARC' * I_STRUCTURE_NAME_HEADER = * I_STRUCTURE_NAME_ITEM = is_keyinfo = wa_alv_keyinfo * IS_PRINT = * IS_REPREP_ID = * I_BYPASSING_BUFFER = * I_BUFFER_ACTIVE = * IR_SALV_HIERSEQ_ADAPTER = * IT_EXCEPT_QINFO = * I_SUPPRESS_EMPTY_DATA = ABAP_FALSE * IMPORTING * E_EXIT_CAUSED_BY_CALLER = * ES_EXIT_CAUSED_BY_USER = TABLES t_outtab_header = i_mara t_outtab_item = i_marc 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. *&---------------------------------------------------------------------* *& Form sub_populate_fcat *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* FORM sub_populate_fcat. DATA: l_wa_fieldcat TYPE slis_fieldcat_alv. l_wa_fieldcat-ref_tabname = 'MARA'. l_wa_fieldcat-tabname = 'I_MARA'. l_wa_fieldcat-fieldname = 'MATNR'. APPEND l_wa_fieldcat TO i_fieldcat. CLEAR l_wa_fieldcat-fieldname. l_wa_fieldcat-fieldname = 'ERSDA'. APPEND l_wa_fieldcat TO i_fieldcat. CLEAR l_wa_fieldcat-fieldname. l_wa_fieldcat-fieldname = 'ERNAM'. APPEND l_wa_fieldcat TO i_fieldcat. CLEAR l_wa_fieldcat-fieldname. l_wa_fieldcat-fieldname = 'LAEDA'. APPEND l_wa_fieldcat TO i_fieldcat. CLEAR l_wa_fieldcat-fieldname. l_wa_fieldcat-fieldname = 'AENAM'. APPEND l_wa_fieldcat TO i_fieldcat. CLEAR l_wa_fieldcat-fieldname. l_wa_fieldcat-fieldname = 'VPSTA'. APPEND l_wa_fieldcat TO i_fieldcat. CLEAR l_wa_fieldcat-fieldname. l_wa_fieldcat-fieldname = 'PSTAT'. APPEND l_wa_fieldcat TO i_fieldcat. CLEAR l_wa_fieldcat-fieldname. l_wa_fieldcat-fieldname = 'LVORM'. APPEND l_wa_fieldcat TO i_fieldcat. CLEAR l_wa_fieldcat. l_wa_fieldcat-fieldname = 'MATNR'. l_wa_fieldcat-ref_tabname = 'MARC'. l_wa_fieldcat-tabname = 'I_MARC'. APPEND l_wa_fieldcat TO i_fieldcat. CLEAR l_wa_fieldcat. l_wa_fieldcat-fieldname = 'WERKS'. l_wa_fieldcat-ref_tabname = 'MARC'. l_wa_fieldcat-tabname = 'I_MARC'. APPEND l_wa_fieldcat TO i_fieldcat. CLEAR l_wa_fieldcat. ENDFORM. "sub_populate_fcat' *&---------------------------------------------------------------------* *& Form SUB_USER_COMMAND *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* FORM sub_user_command USING rf_ucomm TYPE syucomm rs TYPE slis_selfield. DATA: l_i_mara TYPE STANDARD TABLE OF x_mara INITIAL SIZE 0, l_lines TYPE i, l_wa_mara TYPE x_mara. CASE rf_ucomm. WHEN 'DETA'. l_i_mara[] = i_mara. DELETE l_i_mara WHERE check = space. l_lines = LINES( l_i_mara ). IF l_lines EQ 0. MESSAGE i001(00) WITH 'No lines selected.'. ELSEIF l_lines GT 1. MESSAGE i001(00) WITH 'More than one lines selected.'. ELSEIF l_lines EQ 1. READ TABLE l_i_mara INTO l_wa_mara INDEX 1. IF sy-subrc = 0. MESSAGE i001(00) WITH 'You have selected material:' l_wa_mara-matnr. ENDIF. ENDIF. * WHEN . * WHEN OTHERS. ENDCASE. ENDFORM. "sub_user_command *&---------------------------------------------------------------------* *& Form sub_set_pf_status *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * -->RT_EXTAB text *----------------------------------------------------------------------* FORM sub_set_pf_status USING rt_extab TYPE slis_t_extab. SET PF-STATUS 'ZSTANDARD'. ENDFORM. "sub_set_pf_status
Hope this helps

Similar Messages

  • AT user command in interactive list(basic) is not calling smartform

    Hi,
    I am facing a problem, which will be strange for all i think.
    in a basic list (not ALV) simple interactive report i am using
    a at user-command. my concern is to collect the checked
    box in the first output report display and store it into the
    internal table and call a smart form when user
    enter 'SHOW' command.
    the problem is when i am entering a show command and
    debugging it, it collects all the checked checkbox in the
    internal table and it even call the smartform print popup
    window, when i give print or printpreview it leave the
    program with out throughing any error.
    here is the code.
    at user-command.
      case sy-ucomm.
        when 'SHOW'.
          do mline times.
            READ LINE SY-INDEX FIELD VALUE itab_item-chkbox.
            if itab_item-chkbox eq 'X'.
    *          write:/ itab_item-banfn,30 itab_item-bnfpo.
              perform extract_final_data using itab_item-bnfpo itab_item-banfn.
            endif.
          enddo.
          refresh: itab, itab_ser.
          clear:   itab, itab_ser.
    * move all data to structure (itab) of form .
          loop at iitab_wa1.
            Move :  iitab_wa1-matnr  to itab-matnr,
                    iitab_wa1-meins  to itab-meins,
                    iitab_wa1-ebeln  to itab-ebeln,
                    iitab_wa1-ebelp  to itab-ebelp,
                    iitab_wa1-menge  to itab-ktmng,
                    iitab_wa1-lfdat  to itab-eindt,
                    iitab_wa1-typ    to itab-typ.
            append itab.
            clear  itab.
          endloop.
    * display the selected item in the report screen.
          if sy-subrc is initial.
    * sorting the table according to RFQ no and item no.
            sort itab by ebeln ebelp.
    * including sr.no in table itab
            clear icnt.
            loop at itab.
              icnt  =  icnt  +  1.
              itab-srno = icnt.
              modify itab.
              clear  itab.
            endloop.
    * Call the output form.
    * YSF_MEDRUCK_RFQ_PR_ser_SAE is in 300
    * for pr to rfq material and service in single form.
            CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
              EXPORTING
                FORMNAME = 'YSF_MEDRUCK_RFQ_PR_MAT_SAE'
              IMPORTING
                FM_NAME  = V_FM.
            CALL FUNCTION '/1BCDWB/SF00000037'
              EXPORTING
                ser_flg          = ser_flag
                material         = p_mat
                services         = p_ser
              TABLES
                itab             = itab
              EXCEPTIONS
                FORMATTING_ERROR = 1
                INTERNAL_ERROR   = 2
                SEND_ERROR       = 3
                USER_CANCELED    = 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.
          else.
            write: ' Some error has occurred'.
          endif.
      endcase.
    <MOVED BY MODERATOR TO THE CORRECT FORUM>
    Edited by: Alvaro Tejada Galindo on Aug 22, 2008 6:16 PM

    hi...
    this shouldnt be happening..ne ways.u may try this..
    put the smartform calling code in a report porgram and then use submit program and return command.
    write this part of code in the report program....you will get all ur variables from stack....
    Report y_call_sf.
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
             EXPORTING
                FORMNAME = 'YSF_MEDRUCK_RFQ_PR_MAT_SAE'
              IMPORTING
                FM_NAME  = V_FM.
            CALL FUNCTION v_fm
              EXPORTING
                ser_flg          = (calling_prog)ser_flag    --> declare like this fro stack access
                material         = (calling_prog)p_mat
                services         = (calling_prog)p_ser
              TABLES
                itab             = (calling_prog)itab
              EXCEPTIONS
                FORMATTING_ERROR = 1
                INTERNAL_ERROR   = 2
                SEND_ERROR       = 3
                USER_CANCELED    = 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.
          else.
            write: ' Some error has occurred'.
          endif.
    calling prog is program from where u r submitting.......
    so ur code will look like this....
    at user-command.
      case sy-ucomm.
        when 'SHOW'.
          do mline times.
            READ LINE SY-INDEX FIELD VALUE itab_item-chkbox.
            if itab_item-chkbox eq 'X'.
             write:/ itab_item-banfn,30 itab_item-bnfpo.
              perform extract_final_data using itab_item-bnfpo itab_item-banfn.
            endif.
          enddo.
          refresh: itab, itab_ser.
          clear:   itab, itab_ser.
    move all data to structure (itab) of form .
          loop at iitab_wa1.
            Move :  iitab_wa1-matnr  to itab-matnr,
                    iitab_wa1-meins  to itab-meins,
                    iitab_wa1-ebeln  to itab-ebeln,
                    iitab_wa1-ebelp  to itab-ebelp,
                    iitab_wa1-menge  to itab-ktmng,
                    iitab_wa1-lfdat  to itab-eindt,
                    iitab_wa1-typ    to itab-typ.
            append itab.
            clear  itab.
          endloop.
    display the selected item in the report screen.
          if sy-subrc is initial.
    sorting the table according to RFQ no and item no.
            sort itab by ebeln ebelp.
    including sr.no in table itab
            clear icnt.
            loop at itab.
              icnt  =  icnt  +  1.
              itab-srno = icnt.
              modify itab.
              clear  itab.
            endloop.
    Call the output form.
    YSF_MEDRUCK_RFQ_PR_ser_SAE is in 300
    for pr to rfq material and service in single form.
           submit y_call_sf and return. -->plz check the syntax
      endcase.

  • AT USER COMMAND is not getting triggerd

    Hi Techie's
    I have two fields on the selection screen
    1) Name:   ___________
    2) Id:         ___________
    I have some buttons say on the Application toolbar say::
    Save            Delete            Modify           Exit
    I have created these buttons in the INITIALIZATION event.
    I am using AT Selection Screen OUTPUT for some logic purpose.
    Later I am writing AT USER COMMAND and pressing  SAVE The function code for SAVE is "SAV".
    But the drama is that AT USER COMMAND is not getting triggered at all.
    It goes first to Initialization--->At selection Screen OUTPUT>Then screen appears> I give the values and press the SAVE button--
    again it goes to the At Selection screen OUTPUT.
    Not even getting the hang of it. Please help if anybody know the story of it.
    ITS SO URGENT.

    At user command is for list processing, you need something like this:
    Pushbuttons in the Application Toolbar
    In the application toolbar of the standard GUI status of the selection screen, five pushbuttons are predefined with the function codes FC01 to FC05, but are inactive by default. You can activate them during the definition of the selection screen as follows:
    SELECTION-SCREEN FUNCTION KEY i.
    The numbering i must be between 1 and 5. The individual function texts must be assigned to the functxt_0i components of structure sscrfields before the selection screen is called. You must declare this structure as an interface work area using the TABLES statement.
    If the user chooses one of these buttons, the runtime environment triggers the AT SELECTION-SCREEN event and the function code FC0i is placed into the component ucomm of the structure sscrfields.
    After the AT SELECTION-SCREEN event has been processed, the system displays the selection screen again. The only way to exit the selection screen and carry on processing the program is to choose Execute (F8). Consequently, the pushbuttons on the application toolbar are more suitable for controlling dynamic modifications of the selection screen than for controlling the program flow.
    REPORT demo_sel_screen_function_key.
    TABLES sscrfields.
    PARAMETERS: p_carrid TYPE s_carr_id,
                p_cityfr TYPE s_from_cit.
    SELECTION-SCREEN: FUNCTION KEY 1,
                      FUNCTION KEY 2.
    INITIALIZATION.
      sscrfields-functxt_01 = 'LH'.
      sscrfields-functxt_02 = 'UA'.
    AT SELECTION-SCREEN.
      CASE sscrfields-ucomm.
          WHEN'FC01'.
          p_carrid = 'LH'.
          p_cityfr = 'Frankfurt'.
        WHEN 'FC02'.
          p_carrid = 'UA'.
          p_cityfr = 'Chicago'.
      ENDCASE.
    START-OF-SELECTION.
      WRITE / 'START-OF-SELECTION'.
    This defines a standard selection screen with two parameters. In the application toolbar, two pushbuttons are assigned the texts LH and UA and activated.
    When the user clicks one of the buttons, the AT SELECTION-SCREEN event is triggered and there the input fields are preassigned correspondingly.

  • At line-selection & at user-command event issue

    hi
    i am working on a interactive report,with at line & at user command event,on list 3 i have used a pf status,to trigger the at user command event,till that i was working with at line selection,which are working fine,but on list 3,i am able to see my pf status,but at user command event is not working properly,its still working like at line selection event,if i clk on record,it take to for nxt action,which i want to do through the action button of pf status.
    In debugging i checked that it coming to at user command,but the action in sy-user is 'PICK' & its doing the operation.
    WHEN '3'.
          IF itab4[] IS NOT INITIAL.
            SET PF-STATUS 'Z203'.
            LOOP AT itab4.
              AT FIRST.
                WRITE:/1 'Material' ,18 'Name'.
              ENDAT.
              WRITE:/1 itab4-matnr,8 itab4-maktx.
              HIDE:itab4-matnr.
            ENDLOOP.
          ELSE.
            WRITE:/ 'No Data Found'.
          ENDIF.
      ENDCASE.
      BREAK-POINT.
    AT USER-COMMAND.
      CASE sy-ucomm.
        WHEN 'CALL'.
          PERFORM bdc_mm02.
      ENDCASE.
    pls tel me how to use at line selection & at user command in same report to make both events working efficiently.
    regds
    vipin

    Check whether you have assigned Function Key F2 to your function code 'CALL'. If so change that function key. The function key F2 is always linked to function code 'PICK'.
    Regards
    Sathar

  • *when we use at user -command and give smaple code fro at user-command*

    Hi experts,
    i am new to abap can any body tell me when we use AT USER-COMMAND and give a sample code for that.
    point will be rewarded.
    thanks.

    Hi,
    AT USER-COMMAND  is a list Event.This Event is triggered when user make an action on the Application Toolber Or Menubar.
    Here is the Program.
    START-OF-SELECTION.
      SET PF-STATUS 'TEST'.
      WRITE:  'Basic list, SY-LSIND =', sy-lsind.
    AT LINE-SELECTION.
      WRITE:  'LINE-SELECTION, SY-LSIND =', sy-lsind.
    AT USER-COMMAND.
      CASE sy-ucomm.
        WHEN 'TEST'.
          WRITE:  'TEST, SY-LSIND =', sy-lsind.
      ENDCASE.
    This program uses a status TEST, defined in the Menu Painter.
    Function key F5 has the function code TEST and the text Test for demo.
    Function code TEST is entered in the List menu.
    The function codes PICK and TEST are assigned to pushbuttons.
    The user can trigger the AT USER-COMMAND event either by pressing F5 , or by choosing List -> Test for demo, or by choosing the pushbutton 'Test for demo'.The user can trigger the AT LINE-SELECTION event by selecting a line.
    Hopr This Will help You.
    Regards,
    Sujit

  • User command is not getting triggered in interactive ALV with LIST display

    Hi experts,
    I have developed an interactive ALV report with LIST display. Here, the issue is, when i double click a record in the primary ALV list, the control must go to the USER COMMAND event which i have written in my report. But the user command event is not getting triggered at all when i double click any record.
    It gives the following information instead.
    "Choose a valid function".
    (My user command name and its respective form name are same.)
    Here is my code..
    START-OF-SELECTION.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          i_callback_program       = sy-repid
          i_structure_name         = p_table
          i_callback_user_command  = 'TST1'
          i_callback_pf_status_set = 'SET_PF_STATUS'
        TABLES
          t_outtab                 = <dyn_table>
        EXCEPTIONS
          program_error            = 1
          OTHERS                   = 2.
      IF sy-subrc <> 0.
      ENDIF.
    FORM tst1 USING r_ucomm LIKE sy-ucomm
                    rs_selfield TYPE slis_selfield.
    * Local data declaration
      DATA: li_tab TYPE REF TO data,
            l_line TYPE REF TO data.
    * Local field-symbols
      FIELD-SYMBOLS:<l_tab> TYPE table,
                    <l_wa>  TYPE ANY.
    * Create table
      CREATE DATA li_tab TYPE STANDARD TABLE OF (p_table).
      ASSIGN li_tab->* TO <l_tab>.
    * Create workarea
      CREATE DATA l_line LIKE LINE OF <l_tab>.
      ASSIGN l_line->* TO <l_wa>.  CASE r_ucomm.
    *   When a record is selected
        WHEN '&IC1'.
    *     Read the selected record
          READ TABLE <dyn_table> ASSIGNING <dyn_wa> INDEX
          rs_selfield-tabindex.      IF sy-subrc = 0.
    *       Store the record in an internal table
            APPEND <dyn_wa> TO <l_tab>.
    *       Fetch the field catalog info
            CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
              EXPORTING
                i_program_name         = 'Z_DEMO_PDF_JG'
                i_structure_name       = p_table
              CHANGING
                ct_fieldcat            = i_fieldcat
              EXCEPTIONS
                inconsistent_interface = 1
                program_error          = 2
                OTHERS                 = 3.
    Please advice what is the msitake i have done here..

    Read the following code:
    pass the  i_callback_user_command = g_user_command to the ALV function module and write the FORM user_command USING ucomm    LIKE sy-ucomm
                            selfield TYPE slis_selfield.
    as shown below.
    thanx
    Data for ALV display
    DATA  : gt_fieldcat TYPE slis_t_fieldcat_alv,
            gt_events           TYPE slis_t_event,
            g_variant LIKE disvariant,
            g_user_command      TYPE slis_formname VALUE 'USER_COMMAND',
            g_status            TYPE slis_formname VALUE 'SET_PF_STATUS',
            gt_list_top_of_page TYPE slis_t_listheader,
            g_repid LIKE sy-repid,
            gf_pos TYPE i
    Data for ALV display
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
               EXPORTING
              i_callback_program      = g_repid
                 i_callback_program      = sy-repid
                 it_fieldcat             = gt_fieldcat[]
           it_events               = gt_events[]
              i_callback_user_command = g_user_command
                 i_save                  = 'A'
                 is_variant              = g_variant
               TABLES
                 t_outtab                = it_print.
    FORM user_command USING ucomm    LIKE sy-ucomm
                            selfield TYPE slis_selfield.
      CASE ucomm.
        WHEN '&IC1'.
          CASE selfield-sel_tab_field.
            WHEN '1-KUNNR'.
              READ TABLE it_print INTO wa_print INDEX selfield-tabindex.
              IF sy-subrc = 0.
                SET PARAMETER ID 'BPA' FIELD wa_print-kunnr.
                CALL TRANSACTION 'BP'.
              ENDIF.
            WHEN '1-MATNR'.
              READ TABLE it_print INTO wa_print INDEX selfield-tabindex.
              IF sy-subrc = 0.
                SET PARAMETER ID 'JP_ISS' FIELD wa_print-matnr.
                CALL TRANSACTION 'JP29' AND SKIP FIRST SCREEN..
               GET PARAMETER ID 'WRK' FIELD wa_zprint-werks.
               SET PARAMETER ID 'VKO' FIELD wa_zprint-vkorg.
               SET PARAMETER ID 'VTW' FIELD wa_zprint-vtweg.
               CALL TRANSACTION 'JP29' AND SKIP FIRST SCREEN.
              ENDIF.
    Endcase.
    Endform.

  • How to add user command to drop down list in output screen for OALV Report

    Hi Experts,
    I have created a report by using OALV.
    in Output screen i have  added drop down for one filed with 2 values.
    when i select  value from the drop down list the  program should trigger and the next field should be update.
    so it is possiable to add a user command for the drop down list in output screen.
    if so please help me .
    Regards,
    Rathan

    HI,
    Check the Demo program BCALV_EDIT_06 with having the DATA_CHANGED event still you can capture the changed data. This event will help you.
    or you can go for this code..
    data: it_f4 type lvc_t_f4,
            wa_f4 type lvc_s_f4.
            wa_f4-FIELDNAME = 'CONNID'.
            wa_f4-REGISTER = 'X'.
            wa_f4-GETBEFORE = 'X'.
            wa_f4-CHNGEAFTER = 'X'.
            append wa_f4 to it_f4.
    "register F4 event
      CALL METHOD g_alv_grid_ref->register_f4_for_fields
        EXPORTING
          it_f4  = it_f4.
    "Once you try to pick the value HANDLE_DATA_CHANGED event will be triggered
    "Definition
         methods:
         handle_data_changed FOR EVENT data_changed OF cl_gui_alv_grid
                                  IMPORTING er_data_changed e_onf4 e_onf4_before e_onf4_after,
    "Implementation
    METHOD handle_data_changed .
        DATA: ls_mod_cells TYPE lvc_s_modi.
        IF e_onf4_before = 'X'.
          MESSAGE 'Data changed before F4' TYPE 'I'.
        ENDIF.
        IF e_onf4 = 'X'.   "if event triggered by F4
          MESSAGE 'Data changed on F4' TYPE 'I'.
        ENDIF.
        IF e_onf4_after = 'X'.
          MESSAGE 'Data changed after F4' TYPE 'I'.
        ENDIF.
       "here you know which cell was modified
        LOOP AT er_data_changed->mt_mod_cells INTO ls_mod_cells.
         "just example test case, here you can implement your code for modified cells
          IF ls_mod_cells-value >=5.
            CALL METHOD er_data_changed->add_protocol_entry
              EXPORTING
                i_msgid     = 'SABAPDOCU'
                i_msgty     = 'E'
                i_msgno     = '888'
                i_msgv1     = 'Only numbers below 5 are possibe'
                i_msgv2     = 'Please correct'
                i_fieldname = ls_mod_cells-fieldname
                i_row_id    = ls_mod_cells-row_id.
            CALL METHOD er_data_changed->modify_cell
              EXPORTING
                i_fieldname = ls_mod_cells-fieldname
                i_row_id    = ls_mod_cells-row_id
                i_value     = space.
          ENDIF.
        ENDLOOP.
      ENDMETHOD.                    "handle_data_changed
    Edited by: sum_it2 on Nov 21, 2011 10:07 AM

  • How to edit o/p fields in hierarchical list?

    how to make output fields as input enabled, displayed in the hierarchical list?
    i.e. to make them as editable?Is it possible in list display?

    Please refer this....
    *& Report ZFIR_WRITE_OFF
    REPORT zfir_write_off
    NO STANDARD PAGE HEADING
    MESSAGE-ID zles.
    TYPE-POOLS
    TYPE-POOLS:slis.
    TABLES
    TABLES: kna1, t001, zdunning_data, bsid, t052.
    INTERNAL TABLES
    To check for bukrs in selection screen
    DATA: BEGIN OF t_t001 OCCURS 0,
    bukrs TYPE t001-bukrs,
    END OF t_t001.
    To check for the customer in selection screen
    DATA: BEGIN OF t_kna1 OCCURS 0,
    kunnr TYPE kna1-kunnr,
    name1 TYPE kna1-name1,
    END OF t_kna1.
    *Data from BSID table
    DATA: BEGIN OF t_bsid OCCURS 0,
    bukrs LIKE bsid-bukrs,
    budat LIKE bsid-budat,
    kunnr LIKE bsid-kunnr,
    belnr LIKE bsid-belnr,
    zfbdt LIKE bsid-zfbdt,
    zterm LIKE bsid-zterm,
    dmbtr LIKE bsid-dmbtr,
    waers LIKE bsid-waers,
    vbeln LIKE bsid-vbeln,
    END OF t_bsid.
    *Data from ZDunning_data
    DATA: BEGIN OF t_zdunning OCCURS 0,
    belnr LIKE zdunning_data-belnr,
    kunnr LIKE zdunning_data-kunnr,
    zdef_notice_flg LIKE zdunning_data-zdef_notice_flg,
    zterm_notice_flg LIKE zdunning_data-zterm_notice_flg,
    END OF t_zdunning.
    *Data from t052 for base line days
    DATA: BEGIN OF t_t052 OCCURS 0,
    zterm LIKE t052-zterm,
    ztag1 LIKE t052-ztag1,
    END OF t_t052.
    *with duedate and date for write off calculation
    DATA: BEGIN OF t_data OCCURS 0,
    belnr LIKE bsid-belnr,
    kunnr LIKE bsid-kunnr,
    zterm LIKE bsid-zterm,
    zfbdt LIKE bsid-zfbdt,
    ztag1 LIKE t052-ztag1,
    duedate LIKE bsid-zfbdt,
    wdate LIKE bsid-zfbdt,
    vbeln LIKE bsid-vbeln,
    dmbtr LIKE bsid-dmbtr,
    waers LIKE bsid-waers,
    budat LIKE bsid-budat,
    vbelv like vbfa-vbelv,
    Name1 like kna1-name1,
    END OF t_data.
    *Output display in ALV report
    DATA: BEGIN OF t_output OCCURS 0,
    Flag type C,
    bukrs LIKE bsid-bukrs,
    kunnr LIKE bsid-kunnr,
    vbeln LIKE bsid-vbeln, "Invoice
    posnv like vbfa-posnv,
    wdate LIKE bsid-zfbdt,
    belnr LIKE bsid-belnr,
    dmbtr LIKE bsid-dmbtr,
    waers LIKE bsid-waers,
    budat LIKE bsid-budat,
    vbelv like vbfa-vbelv, "Contract
    name1 like kna1-name1,
    duedate like bsid-zfbdt,
    END OF t_output.
    To get contract number for the billing document number
    DATA: BEGIN OF t_vbfa OCCURS 0,
    vbelv LIKE vbfa-vbelv,
    vbeln LIKE vbfa-vbeln,
    POSNV like vbfa-POSNV,
    END OF t_vbfa.
    data: begin of t_cust occurs 0,
    KUNNR like kna1-kunnr,
    name1 like kna1-name1,
    end of t_cust.
    data: begin of t_head occurs 0,
    VBELv like vbfa-vbelv,
    posnv like vbfa-posnv,
    VKUEGRU type ZLIST_WO_RCANCEL,
    end of t_head.
    data: begin of it_veda occurs 0,
    VBELn LIKE Veda-VBELN,
    POSNR LIKE Veda-VPOSN,
    VKUEGRU LIKE Veda-VKUEGRU,
    end of it_veda.
    VARIABLE DECLARATION
    DATA: l_duedate LIKE bsid-zfbdt,
    l_wdate LIKE bsid-zfbdt.
    VARIABLE FOR ALV DISPLAY
    DATA: t_fieldcat TYPE slis_t_fieldcat_alv,
    wa_fieldcat TYPE slis_fieldcat_alv.
    DATA: t_fieldcat1 TYPE slis_t_fieldcat_alv WITH HEADER LINE,
    wa_fieldcat1 TYPE slis_fieldcat_alv.
    DATA: t_layout TYPE slis_layout_alv.
    DATA: g_repid LIKE sy-repid.
    SELECTION-SCREEN
    *Selection Screen Parameters for user input
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    PARAMETERS:
    *Company Code
    p_bukrs LIKE t001-bukrs OBLIGATORY.
    SELECT-OPTIONS:
    *Customer Number
    s_kunnr FOR kna1-kunnr OBLIGATORY DEFAULT '0' TO 'ZZZZZZZZZZ'.
    PARAMETERS:
    *Write Off Date
    p_wodate TYPE sy-datum OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK b1 .
    AT SELECTION-SCREEN
    *Selection Screen validation for Company code
    AT SELECTION-SCREEN ON p_bukrs.
    SELECT SINGLE bukrs FROM t001 "#EC *
    INTO t_t001
    WHERE bukrs = p_bukrs.
    IF sy-subrc NE 0.
    *Error message for Invalid Company Code
    MESSAGE e000 WITH text-002.
    ENDIF.
    *Selection Screen Validation for Customer
    AT SELECTION-SCREEN ON s_kunnr.
    IF NOT s_kunnr IS INITIAL.
    SELECT SINGLE kunnr name1
    FROM kna1 "#EC *
    INTO t_kna1
    WHERE kunnr IN s_kunnr.
    IF sy-subrc NE 0.
    *Error message for Invalid Customer Number
    MESSAGE e000 WITH text-003.
    ENDIF.
    ENDIF.
    AT SELECTION-SCREEN ON p_wodate.
    IF p_wodate IS INITIAL.
    p_wodate = sy-datum.
    ENDIF.
    INITIALIZATION
    INITIALIZATION.
    PERFORM clear_data.
    START-OF-SELECTION
    START-OF-SELECTION.
    *Get the Accounting Document Number and base line date from BSID
    SELECT bukrs kunnr belnr budat zfbdt zterm dmbtr waers vbeln
    FROM bsid
    INTO corresponding fields of TABLE t_bsid
    WHERE kunnr IN s_kunnr AND
    bukrs = p_bukrs.
    IF NOT t_bsid[] IS INITIAL.
    *Get the Dunning data based on the Accounting Document Number from BSID
    SELECT belnr kunnr zdef_notice_flg zterm_notice_flg
    FROM zdunning_data
    INTO TABLE t_zdunning
    FOR ALL ENTRIES IN t_bsid
    WHERE kunnr = t_bsid-kunnr AND
    belnr = t_bsid-belnr AND
    zdef_notice_flg = 'Y' AND
    zterm_notice_flg = 'Y'.
    *Get the base line days from t052 table based on BSID data
    SELECT zterm ztag1
    FROM t052
    INTO TABLE t_t052
    FOR ALL ENTRIES IN t_bsid
    WHERE zterm = t_bsid-zterm.
    *Calculate the due date(bse line date BSID-ZFBDT + base line days
    *T052-ZTAG )
    IF NOT t_zdunning[] IS INITIAL.
    Get the customer name
    Select KUNNR NAME1 from KNA1
    INTO table t_cust
    for all entries in t_zdunning
    where kunnr = t_zdunning-kunnr.
    LOOP AT t_zdunning.
    LOOP AT t_bsid.
    CLEAR t_zdunning.
    READ TABLE t_zdunning WITH KEY belnr = t_bsid-belnr
    kunnr = t_bsid-kunnr.
    CHECK sy-subrc = 0.
    CLEAR t_t052.
    READ TABLE t_t052 WITH KEY zterm = t_bsid-zterm.
    IF sy-subrc = 0 .
    t_data-belnr = t_zdunning-belnr.
    t_data-kunnr = t_zdunning-kunnr.
    Clear t_cust.
    read table t_cust with key kunnr = t_zdunning-kunnr.
    if sy-subrc = 0.
    t_data-name1 = t_cust-name1.
    endif.
    t_data-zterm = t_bsid-zterm.
    t_data-zfbdt = t_bsid-zfbdt.
    t_data-ztag1 = t_t052-ztag1.
    t_data-vbeln = t_bsid-vbeln.
    t_data-dmbtr = t_bsid-dmbtr.
    t_data-waers = t_bsid-waers.
    t_data-budat = t_bsid-budat.
    *calculate duedate
    CLEAR l_duedate.
    l_duedate = t_bsid-zfbdt + t_t052-ztag1.
    t_data-duedate = l_duedate.
    *calculate date for write off
    CLEAR l_wdate.
    l_wdate = l_duedate + 180.
    t_data-wdate = l_wdate.
    APPEND t_data.
    CLEAR l_wdate.
    CLEAR l_duedate.
    ENDIF.
    ENDLOOP.
    ELSE.
    MESSAGE s000 WITH text-005.
    ENDIF.
    *Check the wdate with write off date in the selection screen value.
    *If this calculated date is Greater than value enetred in selection
    *screen, display the corresponding data in ALV report.
    IF NOT t_data[] IS INITIAL.
    SELECT vbelv vbeln
    POSNV
    FROM vbfa
    INTO TABLE t_vbfa
    FOR ALL ENTRIES IN t_data
    WHERE vbeln = t_data-vbeln.
    and
    VBTYP_V = 'G'.
    *If reason for cancelation is there, no writeoff.
    Select VBELn VPOSN VKUEGRU from Veda
    into table it_veda
    for all entries in t_vbfa
    where vbeln = t_vbfa-vbelv.
    SELECT vbelv
    POSNV
    FROM vbfa
    INTO TABLE t_Head
    FOR ALL ENTRIES IN t_data
    WHERE vbeln = t_data-vbeln
    and
    VBTYP_V = 'G'.
    loop at t_head.
    clear it_veda.
    Read table it_veda with key vbeln = t_head-vbelv
    posnr = t_head-posnv.
    if not it_veda-VKUEGRU is initial.
    Delete t_head where vbelv = it_veda-vbeln and
    posnv = it_veda-posnr.
    endif.
    endloop.
    LOOP AT t_data.
    IF t_data-wdate LE p_wodate.
    t_output-bukrs = p_bukrs.
    t_output-kunnr = t_data-kunnr.
    CLEAR t_vbfa.
    READ TABLE t_vbfa WITH KEY vbeln = t_data-vbeln.
    read table t_head with key vbelv = t_vbfa-vbelv
    posnv = t_vbfa-posnv.
    if sy-subrc = 0.
    t_output-vbelv = t_vbfa-vbelv.
    t_output-posnv = t_vbfa-posnv.
    t_output-name1 = t_data-name1.
    t_output-wdate = t_data-wdate.
    t_output-belnr = t_data-belnr.
    t_output-dmbtr = t_data-dmbtr.
    t_output-waers = t_data-waers.
    t_output-budat = t_data-budat.
    t_output-vbeln = t_data-vbeln.
    t_output-duedate = t_data-duedate .
    APPEND t_output.
    ENDIF.
    clear t_output.
    ENDIF.
    ENDLOOP.
    ELSE.
    MESSAGE s000 WITH text-006.
    ENDIF.
    *ALV display for the output records
    IF NOT t_output[] IS INITIAL.
    PERFORM alv_display.
    ELSE.
    MESSAGE s000 WITH text-006.
    ENDIF.
    ELSE.
    MESSAGE s000 WITH text-004.
    ENDIF.
    *& Form clear_data
    text
    --> p1 text
    <-- p2 text
    FORM clear_data .
    CLEAR:t_t001,
    t_kna1,
    t_bsid,
    t_zdunning,
    t_t052,
    t_data,
    t_output,
    wa_fieldcat,
    t_layout,
    t_fieldcat,
    t_vbfa.
    REFRESH:t_t001,
    t_kna1,
    t_bsid,
    t_zdunning,
    t_t052,
    t_data,
    t_output,
    t_fieldcat,
    t_vbfa.
    clear:t_head,
    it_veda.
    Refresh:t_head,
    it_veda.
    Clear T_cust.
    Refresh t_data.
    ENDFORM. " clear_data
    *& Form alv_display
    text
    --> p1 text
    <-- p2 text
    FORM alv_display .
    *To build the field catalogue
    PERFORM build_fieldcatalog1.
    PERFORM build_fieldcatalog.
    *To build the ALV layout
    PERFORM build_layout.
    *To displayt the data in ALV report
    PERFORM display_alv_report.
    ENDFORM. " alv_display
    *& Form build_fieldcatalog
    text
    --> p1 text
    <-- p2 text
    FORM build_fieldcatalog1 .
    REFRESH t_fieldcat1.
    CLEAR wa_fieldcat.
    wa_fieldcat-col_pos = '1'.
    wa_fieldcat-fieldname = 'VBELV'.
    wa_fieldcat-tabname = 'T_HEAD'.
    wa_fieldcat-seltext_l = 'Contract Number'.
    wa_fieldcat-Checkbox = 'X'.
    wa_fieldcat-edit = 'X'.
    wa_fieldcat-no_out = 'X'.
    wa_fieldcat-outputlen = '15'.
    APPEND wa_fieldcat TO t_fieldcat.
    CLEAR wa_fieldcat.
    wa_fieldcat-col_pos = '2'.
    wa_fieldcat-fieldname = 'POSNV'.
    wa_fieldcat-tabname = 'T_HEAD'.
    wa_fieldcat-seltext_l = 'Item Number'.
    wa_fieldcat-outputlen = '15'.
    APPEND wa_fieldcat TO t_fieldcat.
    CLEAR wa_fieldcat.
    wa_fieldcat-col_pos = '3'.
    wa_fieldcat-fieldname = 'VKUEGRU'.
    wa_fieldcat-edit = 'X'.
    wa_fieldcat-input = 'X'.
    wa_fieldcat-tabname = 'T_HEAD'.
    wa_fieldcat-drdn_hndl = '1'.
    wa_fieldcat-seltext_l = 'Reason for Cancel'.
    wa_fieldcat-outputlen = '25'.
    APPEND wa_fieldcat TO t_fieldcat.
    CLEAR wa_fieldcat.
    endform.
    FORM build_fieldcatalog .
    REFRESH t_fieldcat.
    CLEAR wa_fieldcat.
    wa_fieldcat-col_pos = '4'.
    wa_fieldcat-fieldname = 'KUNNR'.
    wa_fieldcat-tabname = 'T_OUTPUT'.
    wa_fieldcat-seltext_l = 'Customer Number'.
    wa_fieldcat-outputlen = '15'.
    APPEND wa_fieldcat TO t_fieldcat.
    CLEAR wa_fieldcat.
    wa_fieldcat-col_pos = '5'.
    wa_fieldcat-fieldname = 'NAME1'.
    wa_fieldcat-tabname = 'T_OUTPUT'.
    wa_fieldcat-seltext_l = 'Customer Name'.
    wa_fieldcat-outputlen = '30'.
    APPEND wa_fieldcat TO t_fieldcat.
    CLEAR wa_fieldcat.
    wa_fieldcat-col_pos = '6'.
    wa_fieldcat-fieldname = 'VBELV'.
    wa_fieldcat-tabname = 'T_OUTPUT'.
    wa_fieldcat-seltext_l = 'Contract Number'.
    wa_fieldcat-outputlen = '20'.
    APPEND wa_fieldcat TO t_fieldcat.
    CLEAR wa_fieldcat.
    wa_fieldcat-col_pos = '7'.
    wa_fieldcat-fieldname = 'VBELN'.
    wa_fieldcat-tabname = 'T_OUTPUT'.
    wa_fieldcat-seltext_l = 'Invoice No.'.
    wa_fieldcat-outputlen = '10'.
    APPEND wa_fieldcat TO t_fieldcat.
    CLEAR wa_fieldcat.
    wa_fieldcat-col_pos = '8'.
    wa_fieldcat-fieldname = 'BELNR'.
    wa_fieldcat-tabname = 'T_OUTPUT'.
    wa_fieldcat-seltext_l = 'Acc doc Number'.
    wa_fieldcat-outputlen = '20'.
    APPEND wa_fieldcat TO t_fieldcat.
    CLEAR wa_fieldcat.
    wa_fieldcat-col_pos = '9'.
    wa_fieldcat-fieldname = 'WAERS'.
    wa_fieldcat-tabname = 'T_OUTPUT'.
    wa_fieldcat-seltext_l = 'Currency'.
    wa_fieldcat-outputlen = '15'.
    APPEND wa_fieldcat TO t_fieldcat.
    CLEAR wa_fieldcat.
    wa_fieldcat-col_pos = '10'.
    wa_fieldcat-fieldname = 'DMBTR'.
    wa_fieldcat-tabname = 'T_OUTPUT'.
    wa_fieldcat-do_sum = 'X'. "SUM UPON DISPLAY
    wa_fieldcat-datatype = 'CURR'.
    wa_fieldcat-seltext_l = 'Amount'.
    wa_fieldcat-outputlen = '15'.
    APPEND wa_fieldcat TO t_fieldcat.
    CLEAR wa_fieldcat.
    wa_fieldcat-col_pos = '11'.
    wa_fieldcat-fieldname = 'DUEDATE'.
    wa_fieldcat-tabname = 'T_OUTPUT'.
    wa_fieldcat-seltext_l = 'Due Date'.
    wa_fieldcat-outputlen = '20'.
    APPEND wa_fieldcat TO t_fieldcat.
    data: lt_dropdown type lvc_t_drop,
    ls_dropdown type lvc_s_drop.
    First listbox (handle '1').
    ls_dropdown-handle = '1'.
    ls_dropdown-value = 'KG'.
    append ls_dropdown to lt_dropdown.
    ls_dropdown-handle = '1'.
    ls_dropdown-value = 'G'.
    append ls_dropdown to lt_dropdown.
    call method g_grid->set_drop_down_table
    exporting it_drop_down = lt_dropdown.
    ENDFORM. " build_fieldcatalog
    *& Form build_layout
    text
    --> p1 text
    <-- p2 text
    FORM build_layout .
    t_layout-no_input = 'X'.
    t_layout-colwidth_optimize = 'X'.
    ENDFORM. " build_layout
    *& Form display_alv_report
    text
    --> p1 text
    <-- p2 text
    FORM display_alv_report .
    g_repid = sy-repid.
    data g_keyinfo type SLIS_KEYINFO_ALV.
    g_keyinfo-HEADER01 = 'VBELV'.
    g_keyinfo-ITEM01 = 'VBELV'.
    g_keyinfo-HEADER02 = 'POSNV'.
    g_keyinfo-ITEM02 = 'POSNV'.
    CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
    EXPORTING
    i_interface_check = 'I'
    i_callback_program = g_repid
    i_callback_pf_status_set = 'SET_STATUS'
    i_callback_user_command = 'USER_COMMAND'
    is_layout = gs_layout
    it_fieldcat = t_fieldcat[]
    i_default = ' '
    i_save = 'A'
    i_tabname_header = 'T_HEAD'
    i_tabname_item = 'T_OUTPUT'
    i_structure_name_header = v_headers_table
    i_structure_name_item = v_items_table
    is_keyinfo = g_keyinfo
    i_bypassing_buffer = 'X'
    TABLES
    t_outtab_header = t_head[]
    t_outtab_item = i_result
    t_outtab_item = t_output[]
    EXCEPTIONS
    program_error = 1
    OTHERS = 2.
    REFRESH: t_fieldcat[].
    refresh t_fieldcat1[].
    ENDFORM. " display_alv_report
    form SET_STATUS using extab TYPE slis_t_extab.
    SET PF-STATUS 'ZEO_S1' .
    endform.
    *& Form Top_Of_Page
    Top_Of_Page event in ALV
    FORM top_of_page .
    DATA: t_header TYPE slis_t_listheader,
    wa_header TYPE slis_listheader.
    Title
    wa_header-typ = 'H'.
    wa_header-info = ' Write Off Worklist'.
    APPEND wa_header TO t_header.
    CLEAR wa_header.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
    it_list_commentary = t_header.
    ENDFORM. "Top_Of_Page
    *User Command for the button
    form user_command using r_ucomm type syucomm
    ls_selfield type SLIS_SELFIELD.
    Break-point.
    case r_ucomm.
    when 'EXEC'.
    data: begin of lt_cancel occurs 0.
    include structure ZCANCEL.
    data end of lt_cancel.
    Clear lt_cancel.
    Refresh lt_cancel.
    Data: ref1 type ref to cl_gui_alv_grid.
    CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
    IMPORTING
    E_GRID = ref1.
    call method ref1->check_changed_data.
    loop at t_Head where VKUEGRU is not initial.
    if ( t_HEAD-VKUEGRU NE '1' ) or
    ( t_Head-VKUEGRU NE '2' ) or
    ( t_head-VKUEGRU NE '3' ).
    Clear t_head-vkuegru.
    message e000 with text-110.
    endif.
    lt_cancel-vbeln = t_head-vbelv.
    lt_cancel-posnr = t_head-posnv.
    lt_cancel-VKUEGRU = t_head-VKUEGRU.
    Append lt_cancel.
    Clear lt_cancel.
    Endloop.
    CALL FUNCTION 'ZSD_CNTR_CANCEL'
    TABLES
    zcancel = lt_cancel.
    message s000 .
    endcase.
    endform.
    Regards
    vasu

  • How to use AT LINE-SELECTION and AT USER-COMMAND in one report????

    Dear all,
    I have a problem in reports I want to use AT USER-COMMAND.and AT LINE-SELECTION.both in the one report.
    But as soon as I use SET PF-STATUS my AT LINE-SELECTION event stop workingand only AT USER-COMMAND is working.
    How can I use both of them in one report for your reference I am giving my test program below.
    REPORT ZTEST111 .
    SET PF-STATUS '100'.
    DO 10 TIMES.
    WRITE:/ SY-INDEX.
    HIDE SY-INDEX.
    ENDDO.
    START-OF-SELECTION.
    AT LINE-SELECTION.
    MESSAGE I002(SY) WITH SY-INDEX.
    AT USER-COMMAND.
    MESSAGE I002(SY) WITH 'USER COMMAND'.
    END-OF-SELECTION.
    Thanks in advance
    Sachin Gautam

    hi
    Syntax
    AT USER-COMMAND.
    Effect
    This statement defines an event block whose event is triggered by the ABAP runtime environment if, during the display of a screen list, a function with a self-defined function code was chosen.
    Note
    Self-defined function codes are all those that include character combinations, except for the following:
    The function codes PICK and PF## ("##" stands for 01 to 24) do not cause the event AT USER-COMMAND, but the events AT LINE-SELECTION and AT PF##.
    All function codes that start with the character "%" are interpreted as system functions and do not cause the event AT USER-COMMAND. The system functions for lists are listed in the following table 1.
    The function codes in the following table 2, likewise, do not cause the event AT USER-COMMAND, but are handled by the list processor.
    Table 1
    Function code Function
    %CTX Call a context menu
    %EX Exit
    %PC Save to file
    %PRI Print
    %SC Search for ...
    %SC+ Find next
    %SL Search in office
    %ST Save to report tree
    Table 2
    Function code Function
    BACK Back
    P- Scroll to previous page
    P-- Scroll to first page
    P+ Scroll to next page
    P++ Scroll to last page
    PFILE name Store list lines in a text file named abap.lst in standard character representation in the standard directory of the application server. If a name is entered using name, this is converted to lowercase letters and used as the file name.
    PL- Scroll to first line of the page
    PL-n Scroll n lines back
    PL+ Scroll to last line of the page
    PL+n Scroll n lines up
    PNOP No effect
    PP- Scroll back one page
    PP-n Scroll n pages back
    PP+ Scroll one page forward
    PP+n Scroll n pages forwad
    PPn Scroll to beginning of page n
    PRI, PRINT Print
    PS-- Scroll to first column
    PS++ Scroll to last column
    PS- Scroll one column to the left
    PS-n Scroll n columns to the left
    PS+ Scroll one column to the right
    PS+n Scroll n columns to the right
    PSn Scroll to column n
    PZn Scroll to line n
    RW Cancel

  • Reg:user command in oops alv...

    hi all,
           i have creeated an alv report using container, and by calling the method set table for first display.the output is coming,wat i want is,
         i have  placed a hotspot on document number field,if users clicks it,it has to call fb03 transaction code and the corresponding document shoud open...
    i have did this type in ordinary alv report,but how to do this using oops concept,
    plz give me a solution along with coding ore sample
             thx in advance.....
    regards,
    balaji.s

    hi balaji for any thing in alv oops look at this,
    oops_beginers
    http://help.sap.com/saphelp_nw04/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
    ALV Gird Control (BC-SRV-ALE)
    SAP Container
    SAP Control Framework
    or Thread New To OOPs ABAP
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/abap%20objects/abap%20code%20sample%20to%20learn%20basic%20concept%20of%20object-oriented%20programming.doc
    General Tutorial for OOPS
    check all the below links
    http://www.sapgenie.com/abap/OO/index.htm
    http://www.geocities.com/victorav15/sapr3/abap_ood.html
    http://www.brabandt.de/html/abap_oo.html
    Check this cool weblog:
    /people/thomas.jung3/blog/2004/12/08/abap-persistent-classes-coding-without-sql
    /people/thomas.jung3/blog/2004/12/08/abap-persistent-classes-coding-without-sql
    http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b6254f411d194a60000e8353423/frameset.htm
    http://www.sapgenie.com/abap/OO/
    http://www.sapgenie.com/abap/OO/index.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b5654f411d194a60000e8353423/content.htm
    http://www.esnips.com/doc/375fff1b-5a62-444d-8ec1-55508c308b17/prefinalppt.ppt
    http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    http://www.esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
    http://www.allsaplinks.com/
    http://www.sap-img.com/
    http://www.sapgenie.com/
    http://help.sap.com
    http://www.sapgenie.com/abap/OO/
    http://www.sapgenie.com/abap/OO/index.htm
    http://www.sapgenie.com/abap/controls/index.htm
    http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    http://www.esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
    http://www.sapgenie.com/abap/OO/index.htm
    http://help.sap.com/saphelp_erp2005/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
    http://www.sapgenie.com/abap/OO/
    these links
    http://help.sap.com/saphelp_47x200/helpdata/en/ce/b518b6513611d194a50000e8353423/content.htm
    For funtion module to class
    http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5954f411d194a60000e8353423/content.htm
    for classes
    http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5c54f411d194a60000e8353423/content.htm
    for methods
    http://help.sap.com/saphelp_47x200/helpdata/en/08/d27c03b81011d194f60000e8353423/content.htm
    for inheritance
    http://help.sap.com/saphelp_47x200/helpdata/en/dd/4049c40f4611d3b9380000e8353423/content.htm
    for interfaces
    http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b6254f411d194a60000e8353423/content.htm
    Check these links.
    http://www.henrikfrank.dk/abapuk.html
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/abap%20objects/abap%20code%20sample%20to%20learn%20basic%20concept%20of%20object-oriented%20programming.doc
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20to%20display%20data%20in%20alv%20grid%20using%20object%20oriented%20programming.doc
    Go through the below links,
    For Materials:
    1) http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCABA/BCABA.pdf -- Page no: 1291
    2) http://esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
    3) http://esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    4) http://esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
    5) http://esnips.com/doc/92be4457-1b6e-4061-92e5-8e4b3a6e3239/Object-Oriented-ABAP.ppt
    6) http://esnips.com/doc/448e8302-68b1-4046-9fef-8fa8808caee0/abap-objects-by-helen.pdf
    7) http://esnips.com/doc/39fdc647-1aed-4b40-a476-4d3042b6ec28/class_builder.ppt
    8) http://www.amazon.com/gp/explorer/0201750805/2/ref=pd_lpo_ase/102-9378020-8749710?ie=UTF8
    OO ABAP links:
    1) http://www.erpgenie.com/sap/abap/OO/index.htm
    2) http://help.sap.com/saphelp_nw04/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
    go through these links
    http://www.erpgenie.com/abap/index.htm
    http://sic.fh-lu.de/sic/bic.nsf/(vJobangebote)/EC8AD2AE0349CE92C12572200026FDB8/$File/Intern%20or%20Working%20Student%20as%20ABAB%20OO%20Developer.pdf?Open
    http://help.sap.com/saphelp_nw2004s/helpdata/en/43/41341147041806e10000000a1553f6/frameset.htm
    http://help.sap.com/saphelp_47x200/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
    ABAP_OBJECTS_ENJOY_0 Template for Solutions of ABAP Object Enjoy Course
    ABAP_OBJECTS_ENJOY_1 Model Solution 1: ABAP Objects Enjoy Course
    ABAP_OBJECTS_ENJOY_2 Model Solution 2: ABAP Objects Enjoy Course
    ABAP_OBJECTS_ENJOY_3 Model Solution 3: ABAP Objects Enjoy Course
    ABAP_OBJECTS_ENJOY_4 Model Solution 4: ABAP Objects Enjoy Course
    ABAP_OBJECTS_ENJOY_5 Model Solution 5: ABAP Objects Enjoy Course
    DEMO_ABAP_OBJECTS Complete Demonstration for ABAP Objects
    DEMO_ABAP_OBJECTS_CONTROLS GUI Controls on Screen
    DEMO_ABAP_OBJECTS_EVENTS Demonstration of Events in ABAP Objects
    DEMO_ABAP_OBJECTS_GENERAL ABAP Objects Demonstration
    DEMO_ABAP_OBJECTS_INTERFACES Demonstration of Interfaces in ABAP Objects
    DEMO_ABAP_OBJECTS_METHODS Demonstration of Methods in ABAP Objects
    DEMO_ABAP_OBJECTS_SPLIT_SCREEN Splitter Control on Screen
    check the below links lot of info and examples r there
    http://www.sapgenie.com/abap/OO/index.htm
    http://www.geocities.com/victorav15/sapr3/abap_ood.html
    http://www.brabandt.de/html/abap_oo.html
    Check this cool weblog:
    /people/thomas.jung3/blog/2004/12/08/abap-persistent-classes-coding-without-sql
    /people/thomas.jung3/blog/2004/12/08/abap-persistent-classes-coding-without-sql
    http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b6254f411d194a60000e8353423/frameset.htm
    http://www.sapgenie.com/abap/OO/
    http://www.sapgenie.com/abap/OO/index.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b5654f411d194a60000e8353423/content.htm
    http://www.esnips.com/doc/375fff1b-5a62-444d-8ec1-55508c308b17/prefinalppt.ppt
    http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    http://www.esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
    http://www.allsaplinks.com/
    http://www.sap-img.com/
    http://www.sapgenie.com/
    http://help.sap.com
    http://www.sapgenie.com/abap/OO/
    http://www.sapgenie.com/abap/OO/index.htm
    http://www.sapgenie.com/abap/controls/index.htm
    http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    http://www.esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
    http://www.sapgenie.com/abap/OO/index.htm
    http://help.sap.com/saphelp_erp2005/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
    http://www.sapgenie.com/abap/OO/
    these links
    http://help.sap.com/saphelp_47x200/helpdata/en/ce/b518b6513611d194a50000e8353423/content.htm
    For funtion module to class
    http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5954f411d194a60000e8353423/content.htm
    for classes
    http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5c54f411d194a60000e8353423/content.htm
    for methods
    http://help.sap.com/saphelp_47x200/helpdata/en/08/d27c03b81011d194f60000e8353423/content.htm
    for inheritance
    http://help.sap.com/saphelp_47x200/helpdata/en/dd/4049c40f4611d3b9380000e8353423/content.htm
    for interfaces
    http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b6254f411d194a60000e8353423/content.htm
    For Materials:
    1) http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCABA/BCABA.pdf -- Page no: 1291
    2) http://esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
    3) http://esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    4) http://esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
    5) http://esnips.com/doc/92be4457-1b6e-4061-92e5-8e4b3a6e3239/Object-Oriented-ABAP.ppt
    6) http://esnips.com/doc/448e8302-68b1-4046-9fef-8fa8808caee0/abap-objects-by-helen.pdf
    7) http://esnips.com/doc/39fdc647-1aed-4b40-a476-4d3042b6ec28/class_builder.ppt
    8) http://www.amazon.com/gp/explorer/0201750805/2/ref=pd_lpo_ase/102-9378020-8749710?ie=UTF8
    1) http://www.erpgenie.com/sap/abap/OO/index.htm
    2) http://help.sap.com/saphelp_nw04/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
    ALVOOPS
    http://www.abap4.it/download/ALV.pdf
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907
    http://www.erpgenie.com/abap/controls/alvgrid.htm
    OOPS with ABAP
    https://www.sdn.sap.com/irj/sdn/wiki?path=/pages/viewpage.action&pageid=37566
    /people/rich.heilman2/blog/2005/07/27/dynamic-internal-tables-and-structures--abap
    http://www.sapgenie.com/abap/OO/
    For understanding COntrol Frameworks in OO ABAP, check this.
    http://www.sapgenie.com/abap/controls/index.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/ce/b518b6513611d194a50000e8353423/content.htm
    http://www.sapgenie.com/abap/OO/
    http://www.sapgenie.com/abap/OO/index.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b5654f411d194a60000e8353423/content.htm
    http://www.esnips.com/doc/375fff1b-5a62-444d-8ec1-55508c308b17/prefinalppt.ppt
    http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    http://www.esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
    http://www.allsaplinks.com/
    http://www.sap-img.com/
    http://www.sapgenie.com/
    http://help.sap.com
    http://www.sapgenie.com/abap/OO/
    http://www.sapgenie.com.
    http://www.sapgenie.com/abap/OO/index.htm
    http://www.sapgenie.com/abap/controls/index.htm
    http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    http://www.esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
    http://www.sapgenie.com/abap/OO/index.htm
    http://help.sap.com/saphelp_erp2005/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
    http://www.sapgenie.com/abap/OO/
    http://www.sapgenie.com/abap/OO/index.htm
    http://www.geocities.com/victorav15/sapr3/abap_ood.html
    http://www.brabandt.de/html/abap_oo.html
    ALVOOPS
    http://www.erpgenie.com/abap/controls/alvgrid.htm
    OOPS with ABAP
    https://www.sdn.sap.com/irj/sdn/wiki?path=/pages/viewpage.action&pageid=37566
    /people/rich.heilman2/blog/2005/07/27/dynamic-internal-tables-and-structures--abap
    http://www.sapgenie.com/abap/OO/
    For understanding COntrol Frameworks in OO ABAP, check this.
    http://www.sapgenie.com/abap/controls/index.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/ce/b518b6513611d194a50000e8353423/content.htm
    http://www.sapgenie.com/abap/OO/
    http://www.sapgenie.com/abap/OO/index.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b5654f411d194a60000e8353423/content.htm
    http://www.esnips.com/doc/375fff1b-5a62-444d-8ec1-55508c308b17/prefinalppt.ppt
    http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    http://www.esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
    http://www.allsaplinks.com/
    http://www.sap-img.com/
    http://www.sapgenie.com/
    http://help.sap.com
    http://www.sapgenie.com/abap/OO/
    http://www.sapgenie.com.
    http://www.sapgenie.com/abap/OO/index.htm
    http://www.sapgenie.com/abap/controls/index.htm
    http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    http://www.esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
    http://www.sapgenie.com/abap/OO/index.htm
    http://help.sap.com/saphelp_erp2005/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
    http://www.sapgenie.com/abap/OO/
    http://www.sapgenie.com/abap/OO/index.htm
    http://www.geocities.com/victorav15/sapr3/abap_ood.html
    http://www.brabandt.de/html/abap_oo.html
    Regarding  ALV Grid  Control using OOPs concepts
    Regarding  ALV Grid  Control using OOPs concepts
    OOPS – OO ABAP
    http://esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
    http://esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    http://esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
    http://esnips.com/doc/92be4457-1b6e-4061-92e5-8e4b3a6e3239/Object-Oriented-ABAP.ppt
    http://esnips.com/doc/448e8302-68b1-4046-9fef-8fa8808caee0/abap-objects-by-helen.pdf
    http://esnips.com/doc/39fdc647-1aed-4b40-a476-4d3042b6ec28/class_builder.ppt
    http://www.amazon.com/gp/explorer/0201750805/2/ref=pd_lpo_ase/102-9378020-8749710?ie=UTF8
    http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b5654f411d194a60000e8353423/content.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/c3/225b5654f411d194a60000e8353423/content.htm
    DIRLL DOWN AND INTERACTIVE REPORT
    http://www.sap-img.com/abap/difference-between-drilldown-report-and-interactive-report.htm
    PAGE BREAK FOR ALV LIST
    check out this link
    http://www.abap4.it/download/ALV.pdf
    good book on ABAP objects(OOPS)
    http://www.esnips.com/doc/bc475662-82d6-4412-9083-28a7e7f1ce09/Abap-Objects---An-Introduction-To-Programming-Sap-Applications
    How to check Cluster Table Data
    https://forums.sdn.sap.com/click.jspa?searchID=5215473&messageID=3520315
    http://www.sap-img.com/abap/the-different-types-of-sap-tables.htm
    http://help.sap.com/saphelp_47x200/helpdata/en/81/415d363640933fe10000009b38f839/frameset.htm
    Check this cool weblog:
    /people/thomas.jung3/blog/2004/12/08/abap-persistent-classes-coding-without-sql
    /people/thomas.jung3/blog/2004/12/08/abap-persistent-classes-coding-without-sql
    http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b6254f411d194a60000e8353423/frameset.htm
    http://www.sapgenie.com/abap/OO/
    http://www.sapgenie.com/abap/OO/index.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b5654f411d194a60000e8353423/content.htm
    http://www.esnips.com/doc/375fff1b-5a62-444d-8ec1-55508c308b17/prefinalppt.ppt
    http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    http://www.esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
    http://www.allsaplinks.com/
    http://www.sap-img.com/
    http://www.sapgenie.com/
    http://help.sap.com
    http://www.sapgenie.com/abap/OO/
    http://www.sapgenie.com/abap/OO/index.htm
    http://www.sapgenie.com/abap/controls/index.htm
    http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    http://www.esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
    http://www.sapgenie.com/abap/OO/index.htm
    http://help.sap.com/saphelp_erp2005/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
    http://www.sapgenie.com/abap/OO/
    these links
    http://help.sap.com/saphelp_47x200/helpdata/en/ce/b518b6513611d194a50000e8353423/content.htm
    For funtion module to class
    http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5954f411d194a60000e8353423/content.htm
    for classes
    http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5c54f411d194a60000e8353423/content.htm
    for methods
    http://help.sap.com/saphelp_47x200/helpdata/en/08/d27c03b81011d194f60000e8353423/content.htm
    for inheritance
    http://help.sap.com/saphelp_47x200/helpdata/en/dd/4049c40f4611d3b9380000e8353423/content.htm
    for interfaces
    http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b6254f411d194a60000e8353423/content.htm
    For Materials:
    1) http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCABA/BCABA.pdf -- Page no: 1291
    2) http://esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
    3) http://esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    4) http://esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
    5) http://esnips.com/doc/92be4457-1b6e-4061-92e5-8e4b3a6e3239/Object-Oriented-ABAP.ppt
    6) http://esnips.com/doc/448e8302-68b1-4046-9fef-8fa8808caee0/abap-objects-by-helen.pdf
    7) http://esnips.com/doc/39fdc647-1aed-4b40-a476-4d3042b6ec28/class_builder.ppt
    8) http://www.amazon.com/gp/explorer/0201750805/2/ref=pd_lpo_ase/102-9378020-8749710?ie=UTF8
    1) http://www.erpgenie.com/sap/abap/OO/index.htm
    2) http://help.sap.com/saphelp_nw04/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
    COLOURING Single Columan
    http://www.sapfans.com/forums/viewtopic.php?t=52107
    Check this thread to get more idea about ALVs.
    Interactive ALV
    Check the following link for ALV Block List
    http://www.sap-basis-abap.com/abap/sample-program-on-block-lists.htm
    Check the following link for ALV Hierarchial
    http://www.sap-img.com/abap/how-to-use-alv-for-hierarchical-lists.htm
    regards,
    venkat.

  • Trying to generate the spool from at user command...

    Hi Gurus,
    The spool is not getting created in the foreground, I think I am missing something here, the code is below.
    AT USER-COMMAND.
      CASE sy-ucomm .
        WHEN 'SEND'.
          PERFORM get_cust_emails.
          LOOP AT i_output.
            READ TABLE i_mail INTO wa_mail WITH KEY kunnr = i_output-rcvprn. " rcvprn  is customer number,
            IF sy-subrc IS INITIAL.
              IF wa_mail-smtp_addr IS NOT INITIAL.  if the customer has an email then create the entry in i_output_mail.
                i_output_mail = i_output.
                APPEND i_output_mail.
                CLEAR: i_output_mail.
                DELETE i_output.
                CLEAR: i_output.
              ENDIF.
            ENDIF.
          ENDLOOP.
    Setting the Print Parameter's for Portrait
          PERFORM f_print_report. " form is below
          SORT i_output_mail BY rcvprn belnr. "rcvprn is the customer number
          PERFORM f_prepare_mail. " form is below
          MESSAGE i307.
          LEAVE LIST-PROCESSING.
         WHEN 'BACK'.
          LEAVE TO SCREEN 0.
        WHEN 'EXIT'.
          LEAVE PROGRAM.
        WHEN 'CANCEL'.
          LEAVE PROGRAM.
      ENDCASE.
    Subroutines provided below:
    FORM f_print_report .
    *Program name
      DATA : l_prog_name TYPE sy-repid,
             i_print TYPE slis_print_alv.
    Local Constants
      CONSTANTS: lc_vline TYPE c VALUE '|'.
      l_prog_name = sy-repid.
      CLEAR: i_events[], wa_events.
      wa_events-name  = c_top. "'TOP_OF_PAGE'.
      wa_events-form  = c_top.
      APPEND wa_events TO i_events.
      CONSTANTS: lc_prtr   TYPE sypdest VALUE 'LP01',
                 lc_layout TYPE sypaart VALUE 'X_90_120',
                 lc_layout1 TYPE sypaart VALUE 'X_65_255',
                 lc_lines  TYPE sylinsz VALUE '-120',
                 lc_lines1  TYPE sylinsz VALUE '-185',
                 lc_mode   TYPE sycallr VALUE 'CURRENT'.
    Get the print paramters
      CALL FUNCTION 'GET_PRINT_PARAMETERS'
        EXPORTING
          authority              = space
          destination            = lc_prtr
          immediately            = space
          new_list_id            = c_x
          layout                 = lc_layout
          line_size              = lc_lines
          mode                   = lc_mode
          no_dialog              = c_x
          report                 = sy-repid
          user                   = sy-uname
          suppress_shading       = c_x
        IMPORTING
          out_parameters         = i_pr_param
          valid                  = l_valid
        EXCEPTIONS
          archive_info_not_found = 1
          invalid_print_params   = 2
          invalid_archive_params = 3
          OTHERS                 = 4.
      CLEAR: g_heading_completed."Indicator for print header
    ENDFORM.                    "f_print_report
    FORM f_prepare_mail .
      LOOP AT i_output_mail.
        l_flag_mail = 'X'.
        CLEAR: l_flag.
        WRITE: /08(1) c_vline, 10(09) i_output_mail-stapa1, 20(1) c_vline,21(10) i_output_mail-datum,
                31(1) c_vline, 32(10) i_output_mail-belnr,  42(1) c_vline,43(15) i_output_mail-total,
                58(1) c_vline, 59(15) i_output_mail-surcrg, 74(1) c_vline,75(05) i_output_mail-kperc,
                80(1) c_vline, 81(15) i_output_mail-betrg,  96(1) c_vline,97(19) i_output_mail-summe,
               116(1) c_vline,117(03) i_output_mail-curcy, 120(1) c_vline.
        AT END OF rcvprn.
          SUM.
          ULINE /8(113).
          WRITE:  /8(1) c_vline.
          FORMAT COLOR 3.
          WRITE: 10(09) text-064, 20(01) c_vline,             21(10)  space,
                  31(1) c_vline, 32(10) space,                42(01)  c_vline, 43(15) i_output_mail-total,
                  58(1) c_vline, 59(15) i_output_mail-surcrg, 74(1)   c_vline, 75(05) space,
                  80(1) c_vline, 81(15) i_output_mail-betrg,  96(1)   c_vline, 97(19) i_output_mail-summe,
                 116(1) c_vline,117(03) space,                120(01) c_vline.
          FORMAT COLOR OFF.
          ULINE /8(113).
          NEW-PAGE.
        ENDAT.
        AT END OF rcvprn.
          i_pr_param-linsz = 1000.
          NEW-PAGE PRINT ON PARAMETERS i_pr_param NO DIALOG.
          NEW-PAGE PRINT OFF.
        If spool number is obtained, generate PDF
          IF sy-spono IS NOT INITIAL.
            PERFORM f_generate_pdf.
    *Send the PDF as mail attachement
            PERFORM f_send_email.
          ENDIF.
        ENDAT.
      ENDLOOP.
    ENDFORM.                   " SEND_MAIL
    Please check the code and suggest some changes.
    Thanks,
    Sukumar.

    Hi,
    The data is getting printed incorrectly, I have coded as you have instructed. But the report output (not emailing) is getting printed ok. The code for that is as below.
    FORM f_list_display .
      LOOP AT i_output.
        g_flag = c_x.
        CLEAR: g_flag_mail.
        WRITE: /08(1) c_vline, 10(09) i_output-stapa1, 20(1) c_vline,21(10) i_output-datum,
                31(1) c_vline, 32(10) i_output-belnr,  42(1) c_vline,43(15) i_output-total,
                58(1) c_vline, 59(15) i_output-surcrg, 74(1) c_vline,75(05) i_output-kperc,
                80(1) c_vline, 81(15) i_output-betrg,  96(1) c_vline,97(19) i_output-summe,
               116(1) c_vline,117(03) i_output-curcy, 120(1) c_vline,121(10) i_output-rcvprn.
        AT END OF rcvprn.
          SUM.
          ULINE /8(113).
          WRITE:  /8(1) c_vline.
          FORMAT COLOR 3.
          WRITE: 10(09) text-064, 20(01) c_vline,        21(10)  space,
                  31(1) c_vline, 32(10) space,           42(01)  c_vline, 43(15) i_output-total,
                  58(1) c_vline, 59(15) i_output-surcrg, 74(1)   c_vline, 75(05) space,
                  80(1) c_vline, 81(15) i_output-betrg,  96(1)   c_vline, 97(19) i_output-summe,
                 116(1) c_vline,117(03) space,           120(01) c_vline.
          FORMAT COLOR OFF.
          ULINE /8(113).
          NEW-PAGE.
        ENDAT.
      ENDLOOP.
    ENDFORM.                    " F_LIST_DISPLAY
    The code which you gave should work as the above code. The above code is for report output and our code is for sending mails to the customers separately, thus we are creating separate spools customer-wise.
    Our code for emailing to customers seperately is below.
    FORM f_prepare_mail .
    LOOP AT i_output_mail.
    At new rcvprn.
    NEW-PAGE PRINT ON PARAMETERS i_pr_param NO DIALOG.
    endat.
    l_flag_mail = 'X'.
    CLEAR: l_flag.
    WRITE: /08(1) c_vline, 10(09) i_output_mail-stapa1, 20(1) c_vline,21(10) i_output_mail-datum,
    31(1) c_vline, 32(10) i_output_mail-belnr, 42(1) c_vline,43(15) i_output_mail-total,
    58(1) c_vline, 59(15) i_output_mail-surcrg, 74(1) c_vline,75(05) i_output_mail-kperc,
    80(1) c_vline, 81(15) i_output_mail-betrg, 96(1) c_vline,97(19) i_output_mail-summe,
    116(1) c_vline,117(03) i_output_mail-curcy, 120(1) c_vline.
    AT END OF rcvprn.
    SUM.
    ULINE /8(113).
    WRITE: /8(1) c_vline.
    FORMAT COLOR 3.
    WRITE: 10(09) text-064, 20(01) c_vline, 21(10) space,
    31(1) c_vline, 32(10) space, 42(01) c_vline, 43(15) i_output_mail-total,
    58(1) c_vline, 59(15) i_output_mail-surcrg, 74(1) c_vline, 75(05) space,
    80(1) c_vline, 81(15) i_output_mail-betrg, 96(1) c_vline, 97(19) i_output_mail-summe,
    116(1) c_vline,117(03) space, 120(01) c_vline.
    FORMAT COLOR OFF.
    ULINE /8(113).
    NEW-PAGE.
    ENDAT.
    AT END OF rcvprn.
    i_pr_param-linsz = 1000.
    NEW-PAGE PRINT OFF.
    If spool number is obtained, generate PDF
    IF sy-spono IS NOT INITIAL.
    PERFORM f_generate_pdf.
    *Send the PDF as mail attachement
    PERFORM f_send_email.
    ENDIF.
    ENDAT.
    ENDLOOP.
    ENDFORM. " SEND_MAIL
    Let me know, what could be the error in our code which generates separate spools for customers.
    Thanks in advance for the help.
    Sukumar.

  • Table view in Hierarchical list

    Hello All,
           I want to display the output details of my
    application in a tableview.
    1, But,the output list must be Hierarchical.I need to
       show the  header table and item table details
       <b>alternatively and grouped</b> .
    2, Is it possible to have an Hierarchical list in the
       Tableview in BSP HTMLB ?
    3, If it is then please let me know how can it be
       acheived ?
    4, <b>I'm not using MVC Model</b>.
    Regards,
    Deepu.K

    Hi Dhananjay,
              Thanks dude...This is a really good idea .
    But in my case i have to display the item details in the first view only .
    End-user requirement is as such.
    Is it possible ?
    Anyways i'll try ur solution and try to convince the Client.But plz let me know if the other way is possible or not ?
    I'm not assigning full points as I needed the Hierarchical list in the initial view itself.
    Plz don't mind.
    Regards,
    Deepu.K

  • Gui status (AT USER-COMMAND) trigger at first

    Hello all,
    I wrote a basic list  shown below.
    In it , AT USER-COMMAND and AT LINE-SELECTION events are used all.
    when i double click on line in the list, I think the at line-selection should be trigger at first. but  in fact ,the AT USER-COMMAND trigger.
    and the sy-ucomm get the first button value in the GUI-STATUS BAR(There's only one button on it).
    how can i solve it .
    any answers should be appreciated.
    START-OF-SELECTION.
      SET PF-STATUS 'ZSATMM24F1'.
      write :  \ 'aaaaaaaaaaaa'
      write :  \ 'aaaaaaaaaaaa'
      write :  \ 'aaaaaaaaaaaa'
      write :  \ 'aaaaaaaaaaaa'
    AT USER-COMMAND.
      CASE sy-ucomm.
        WHEN 'TO_a'.
          PERFORM to_a.
      ENDCASE.
    AT LINE-SELECTION.
      write : 'test'.
    best regards,
    daniel.

    Please make sure to add the fcode PICK to the F2 function code in your gui status and try again.
    Regards,
    Rich Heilman

  • User-command in 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'

    Hai all,
             I am trying to include a checkbox coloum in 'REUSE_ALV_HIERSEQ_LIST_DISPLAY' in edit mode and process the rows which are selected.
        i am successful in editing the check box ,but user-command is not working and also the List is not displayed (remains only on the selection screen) if i am uncommenting the exporting parameter
      I_CALLBACK_USER_COMMAND           = 'F_USER_COMMAND' .
    The value of sy-subrc for the FM is 1 . If the above exporting parameter is commented then sy-subrc = 0 .
    Please let me know to proceed.I need to process only the rows which are selected / checked
    CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
        EXPORTING
       I_INTERFACE_CHECK              = ' '
         i_callback_program             = report_name
       I_CALLBACK_PF_STATUS_SET       = ' '
    <b>**{ Begin of Changes
    I_CALLBACK_USER_COMMAND           = ' '
      I_CALLBACK_USER_COMMAND           = 'F_USER_COMMAND'
    **}  End of  Changes</b>
         is_layout                      = alvlo_stb
         it_fieldcat                    = stb_fields_tb[]
       IT_EXCLUDING                   =
       IT_SPECIAL_GROUPS              =
       IT_SORT                        =
         it_filter                      = g_t_slis_filt[]
       IS_SEL_HIDE                    =
       I_SCREEN_START_COLUMN          = 0
       I_SCREEN_START_LINE            = 0
       I_SCREEN_END_COLUMN            = 0
       I_SCREEN_END_LINE              = 0
         i_default                      = g_f_dflt
         i_save                         = 'A' "alvvr_sav_all
         is_variant                     =  alvvr
         it_events                      = alv_evnt_tb_cmpl
       IT_EVENT_EXIT                  =
         i_tabname_header               = 'ALV_STB'
         i_tabname_item                 = 'G_T_PLPO'
       I_STRUCTURE_NAME_HEADER        =
       I_STRUCTURE_NAME_ITEM          =
         is_keyinfo                     = g_f_keyinfo
       IS_PRINT                       =
       IS_REPREP_ID                   =
       I_BUFFER_ACTIVE                =
       I_BYPASSING_BUFFER             =
    IMPORTING
       E_EXIT_CAUSED_BY_CALLER        =  exit_by_caller
       ES_EXIT_CAUSED_BY_USER         =  exit_by_user
       TABLES
          t_outtab_header               = alv_stb
          t_outtab_item                 = g_t_plpo
       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.
    MOD0001}
    ENDFORM.                                                 
    FORM F_USER_COMMAND USING r_ucomm LIKE sy-ucomm
    rs_selfield TYPE slis_selfield.
    some operation
    ENDFORM.

    Hai,
      I have declared
    DATA:    report_name      LIKE  sy-repid,
    and also
    DATA: F_USER_COMMAND TYPE SY-UCOMM.
    in the program.But still i am getting the same problem.
    sy-subrc = 1. unable to execute 'REUSE_ALV_HIERSEQ_LIST_DISPLAY' sucessfully

  • Pf status and user-command

    hi
    can any one explain me about pf-status and user-command?  what is the difference between this two and how to display icons in it.
    max reward points for good answer
    thanks
    alka

    Hi alka ritu  ,
    Check the following websites for good documentation o n pf status and user-command
    http://help.sap.com/saphelp_nw04/helpdata/en/9f/dba34635c111d1829f0000e829fbfe/content.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/9f/dba99935c111d1829f0000e829fbfe/content.htm
    1. How to set pf-status
    set pf-status ‘ZZBILSTA’.
    2. How to set pf-status excluding/including single menu items
    You can exclude menus by using exclude :
    set pf-status ‘ZZBILSTA’ excluding ‘PST’.
    Note: Can also be used with include instead of exclude
    3. How to set pf-status excluding/including several menu items
    You have to use an internal table to store the status you wan’t to ex- or include:
    DATA:BEGIN OF I_PF_STATUS_TAB OCCURS 10,
    FCODE,
    END OF I_PF_STATUS_TAB.
    FORM SET_PF_STATUS_POSTER.
    REFRESH I_PF_STATUS_TAB. MOVE ‘PST’ TO I_PF_STATUS_TAB. APPEND I_PF_STATUS_TAB. MOVE ‘ART’ TO I_PF_STATUS_TAB. APPEND I_PF_STATUS_TAB. SET PF-STATUS ‘ZZBILSTA’ EXCLUDING I_PF_STATUS_TAB.
    ENDFORM.
    4. Setting PF status to the (SAP) system default
    set pf-status ‘BASIC’.
    5. How to check for pf-status
    AT USER-COMMAND.
    CASE SY-UCOMM. WHEN ‘ART’. PERFORM STYR_ARTSKONTI. WHEN ‘PST’. PERFORM STYR_POSTER. WHEN ‘BIL’. PERFORM VIS_BILAG. ENDCASE.
    6. Use of SY-PFKEY
    You can use the system variable sy-pfkey to retrieve the name of the current pf status
    USER-COMMAND:
    If the user chooses a function code during list processing that is neither processed by the system, or PICK or PFnn, the system triggers the event AT USER-COMMAND. For this event, you must define your own GUI status for a list. To react to your own function codes in a program, you must define the following event block:
    AT USER-COMMAND.
      statements.
    In this event block, you can use an IF or CASE structure to differentiate between the function codes. They are available in the system field sy-ucomm. There are further system fields that are filled in list events, such as sy-lsind and sy-pfkey, that allow you to make further case distinctions.
    Triggering a List Event from the Program
    You can trigger a list event from the program as follows:
    SET USER-COMMAND fc.
    This statement takes effect after the current list is completed. Before the list is displayed, the event assigned to function code fc is triggered, regardless of the dialog status you are using.
    The effect is the same as when the user chooses the function. In other words, predefined list function codes are trapped and processed by the runtime environment, the function codes PICK and PFnn trigger the AT LINE-SELECTION and AT PFnnevents, and user-defined function codes trigger the AT USER-COMMAND event block.
    Function code PICK triggers an event only if the cursor is located on a list line.
    Using this statement in conjunction with the function codes reserved for system functions, you can call the system functions from the program. For example, you can use SET USER-COMMAND '%SC' to call the Find dialog box directly, or to position the list correctly before it is displayed.
    If you use several SET USER-COMMAND statements while creating a list, the system executes only the last one.
    Example of AT USER-COMMAND.
    REPORT demo_list_at_user_command NO STANDARD PAGE HEADING.
    START-OF-SELECTION.
      WRITE: 'Basic List',
           / 'sy-lsind:', sy-lsind.
    TOP-OF-PAGE.
      WRITE 'Top-of-Page'.
      ULINE.
    TOP-OF-PAGE DURING LINE-SELECTION.
      CASE sy-pfkey.
        WHEN 'TEST'.
          WRITE 'Self-defined GUI for Function Codes'.
          ULINE.
      ENDCASE.
    AT LINE-SELECTION.
      SET PF-STATUS 'TEST' EXCLUDING 'PICK'.
      PERFORM out.
      sy-lsind = sy-lsind - 1.
    AT USER-COMMAND.
      CASE sy-ucomm.
        WHEN 'FC1'.
          PERFORM out.
          WRITE / 'Button FUN 1 was pressed'.
        WHEN 'FC2'.
          PERFORM out.
          WRITE / 'Button FUN 2 was pressed'.
        WHEN 'FC3'.
          PERFORM out.
          WRITE / 'Button FUN 3 was pressed'.
        WHEN 'FC4'.
          PERFORM out.
          WRITE / 'Button FUN 4 was pressed'.
        WHEN 'FC5'.
          PERFORM out.
          WRITE / 'Button FUN 5 was pressed'.
      ENDCASE.
      sy-lsind = sy-lsind - 1.
    FORM out.
      WRITE: 'Secondary List',
           / 'sy-lsind:', sy-lsind,
           / 'sy-pfkey:', sy-pfkey.
    ENDFORM.
    Example of AT USER-COMMAND.
    REPORT demo_list_set_user_command NO STANDARD PAGE HEADING.
    START-OF-SELECTION.
      SET USER-COMMAND 'MYCO'.
      WRITE 'Basic List'.
    AT USER-COMMAND.
      CASE sy-ucomm.
        WHEN 'MYCO'.
          WRITE 'Secondary List from USER-COMMAND,'.
          WRITE: 'sy-lsind', sy-lsind.
          SET USER-COMMAND 'PF05'.
      ENDCASE.
    AT pf05.
      WRITE 'Secondary List from PF05,'.
      WRITE: 'sy-lsind', sy-lsind.
      SET CURSOR LINE 1.
      SET USER-COMMAND 'PICK'.
    AT LINE-SELECTION.
      WRITE 'Secondary List from LINE-SELECTION,'.
      WRITE: 'sy-lsind', sy-lsind.
      SET USER-COMMAND '%SC'.
    http://maxdb.sap.com/currentdoc/94/90ee41c334c717e10000000a155106/content.htm
    cheers!
    gyanaraj
    ****Pls reward points if u find this helpful

Maybe you are looking for