Background Execution Problem-Docking Container with 2 ALV Grids in one scre

Hi Friends,
I have created 2 ALV Grids in one screen - one below another using DOCKING CONTAINER.
The objects are 'g_dock_cont' and 'g_dock_cont1'.
I am getting the foreground output as expected with 2 ALV Grids.
While executing in background (F9), I am getting only output of first ALV grid. Second ALV is not getting displayed in BACKGROUND(F9) mode.
How to solve this.
FORM create_objects.
* Materials with data
  IF   g_dock_cont IS INITIAL.
   IF sy-batch NE 'X'.
*CREATE THE OBJECT FOR DOCKING CONTAINER
    CREATE OBJECT g_dock_cont
      EXPORTING
        side                  = cl_gui_docking_container=>dock_at_top
        extension             = 300.
    ENDIF.
*CREATE THE OBJECT FOR ALV GRID
    CREATE OBJECT g_alvgrid
           EXPORTING i_parent = g_dock_cont.
    wa_layout-grid_title =
          'Materials with Data'.
  ENDIF.
IF NOT I_DETAIL[] IS INITIAL.
CALL METHOD g_alvgrid->set_table_for_first_display
  EXPORTING
    IS_VARIANT                    = WA_VARIANT_STX
    IS_LAYOUT                     = wa_layout
  CHANGING
    it_outtab                     = I_DETAIL
    IT_FIELDCATALOG               = LIT_FIELDCATALOG[]
  EXCEPTIONS
    INVALID_PARAMETER_COMBINATION = 1
    PROGRAM_ERROR                 = 2
    TOO_MANY_LINES                = 3
    others                        = 4
IF sy-subrc <> 0.
ENDIF.
ENDIF.
*MATERIALS WITHOUT DATA
  IF   g_dock_cont1 IS INITIAL.
   IF sy-batch NE 'X'.
*CREATE THE OBJECT FOR DOCKING CONTAINER
    CREATE OBJECT g_dock_cont1
      EXPORTING
        side                  = cl_gui_docking_container=>dock_at_bottom
        extension             = 300.
   ENDIF.
*CREATE THE OBJECT FOR ALV GRID
    CREATE OBJECT g_alvgrid1
           EXPORTING i_parent = g_dock_cont1.
    wa_layout1-grid_title =
          'Materials without Data'.
  ENDIF.
IF NOT I_MARA[] IS INITIAL.
CALL METHOD g_alvgrid1->set_table_for_first_display
  EXPORTING
    IS_LAYOUT                     = wa_layout1
  CHANGING
    it_outtab                     = I_MARA
    IT_FIELDCATALOG               = i_fieldcat[]
  EXCEPTIONS
    INVALID_PARAMETER_COMBINATION = 1
    PROGRAM_ERROR                 = 2
    TOO_MANY_LINES                = 3
    others                        = 4
IF sy-subrc <> 0.
ENDIF.
ENDIF.
ENDFORM.                    " create_objects
Regards,
Viji.

Hi,
What i was saying is that you need to code again for background mode of execution.
AT END OF SELECTION.
IF SY-BATCH EQ 'X'.
  PERFORM DISPLAY1.
  PERFORM DISPLAY2.
In DISPLAY1 use REUSE_ALV_LIST_DISPLAY to display data from outtab1.
In DISPLAY2 use REUSE_ALV_LIST_DISPLAY to display data from outtab2.
For example : execute this report in background mode.this will not execute in online mode.
After execution you will get two spools one for KNA1 and one for LFA1 data. Spool can be controlled via IS_PRINT structure.
report  zrbackground.
data gt_lfa1 type standard table of lfa1.
data gt_kna1 type standard table of kna1.
start-of-selection.
  select * from lfa1 into table gt_lfa1 up to 10 rows.
  select * from kna1 into table gt_kna1 up to 20 rows.
end-of-selection.
  if sy-batch eq 'X'.
    perform display_lfa1.
    perform display_kna1.
  endif.
*&      Form  DISPLAY_LFA1
      text
-->  p1        text
<--  p2        text
form display_lfa1 .
  call function 'REUSE_ALV_LIST_DISPLAY'
    exporting
      i_callback_program = sy-repid
      i_structure_name   = 'LFA1'
    tables
      t_outtab           = gt_lfa1
    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_LFA1
*&      Form  DISPLAY_KNA1
      text
-->  p1        text
<--  p2        text
form display_kna1 .
  call function 'REUSE_ALV_LIST_DISPLAY'
    exporting
      i_callback_program = sy-repid
      i_structure_name   = 'KNA1'
    tables
      t_outtab           = gt_kna1
    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_KNA1
Please let me know if its not clear or you need more info.
Thanks,
Abhishek
Edited by: abhishek sinha on May 8, 2009 7:42 PM
Edited by: abhishek sinha on May 8, 2009 8:45 PM

Similar Messages

  • Splitter container with alv grid has to be replaced with a dynpro

    I have a container which I have splitt in 4 areas, on the right half I have two splitter container with alv grids.
    On the left side I have my navigation tree in 2 splitter container.
    I don't know if this really works, but is it possible that I call a dynpro in the splitter container (after using my navigation tree) where still my alv grids exist?

    so it is not able that I can show a dynpro with several text fields?
    or can I introduce the textfields in another version to the container?
    In se80 I think you have the same, there they call another transactions, is it possible that I call a transaction to the right side of a splitter container?

  • Splitter container with alv grid

    I have following coding:
        CREATE OBJECT container
                      EXPORTING container_name = 'CONTAINER2'.
        CREATE OBJECT splitter
                      EXPORTING parent = container
                                rows    = 2
                                columns = 1.
        CALL METHOD splitter->get_container
                          EXPORTING row      = 1
                                    column   = 1
                          RECEIVING container = container_1.
        CALL METHOD splitter->get_container
                      EXPORTING row      = 2
                                column   = 2
                      RECEIVING container = container_2.
    now i want to include my alv_grid in container_2.
    the coding for my alv grid is as follows:
      CALL METHOD grid2->set_table_for_first_display
        EXPORTING
          i_structure_name              = 'structure'
          is_layout                     = gs_layout
        CHANGING
          it_outtab                     = lt_alv
          it_fieldcatalog               = lt_fct1
        EXCEPTIONS
          invalid_parameter_combination = 1
          program_error                 = 2
          too_many_lines                = 3
          OTHERS                        = 4.
    is that possible????????????????

    I have solved it you have to do this:
    DATA splitter TYPE REF TO cl_gui_splitter_container.
    DATA container TYPE REF TO cl_gui_custom_container.
    DATA container_1 TYPE REF TO cl_gui_container.
    DATA container_2 TYPE REF TO cl_gui_container.
        CREATE OBJECT container
                      EXPORTING container_name = 'CONTAINER2'.
        CREATE OBJECT splitter
                      EXPORTING parent = container
                                rows    = 2
                                columns = 1.
        CALL METHOD splitter->get_container
                          EXPORTING row      = 1
                                    column   = 1
                          RECEIVING container = container_1.
        CALL METHOD splitter->get_container
                      EXPORTING row      = 2
                                column   = 2
                      RECEIVING container = container_2.
    and then:
        CREATE OBJECT grid2
          EXPORTING
            i_parent = container_1.
      CALL METHOD grid2->set_table_for_first_display
        EXPORTING
          i_structure_name              = 'structure'
          is_layout                     = gs_layout
        CHANGING
          it_outtab                     = lt_alv
          it_fieldcatalog               = lt_fct1
        EXCEPTIONS
          invalid_parameter_combination = 1
          program_error                 = 2
          too_many_lines                = 3
          OTHERS                        = 4.

  • I have a problem with ALV Grid User Command?

    Hi Experts,
    I have a problem with ALV GRID User Command.
    I am calling TCODE IW33 (Order Display) from the ALV output at first time by selecting an order. But, User command is calling IW33 Initial screen with blank value of order. Even I checked in debugging the value what I selected is passing properly, but once that screen (IW33 Initial) displays, value doesn't appear. Then, Manually, I  created another session and gone to TCODE IW33 and displayed an order. After that I came out from that order. Then again run my ALV program and selected another order, now order is displaying, but not what I selected current order instead of displaying previous order what I just displayed manually. If I selected any other order, system will display the same order what I dislayed manually.
    Here is my code.
    FORM user_command_alv  USING u_ucomm TYPE sy-ucomm
                           us_self_field TYPE slis_selfield.
    CASE u_ucomm.
    WHEN '&IC1'.
    READ TABLE it_final INDEX us_self_field-tabindex INTO wa_final.
            WHEN 'ORDER'.
              IF NOT wa_final-order IS INITIAL.
                SET PARAMETER ID 'COK' FIELD wa_final-order.
                CALL TRANSACTION 'IW33' AND SKIP FIRST SCREEN.
              ENDIF.
    endform.
    PARAMETER ID 'COK'  also the standard one.
    Could you please help me out, Where I did wrong?
    If I select any order, that order only should display.
    Thanks in advance.
    Regards,
    Sarayu.
    Code Formatted by: Alvaro Tejada Galindo on Jan 8, 2009 2:33 PM

    hi,
    Please check it once the Paramater ID is 'ANR' for IW33 order number.
    Hope this may help.
    Regards,
    Sravanthi

  • Problem with ALV grid in edit mode

    Hello, gurus!
    I have a problem with ALV-grid. Sometimes when I call F4 help for a cell, data is inserted in a different cell.  And when I call check_changed_data method, my internal table (passed to ALV-control in set_table_for_first_display) does not updates properly. In what can be a problem?
    Thanks,
    Mikhail

    Hi Prabhu,
    MODULE pbo_100 OUTPUT.
      SET PF-STATUS 'MAIN100'.
      title_of_report = text-010.
      SET TITLEBAR '0100' WITH title_of_report.
      DATA: g_event_receiver TYPE REF TO lcl_event_handler.
      IF z_custom_container IS INITIAL .
        CREATE OBJECT z_custom_container
          EXPORTING
            container_name = 'ALV_ZAC'.
        CREATE OBJECT alv_grid
          EXPORTING
            i_parent = z_custom_container.
        g_repid = sy-repid.
        gs_variant-report = g_repid.
        x_save = 'A'.
        PERFORM check_alv_grid_fields.
        ps_layout-cwidth_opt = 'X'.
        ps_layout-edit = 'X'.
        CALL METHOD alv_grid->set_ready_for_input
          EXPORTING
            i_ready_for_input = '1'.
    *    CALL METHOD alv_grid->register_edit_event
    *      EXPORTING
    *        i_event_id = cl_gui_alv_grid=>mc_evt_enter.
        APPEND   s_list_rec   to it_list_rec.
        CALL METHOD alv_grid->set_table_for_first_display
          EXPORTING
            is_layout       = ps_layout
            is_variant      = gs_variant
            i_save          = x_save
          CHANGING
            it_fieldcatalog = pt_fieldcat
            it_outtab       = it_list_rec[].
        CALL METHOD alv_grid->register_edit_event
          EXPORTING
            i_event_id = cl_gui_alv_grid=>mc_evt_enter.
        CALL METHOD alv_grid->register_edit_event
          EXPORTING
            i_event_id = cl_gui_alv_grid=>mc_evt_modified.
    ENDIF.
    FORM check_alv_grid_fields .
      DATA: ls_fcat LIKE LINE OF pt_fieldcat.
    REFRESH pt_fieldcat .
    CLEAR: ps_layout, ls_fcat.
      ls_fcat-fieldname = 'VBELN'.
      ls_fcat-ref_field = 'VBELN'. ls_fcat-ref_table =  'LIPS'. " .
      ls_fcat-outputlen = 9.
    *  ls_fcat-datatype   = 'CHAR'.
    *  ls_fcat-inttype    = 'C'.
      APPEND  ls_fcat TO pt_fieldcat.
      CLEAR: ls_fcat.
      ls_fcat-fieldname = 'ERDAT'.
      ls_fcat-ref_field = 'ERDAT'. ls_fcat-ref_table = 'LIPS'.
      ls_fcat-outputlen = 9.
    *  ls_fcat-f4availabl = 'X' .
    *  ls_fcat-datatype   = 'DATS'.
    *  ls_fcat-inttype    = 'D'.
      APPEND ls_fcat TO pt_fieldcat.
      CLEAR: ls_fcat.
    ENDFORM.                    " check_alv_grid_fields
    FORM save_p .
      CLEAR l_valid.
      CALL METHOD alv_grid->check_changed_data
        IMPORTING
          e_valid = l_valid.
      IF l_valid IS INITIAL.
        CALL FUNCTION 'POPUP_TO_INFORM'
          EXPORTING
            titel = text-i01
            txt1  = text-i02
            txt2  = text-i03
            txt3  = text-i04.
      ELSE.
        i_dat_reg = zrumm_prr-cdprr.
        CLEAR is_temp_otc.
        freshit i_prrpus_fax.
        freshit i_list2_ot.
        LOOP AT it_list_rec INTO s_list_rec.
          MOVE-CORRESPONDING s_list_rec TO i_list2_ot.
          i_list2_ot-fgrup = 'RECE'.
          i_list2_ot-prrnu = i_num_prr.
          APPEND i_list2_ot.
          MOVE-CORRESPONDING s_list_rec TO i_prrpus_fax.
          APPEND i_prrpus_fax.
        ENDLOOP.
      ENDIF.
    Edited by: Mikhail Sarychev on Mar 16, 2011 6:41 AM
    Edited by: Mikhail Sarychev on Mar 16, 2011 6:49 AM
    Edited by: Mikhail Sarychev on Mar 16, 2011 6:49 AM

  • Problem creating an excel with ALV GRID

    Hi all,
    this is my problem:
    i have an ALV GRID in which I display several columns in a proper order, es : A B C D E F G
    when i create an excel from this display i obtain a different order of the columns!
    in particular the 3 columns which represent numeric values (es C D E) are the last 3 colums in the excel, instead in the alv grid this 3 comuns stay in the middle!
    so in the excel i obtain : A B F G C D E!!!!
    please can anyone help me to fix this problem?

    hi,
    if you do a debugging it will go into the function module alv_xxl_call.
    in this we can find  the code as below.
    catch system-exceptions import_mismatch_errors = 1.
        import l_xxl_toggle_date from database ltdx(XL) id
                                    'bcalv_xxl_toggle_date'.
      endcatch.
    here place a break point and check what value is it coming for this variable l_xxl_toggle_date.
    if it is coming as X. then this problem will arrive.
    here manually change the variable to space and check , the output will be coming perfectly.
    if value is coming as X.
    THEN WE CAN DO ONE THING.
    HERE we are having a report bcalv_toggle_date which MUST EXECUTED ONCE ONLY.
    WHEN IT IS EXECUTED IT DOES NOT DISPLAY ANYTHING.
    after executing once the variable will be changed from X TO SPACE.
    but we must run this report as other program excel sheet download order  might get disturbed.
    my might suggestion copy thwe standard gui  to custom one and right a code for that excel icon in your code as shown below.
    we need to copy the function module alv_xxl_call and comment the code
    catch system-exceptions import_mismatch_errors = 1.
        import l_xxl_toggle_date from database ltdx(XL) id
                                    'bcalv_xxl_toggle_date'.
      endcatch.
      if l_xxl_toggle_date is initial.
      and endif of the above if.
    WHEN 'XXL'.
          DATA : v_fieldcat TYPE STANDARD TABLE OF kkblo_fieldcat.
          DATA : wa_fieldcat TYPE kkblo_fieldcat.
          DATA : w_fieldcat LIKE LINE OF gt_fieldcat.
          DATA : g_sort TYPE slis_t_sortinfo_alv.
          DATA : g_filter TYPE slis_t_filter_alv.
          DATA : a_fieldcat TYPE slis_t_fieldcat_alv.
          CALL FUNCTION 'REUSE_ALV_GRID_LAYOUT_INFO_GET'
            IMPORTING
              es_layout   = gs_layout
              et_fieldcat = a_fieldcat[]
              et_sort     = g_sort
              et_filter   = g_filter
              es_variant  = gs_variant.
          DELETE a_fieldcat WHERE no_out = 'X'.
          LOOP AT a_fieldcat INTO w_fieldcat.
            MOVE-CORRESPONDING w_fieldcat TO wa_fieldcat.
            APPEND wa_fieldcat TO v_fieldcat.
          ENDLOOP.
          CALL FUNCTION 'ZALV_XXL_CALL'
            EXPORTING
              i_tabname                    = 'IT_FINAL'
            IS_LAYOUT                    =
              it_fieldcat                  = v_fieldcat[]
            I_CALLBACK_TOP_OF_PAGE       =
            I_TITLE                      =
            I_MODE                       =
            TABLES
              it_outtab                    = it_final
           EXCEPTIONS
             FATAL_ERROR                  = 1
             NO_DISPLAY_POSSIBLE          = 2
             OTHERS                       = 3.

  • Issue with ALV grid print preview/spool

    Hello everyone,
    I am working on a report and I am having some issues with ALV grid. Currently in our DEV and QA environments the user can run the report, view the ALV grid, and print the grid without any issues.
    However this isn't the case in the Prod environment. The user is able to run the report and view the grid without any issues. But when they click print preview or click print, the spool is incorrect. It shows the proper values from the grid, but the first field is reduced in length. Rather than showing a numeric field of length 10 it shows 99999999# or 99999999...
    The programs are identical through every environment, including user parameters, formats, and spool settings. I have been told printing grids may have some issues, does anyone have any advice or dealt with this issue before?
    I appreciate the help.
    Thanks,
    C

    I was waiting to hear from the functional team on the matter and no one has mentioned any more issues.  I am assuming the problem is solved.  I just noticed the thread was still un-answered and wanted to give an update. 
    Thank you for you help Vijay.
    Regards
    C

  • Display 2 rows per entry with ALV Grid

    Hi Experts,
    I need to display the results of a report with ALV Grid. The Problem is: I need to display the resultdata (some numbers etc..) in one row and then add a second row with the longtext.
    The ALV should look somthing like this:
    resultdata1 resultdata2 resultdata3
    longtext1
    resultdata1 resultdata2 resultdata3
    longtext1
    resultdata1 resultdata2 resultdata3
    longtext1
    Can anyone of you give me hint on how to do that?
    (The row_pos and col_pos ind the fieldcat do not do the trick )
    Thanx
    Felix

    hi ,
    You can do this
    resultdata1 resultdata2 resultdata3
    longtext1
    resultdata1 resultdata2 resultdata3
    longtext1
    resultdata1 resultdata2 resultdata3
    longtext1
    Create two internal table  .
    one for : resultdata1 resultdata2 resultdata3
    second for   longtext1
    see that both tables have matching primary key   .
    then can  match the data and  append in another third table   .
    regards
    Deepak.

  • Printing with ALV Grid

    Hi,
    I am using ALV List and ALV grid in one of my custom reports.
    There is no issue with ALV List when I print the report after running the program.
    But when I use ALV Grid , the report runs good and when I try to print the report I get short dump "OBJECTS_NOT_CHARLIKE" in program "LKKBLF99" of the main program "SAPLKKBL".
    I am using the function module "REUSE_ALV_GRID_DISPLAY" to run the report using ALV Grid and I get the above short dump when I try to print the report.
    Can anyone help me please?
    Thanks,
    Ashok.

    Hai Ashok
    Try with the following Code
    *& Report  ZALV_GRID                                           *
    REPORT  ZALV_GRID .
    TABLES: MARA.
    TYPE-POOLS : SLIS.
    Data declaration
    DATA: BEGIN OF I_MARA OCCURS 0.
            INCLUDE STRUCTURE MARA.
    DATA: END OF I_MARA.
    DATA: V_REPID LIKE SY-REPID.
    selection-screen
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.
      SELECT-OPTIONS : S_MATNR FOR MARA-MATNR.
      PARAMETERS: P_MTART LIKE MARA-MTART DEFAULT 'ROH'.
    SELECTION-SCREEN END OF BLOCK B1.
    initialisation
    INITIALIZATION.
    S_MATNR-LOW = '1400'.
    S_MATNR-HIGH = '1500'.
    APPEND S_MATNR.
    V_REPID = SY-REPID.
    start-of-selection
    START-OF-SELECTION.
    SELECT * FROM MARA
        INTO TABLE I_MARA
        WHERE MATNR IN S_MATNR AND
              MTART = P_MTART.
      CHECK SY-SUBRC = 0.
    end of selection
    END-OF-SELECTION.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_INTERFACE_CHECK              = ' '
      I_BYPASSING_BUFFER             =
      I_BUFFER_ACTIVE                = ' '
      I_CALLBACK_PROGRAM             = ' '
      I_CALLBACK_PF_STATUS_SET       = ' '
      I_CALLBACK_USER_COMMAND        = ' '
       I_STRUCTURE_NAME               = 'MARA'
      IS_LAYOUT                      =
      IT_FIELDCAT                    =
      IT_EXCLUDING                   =
      IT_SPECIAL_GROUPS              =
      IT_SORT                        =
      IT_FILTER                      =
      IS_SEL_HIDE                    =
      I_DEFAULT                      = 'X'
      I_SAVE                         = ' '
      IS_VARIANT                     =
      IT_EVENTS                      =
      IT_EVENT_EXIT                  =
      IS_PRINT                       =
      IS_REPREP_ID                   =
      I_SCREEN_START_COLUMN          = 0
      I_SCREEN_START_LINE            = 0
      I_SCREEN_END_COLUMN            = 0
      I_SCREEN_END_LINE              = 0
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER        =
      ES_EXIT_CAUSED_BY_USER         =
      TABLES
        T_OUTTAB                       = I_MARA
    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.
    Thanks & Regards
    Sreenivasulu P

  • Handling Double click on a Pop-up screen with ALV Grid

    Hello Experts,
    I have an issue handling double click on ALV Pop-up screen. I tried to achive this using following steps.
    1. I defined a local class in Top-include to handle double click and implemented it in the following way.
    CLASS lcl_alv_event_handler DEFINITION.
    PUBLIC SECTION.
    CLASS-METHODS:
    on_double_click FOR EVENT double_click
    OF cl_gui_alv_grid
    IMPORTING e_row
    e_column
    es_row_no.
    ENDCLASS. "lcl_alv_event_handler DEFINITION
    *~~~ Implementation code
    CLASS lcl_alv_event_handler IMPLEMENTATION.
    To handle Selection of Issue data on Screen 100
    METHOD on_double_click.
    DATA: lt_row_no TYPE lvc_t_roid,
    ls_req TYPE zcst_zirt_seltab.
    READ TABLE gt_req
    INTO ls_req
    INDEX e_row-index.
    g_req_id = ls_req-zzrequest_id.
    gv_selected = true.
    CALL METHOD go_alv->dispatch
    EXPORTING
    cargo = 'OK'
    eventid = 3
    is_shellevent = ' '
    is_systemdispatch = 'X'
    EXCEPTIONS
    cntl_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.
    ENDMETHOD. "on_double_click
    ENDCLASS. "lcl_alv_event_handler IMPLEMENTATION
    2. Registered the event in the PBO module of the screen
    ls_events-eventid = 3.
    ls_events-appl_event = gc_true.
    APPEND ls_events TO lt_events.
    CALL METHOD co_alv->set_registered_events
    EXPORTING
    events = lt_events
    EXCEPTIONS
    cntl_error = 1
    cntl_system_error = 2
    illegal_event_combination = 3
    OTHERS = 4.
    IF sy-subrc 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CREATE OBJECT co_alv_event_handler.
    SET HANDLER: co_alv_event_handler->on_double_click FOR co_alv.
    CALL METHOD co_alv->set_toolbar_interactive.
    3. In the PAI module of Screen, tried to handle the event 'OK' that waqs registred in PBO.
    CASE save_ok.
    WHEN 'OK'.
    Get selected line
    CALL METHOD io_alv->get_selected_rows
    IMPORTING
    et_index_rows = lt_rows
    et_row_no = lt_rows_no.
    IF NOT lt_rows IS INITIAL.
    READ TABLE lt_rows INTO ls_rows INDEX 1.
    IF sy-subrc EQ 0.
    gv_selected = 'X'.
    READ TABLE it_req
    INTO ls_req
    INDEX ls_rows-index.
    e_req_id = ls_req-zzrequest_id.
    SET SCREEN 0.
    ENDIF.
    ELSE.
    SET SCREEN 0.
    ENDIF.
    With this code what is happening is, when user double clicks a line on Pop-up screen with ALV grid data, the program is able to successfully get into the class implementation but the control is not going to PAI module to execute the OK_code handling part.
    Am I doing this in the right way? Appreciate quick suggestions. Proper posts will be thoroughly awarded with points.
    Thx.
    Minni

    Put your code into the Event handler Implementation of Double Click which is there in the PAI Module.
    Regards,
    Naimesh Patel

  • GL Account analysis report with ALV Grid control

    Hi Everyone,
    I am looking for a GL Account analysis report with ALV Grid Control.
    Can I get sample code for this report.
    Thank you
    Prasad

    Hi Rob,
    Actually, I am searching for a Report which gives GL account analysis.
    If anybody can throw more light on this ...it would be great.
    Which Tables and fields i should refer for this report.
    Thanks

  • Background task problem with alv grid display

    Hello !
    I have a problem when executing my program in background.
    In foreground I have no problem, my ALV appears. In the background I have a dump.
    The current ABAP program "SAPLKKBL" had to be terminated because one of the statements could not be executed.
    I use the function module 'REUSE_ALV_GRID_DISPLAY'
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
         EXPORTING
            i_callback_program      = gd_repid
            i_callback_user_command = 'F533_USER_COMMAND'
            is_layout               = gd_layout
            it_fieldcat             = fieldcatalog[]
            it_special_groups       = i_fgroup[]
            i_save                  = 'X'
            it_sort                 = gd_sort
            i_buffer_active         = ' '
            i_callback_pf_status_set = 'F534_SET_PF_STATUS'
         TABLES
            t_outtab                = mytab
         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.
    I don't understand where the problem is. Please help me.
    Thank you.

    I love replying to old threads:
    Try this link
    http://scn.sap.com/people/prashant.patil12/blog/2007/02/20/displaying-alv-grid-in-background-job

  • How to display more than 255 chars in background job with ALV Grid ????

    Hi All,
    I am using ALV grid with OO.
    I have used call screen for ALV grid display. I have to display more than 255 characters in width. While running it, I can see the list perfectly.
    But in background mode, the list is truncated after 255 chars.
    Can anybody help how to send complete list(width more than 255 chars) to spool.
    Thanks and Regards,
    Neha

    Hi SAP fan,
    <b>YES you can run the ALV report in background mode.
    To run the report in background do F9 instead of F8, then give immediate and save.
    Now goto Sm35 goto job overview and view the job listed
    Choose the job and press the spool button. It will show the list created on the next page. When u clcik the list u can see the ALV output.
    To see this the job should be in the finished status.
    How to define Periodic Jobs
    1.Execute transaction SM36
    2.Define Job name, Job class, Target server
    3.Click on 'START CONDITION' button
    4.Click on 'Date/Time' button
    5.Enter Scheduled start DATE & TIME. Check mark 'Periodic Job' field. Click on 'Period values' button and select 'Hourly' or 'Dialy' or 'Weekly' or 'Monthly' or Other period and SAVE. Go back to main screen.
    6.Click on 'STEPS' button and enter Program name and Variant under box 'ABAP Program'. Click on 'Print Specification' button and enter Printer name under 'Output device' and SAVE
    7.Click on SAVE button until you get message on bottom of the screen that describes 'Job XYZ saved with status: Scheduled'.
    8.Click on 'Job overview' button or execute SM37 transaction.
    9.Select the appropriate 'Job name', 'User name', 'Job Status' & Schedule date under 'Job start condition' and click on 'Execute' button or press F8.
    10.You will now see all your scheduled JOBS.
    <b>Case: 2</b>
    You can Run in Background but make sure it is alv list, not alv Grid FM. if you are uisng alv list not problem , but if you are using alv grid then you can code like this..
    if sy-batch = ' '.
    call 'REUSE_ALV_GRID_DISPLAY'.
    else.
    call 'REUSE_ALV_LIST_DISPLAY'.
    endif.
    if you are using OO alv then write this code..
    CALL METHOD cl_gui_alv_grid=>offline
                    RECEIVING e_offline = off.
        IF off IS INITIAL.
          CREATE OBJECT g_custom_container
                 EXPORTING container_name = g_container.
        ENDIF.
    <b>Case: 3</b>
    if you are using OO ALV.
    Just before creating the custom container check for the following condition.
    Batch or Web Reporting
    IF cl_gui_alv_grid=>offline( ) IS INITIAL.
    CREATE OBJECT o_custcontainer
    EXPORTING
    container_name = lc_custcontrol
    EXCEPTIONS
    cntl_error = 1
    cntl_system_error = 2
    create_error = 3
    lifetime_error = 4
    lifetime_dynpro_dynpro_link = 5
    OTHERS = 6
    ENDIF.
    You can see the output in Spool in transaction SP01.</b>
    Good Luck and thanks
    AK

  • Problems with ALV-GRID - OO

    Hi,
    I'm using OO for ALV-GRID. I have problems by using TOP_OF_PAGE.
    I try it like this:
    CLASS LCL_EVENT_HANDLER DEFINITION .
      PUBLIC SECTION .
        METHODS:
       HANDLE_TOP_OF_PAGE
             FOR EVENT TOP_OF_PAGE OF CL_GUI_ALV_GRID,
       HANDLE_PRINT_TOP_OF_PAGE
             FOR EVENT PRINT_TOP_OF_PAGE OF CL_GUI_ALV_GRID.
    ENDCLASS.                    "LCL_EVENT_HANDLER DEFINITION
    CLASS LCL_EVENT_HANDLER IMPLEMENTATION .
    *--Handle Print Top of page
      METHOD HANDLE_PRINT_TOP_OF_PAGE.
        IF SY-PAGNO = 1.
          PERFORM PRINT_TOP_OF_PAGE.
        ENDIF.
      ENDMETHOD.                    "handle_print_top_of_page
    *--Handle Top of page
      METHOD HANDLE_TOP_OF_PAGE.
        PERFORM TOP_OF_PAGE.
      ENDMETHOD.                    "handle_top_of_page
    ENDCLASS.                    "LCL_EVENT_HANDLER IMPLEMENTATION
      CALL METHOD GR_ALVGRID->SET_TABLE_FOR_FIRST_DISPLAY
         EXPORTING
                   IT_TOOLBAR_EXCLUDING = GT_EXCLUDE
                   IS_LAYOUT            = GS_LAYOUT
         CHANGING
                   IT_FIELDCATALOG      = GT_FIELDCAT
                   IT_OUTTAB            = ITAB.
      CREATE OBJECT GR_EVENT_HANDLER.
      SET HANDLER   GR_EVENT_HANDLER->HANDLE_PRINT_TOP_OF_PAGE  FOR GR_ALVGRID.
      SET HANDLER   GR_EVENT_HANDLER->HANDLE_TOP_OF_PAGE        FOR GR_ALVGRID.
    FORM PRINT_TOP_OF_PAGE.
      WRITE: / 'Print-Header'.
    ENDFORM.                    "print_top_of_page
    FORM TOP_OF_PAGE.
      WRITE: / 'Screnn-Header'.
    ENDFORM.                    "top_of_page
    Has anyone an idea what i shell do??
    Thanks
    regards, Dieter

    Hi Vijay,
    i have tried this code (same as you but with MARA).
    I created PF-Staus STATUS und screen 100 with container CONTROL
    but i don't get any result (IT_MARA has 20 entries).
    Which mistake have i done?
    REPORT  ZGRO_TEST1  MESSAGE-ID ZZ  .
    DATA: IT_MARA TYPE TABLE OF MARA.
    DATA: OK_CODE LIKE SY-UCOMM,
    SAVE_OK LIKE SY-UCOMM.
    DATA:  G_CONTAINER TYPE SCRFNAME VALUE 'CONTROL',
    O_DYNDOC_ID  TYPE REF TO CL_DD_DOCUMENT,
    O_SPLITTER   TYPE REF TO CL_GUI_SPLITTER_CONTAINER,
    O_PARENT_GRID TYPE REF TO CL_GUI_CONTAINER,
    O_PARENT_TOP TYPE REF TO CL_GUI_CONTAINER,
    O_HTML_CNTRL TYPE REF TO CL_GUI_HTML_VIEWER.
    CLASS LCL_EVENT_HANDLER DEFINITION .
    PUBLIC SECTION .
    METHODS:
    *Event Handler for Top of page
    TOP_OF_PAGE FOR EVENT TOP_OF_PAGE
           OF CL_GUI_ALV_GRID
           IMPORTING E_DYNDOC_ID.
    ENDCLASS.             "lcl_event_handler DEFINITION
    CLASS LCL_EVENT_HANDLER IMPLEMENTATION.
    METHOD TOP_OF_PAGE.
    Top-of-page event
    PERFORM EVENT_TOP_OF_PAGE USING O_DYNDOC_ID.
    ENDMETHOD.                            "top_of_page
    ENDCLASS.       "LCL_EVENT_HANDLER IMPLEMENTATION
    DATA: G_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
          G_HANDLER TYPE REF TO LCL_EVENT_HANDLER. "handler
    START-OF-SELECTION.
    SELECT *
    FROM MARA
    UP TO 20 ROWS
    INTO TABLE IT_MARA.
    END-OF-SELECTION.
    IF NOT IT_MARA[] IS INITIAL.
      CALL SCREEN 100.
    ELSE.
      MESSAGE I002 WITH 'NO DATA FOR THE SELECTION'(004).
    ENDIF.
    MODULE STATUS_0100 OUTPUT.
    SET PF-STATUS 'STATUS'.
    SET TITLEBAR 'TITLE'.
    IF G_CUSTOM_CONTAINER IS INITIAL.
    PERFORM CREATE_AND_INIT_ALV.
    ENDIF.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    MODULE USER_COMMAND_0100 INPUT.
    CASE SY-UCOMM.
    WHEN 'BACK'.
    LEAVE TO SCREEN 0.
    ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    FORM CREATE_AND_INIT_ALV .
    DATA: G_GRID TYPE REF TO CL_GUI_ALV_GRID.
    CREATE OBJECT G_CUSTOM_CONTAINER
    EXPORTING CONTAINER_NAME = G_CONTAINER.
    Create TOP-Document
    CREATE OBJECT O_DYNDOC_ID
    EXPORTING STYLE = 'ALV_GRID'.
    Create Splitter for custom_container
    CREATE OBJECT O_SPLITTER
    EXPORTING PARENT  = G_CUSTOM_CONTAINER
    ROWS    = 2
    COLUMNS = 1.
      CALL METHOD O_SPLITTER->GET_CONTAINER
        EXPORTING
        ROW = 1
        COLUMN = 1
        RECEIVING
        CONTAINER = O_PARENT_TOP.
      CALL METHOD O_SPLITTER->GET_CONTAINER
        EXPORTING
        ROW = 2
        COLUMN = 1
        RECEIVING
        CONTAINER = O_PARENT_GRID.
    Set height for g_parent_html
      CALL METHOD O_SPLITTER->SET_ROW_HEIGHT
        EXPORTING
        ID = 1
        HEIGHT = 5.
    CREATE OBJECT G_GRID
    EXPORTING I_PARENT = O_PARENT_GRID.
    CREATE OBJECT G_HANDLER.
    SET HANDLER G_HANDLER->TOP_OF_PAGE FOR G_GRID.
    *Calling the Method for ALV output
      CALL METHOD G_GRID->SET_TABLE_FOR_FIRST_DISPLAY
        EXPORTING
        I_STRUCTURE_NAME = 'MARA'
        CHANGING
        IT_OUTTAB = IT_MARA[].
      CALL METHOD O_DYNDOC_ID->INITIALIZE_DOCUMENT
        EXPORTING
        BACKGROUND_COLOR = CL_DD_AREA=>COL_TEXTAREA.
    Processing events
      CALL METHOD G_GRID->LIST_PROCESSING_EVENTS
        EXPORTING
        I_EVENT_NAME = 'TOP_OF_PAGE'
        I_DYNDOC_ID = O_DYNDOC_ID.
    ENDFORM.                     "CREATE_AND_INIT_ALV
    FORM EVENT_TOP_OF_PAGE USING   DG_DYNDOC_ID TYPE REF TO CL_DD_DOCUMENT.
    DATA : DL_TEXT(255) TYPE C.  "Text
      CALL METHOD DG_DYNDOC_ID->ADD_TEXT
        EXPORTING
        TEXT = 'Flight Details'
        SAP_STYLE = CL_DD_AREA=>HEADING
        SAP_FONTSIZE = CL_DD_AREA=>LARGE
        SAP_COLOR = CL_DD_AREA=>LIST_HEADING_INT.
      CALL METHOD DG_DYNDOC_ID->ADD_GAP
        EXPORTING
        WIDTH = 200.
      CALL METHOD O_DYNDOC_ID->ADD_PICTURE
        EXPORTING
        PICTURE_ID = 'ENJOYSAP_LOGO'.
    Add new-line
      CALL METHOD DG_DYNDOC_ID->NEW_LINE.
      CALL METHOD DG_DYNDOC_ID->NEW_LINE.
    CLEAR : DL_TEXT.
    program ID
    DL_TEXT = 'Program Name :'.
      CALL METHOD DG_DYNDOC_ID->ADD_GAP.
      CALL METHOD O_DYNDOC_ID->ADD_TEXT
        EXPORTING
        TEXT = DL_TEXT
        SAP_EMPHASIS = CL_DD_AREA=>HEADING
        SAP_COLOR = CL_DD_AREA=>LIST_HEADING_INT.
    CLEAR DL_TEXT.
    DL_TEXT = SY-REPID.
      CALL METHOD O_DYNDOC_ID->ADD_TEXT
        EXPORTING
        TEXT = DL_TEXT
        SAP_EMPHASIS = CL_DD_AREA=>HEADING
        SAP_COLOR = CL_DD_AREA=>LIST_NEGATIVE_INV.
    Add new-line
      CALL METHOD DG_DYNDOC_ID->NEW_LINE.
    CLEAR : DL_TEXT.
    CLEAR : DL_TEXT.
    program ID
    DL_TEXT = 'User Name :'.
      CALL METHOD DG_DYNDOC_ID->ADD_GAP.
      CALL METHOD O_DYNDOC_ID->ADD_TEXT
        EXPORTING
        TEXT = DL_TEXT
        SAP_EMPHASIS = CL_DD_AREA=>HEADING
        SAP_COLOR = CL_DD_AREA=>LIST_HEADING_INT.
    CLEAR DL_TEXT.
    DL_TEXT = SY-UNAME.
      CALL METHOD O_DYNDOC_ID->ADD_TEXT
        EXPORTING
        TEXT = DL_TEXT
        SAP_EMPHASIS = CL_DD_AREA=>HEADING
        SAP_COLOR = CL_DD_AREA=>LIST_NEGATIVE_INV.
    Add new-line
      CALL METHOD DG_DYNDOC_ID->NEW_LINE.
    CLEAR : DL_TEXT.
    Run Date
    DL_TEXT = 'Run Date :'.
      CALL METHOD DG_DYNDOC_ID->ADD_GAP.
      CALL METHOD O_DYNDOC_ID->ADD_TEXT
        EXPORTING
        TEXT = DL_TEXT
        SAP_EMPHASIS = CL_DD_AREA=>HEADING
        SAP_COLOR = CL_DD_AREA=>LIST_HEADING_INT.
    CLEAR DL_TEXT.
    Move date
    WRITE SY-DATUM TO DL_TEXT.
      CALL METHOD O_DYNDOC_ID->ADD_TEXT
        EXPORTING
        TEXT = DL_TEXT
        SAP_EMPHASIS = CL_DD_AREA=>HEADING
        SAP_COLOR = CL_DD_AREA=>LIST_NEGATIVE_INV.
    Add new-line
      CALL METHOD DG_DYNDOC_ID->NEW_LINE.
    CLEAR : DL_TEXT.
    *Time
    DL_TEXT = 'Time :'.
      CALL METHOD DG_DYNDOC_ID->ADD_GAP.
      CALL METHOD O_DYNDOC_ID->ADD_TEXT
        EXPORTING
        TEXT = DL_TEXT
        SAP_EMPHASIS = CL_DD_AREA=>HEADING
        SAP_COLOR = CL_DD_AREA=>LIST_HEADING_INT.
    CLEAR DL_TEXT.
    Move time
    WRITE SY-UZEIT TO DL_TEXT.
      CALL METHOD O_DYNDOC_ID->ADD_TEXT
        EXPORTING
        TEXT = DL_TEXT
        SAP_EMPHASIS = CL_DD_AREA=>HEADING
        SAP_COLOR = CL_DD_AREA=>LIST_NEGATIVE_INV.
    Add new-line
      CALL METHOD DG_DYNDOC_ID->NEW_LINE.
    PERFORM DISPLAY.
    ENDFORM.                    " EVENT_TOP_OF_PAGE
    FORM DISPLAY.
    Creating html control
      IF O_HTML_CNTRL IS INITIAL.
        CREATE OBJECT O_HTML_CNTRL
             EXPORTING
                  PARENT    = O_PARENT_TOP.
      ENDIF.
      CALL METHOD O_DYNDOC_ID->MERGE_DOCUMENT.
      O_DYNDOC_ID->HTML_CONTROL = O_HTML_CNTRL.
    Display document
      CALL METHOD O_DYNDOC_ID->DISPLAY_DOCUMENT
        EXPORTING
          REUSE_CONTROL      = 'X'
          PARENT             = O_PARENT_TOP
        EXCEPTIONS
          HTML_DISPLAY_ERROR = 1.
      IF SY-SUBRC NE 0.
      MESSAGE I999 WITH 'Error in displaying top-of-page'(036).
      ENDIF.
    ENDFORM.                    " display
    Regards, Dieter

  • Running report with alv grid in background and exporting to excel

    Hi Guys,
                  I've created a report program that uses the alv grid. When I run the report in foreground, I can easily export it to excel. However, if I run it in background, then display the spooled report and try to export to excel, it does not put it in excel format (seems to go over as one big column rather than individual columns that are defined in the report). Is there a way to run it in background ,export to excel properly and i have to email also in Excel sheet format.?
    Thanks,
    Gopi.

    In background u cannot do a download to excel. you can do is create CSV format file
    or
    write a report for output with tabs then call that report using
      submit yXXXX exporting list to memory
               and return.
      call function 'LIST_FROM_MEMORY'
        tables
          listobject = report_list
        exceptions
          not_found  = 1
          others     = 2.
    and send the report_list to email users

Maybe you are looking for

  • List Item event receiver not working: SharePoint 2010

    Hi, I have ceated one custom list and also created a Event reciever solution using Visual Studio 2010. In the event reciever I added ItemAdded, ItemUpdated events and did some my business related coding. It was worked very well when I add/edit the li

  • Safari Quit Unexpectedly While Using the Webcore Plug-In

    Below is the crash report for Safari. I am also unable to access safari even when I boot in safe mode. Process:     Safari [361] Path:        /Applications/Safari.app/Contents/MacOS/Safari Identifier:  com.apple.Safari Version:     7.0.1 (9537.73.11)

  • 17" Macbook Pro battery died (mid 2010 model)

    About a year old, the main battery died.  Cycle count is 207.  Since this is a non-user replaceable item I had to buy a new computer to aviod being without for a week.  (no local apple store) Buy a replacement computer. Return mine for repair after r

  • HttpServlet

    Slight problem with servlet code. JBuilder isnt recognising the HttpServlet class. javax seems to be imported correctly & the classpath setttings seem to be ok because JBuilder is recognising other classes & methods of the javax package. We're trying

  • Slow speeds even slower live chat

    Is there anyone actually answering live chat for sky?I signed up with Sky in January with great hope it would be faster then Tiscali. So im paying £10 more for what seems to be a worse service.The speeds i should be getting according to Sky is betwee