Background processing in ALV Oops

Hi all,
  I have requirement to execute a report in background processing.I have to create report using classes.
Iam using class cl_gui_alv_grid for creating report.When iam executing report in background am getting Fatal errror-GUI can not be reached.
Regards,
Srilatha.

Hi,
The issue is bcz. in background screen container is not recognized.
Change the code as follows:
SET PF-STATUS 'SCREEN_100'.
SET TITLEBAR 'xxx'.
<b>*if program is run in background
  CALL METHOD cl_gui_alv_grid=>offline
    RECEIVING
      e_offline = off.
  IF off IS INITIAL.
    IF container1 IS INITIAL.
      CREATE OBJECT container1
            EXPORTING
             container_name    = 'CC_ALV1' .
    ENDIF.
  ENDIF.
  CREATE OBJECT g_grid1
          EXPORTING
            i_parent          = container1.</b>
  PERFORM prepare_field_catalog.
  PERFORM exclude_button.
  PERFORM display_alv.
Best regards,
Prashant

Similar Messages

  • ABAP Custom Report (ALV Format) in Background Processing

    Hi
    I am not the hardcore ABAP Person. But want to know about the detail fact of the ABAP Custome Reports. The question is can we do the background processing for the ABAP Custome Report in ALV Format.
    If Yes ..do we require to have any additional Function/code to get the spool in ALV Format. I saw the comments that the output will look like the mess.
    Please share your comment or any useful documenation on this. We are in ECC 6.0
    Thanks in advance..and yes it will be rewared by points.
    Navin

    You can use alv's in background using docking containers, but the display wont be interactive. If you search the forum you will see tons of threads which talk about running ALV's in background.
    For the output to be interactive, you can run the report in foreground and do the data processing in background.
    Refer this link:
    Displaying ALV Grid in Background Job

  • Background processing of interactive alv lists

    Hi,
    I have an interactive alv list which works fine with online processing. When run in background it only create spool for the first list. What can be a solution other than merging all the secondary alv list to the primary list level. Can we create alv list (for background proesiing mode) for more than one internal table. (I think normally we can have only one internal table displayed in a list using reuse_alv). Please inform me if further details has to be published.
    Thanks and regards,
    Rajeeve Patric

    online after first display user can interact with the report and so the secondary report can be displayed....now in background mode if u run it spools out first report...Now, someone has to interact with this report so that second report can be shown...But user can't interact with the first report in background process.....so, it might be that if report is running in background then the 2 reports needs to be merged and shown in one report...

  • Data of alv report in  excel file in background processing using open datas

    Hi Experts,
    I have developed report for purchase register . if i execute this report in background process i am not able to get the downloaded file in excel and output is also not coming properly, columns are going to overlap.
    i used open dataset  read dataset and close dataset but still problem is not solved. so if anyone have code with this and also which will have concatenate statement in the code send it.
    Regards,
    Rahul

    Hi Rahul,
    Ur code shud be like below:
    DATA : l_filename2 TYPE string,
                v_extn.
        SPLIT p_filename AT '.xls' INTO l_filename2  v_extn.
        CONCATENATE l_filename2  'downloaded'  INTO l_filename2  SEPARATED BY '_'.
        CONCATENATE l_filename2  'txt'   INTO l_filename2 SEPARATED BY '.'.
        OPEN DATASET l_filename2 IN TEXT MODE FOR OUTPUT ENCODING DEFAULT.
        IF sy-subrc <> 0.
          MESSAGE e499(sy) WITH text-e02.
        ENDIF.
        LOOP AT it_order_number INTO wa_order_number.
          TRANSFER wa_order_number TO l_filename2.
        ENDLOOP.
        CLOSE DATASET l_filename2.
    Now, go to tcode AL11 and check it in the Application server itself.
    Hope this helps,
    Regards,
    Arnab.

  • How to do it in ALV OOPS

    Hi
    Im using ALV OOPS.o/p I have 10 records with checkbox(at user command I have to select record selected by check box). Now on the menu bar I hav a button for "SELECT ALL". If "selected all" 10 recored will be selected. If I filter upon some criteria no. of records will be 3..Now in GUI if I select SELECT all it will display 3 records r selected, but I have to process further internally ,,,but internally 10 records are selected. So how to write code for that is after filterring 3 records r selected and I "select all"..only 3 records will be selected instead of 10?
    Part of my code like this..
    SELECT all
      CALL METHOD G_GRID->CHECK_CHANGED_DATA
        IMPORTING
          E_VALID = L_VALID.
      IF L_VALID EQ 'X'.
        LOOP AT PT_OUTTAB INTO LS_OUTTAB.
      DATA LS_CELLTAB TYPE LVC_S_STYL.
      LOOP AT PS_OUTTAB-CELLTAB INTO LS_CELLTAB.
        IF LS_CELLTAB-FIELDNAME = 'CHECKBOX'.
          IF LS_CELLTAB-STYLE EQ CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.
            P_LOCKED = 'X'.
          ELSE.
            P_LOCKED = SPACE.
          ENDIF.
        ENDIF.
      ENDLOOP.
          IF L_LOCKED IS INITIAL
             AND NOT LS_OUTTAB-CHECKBOX EQ '-'.
            LS_OUTTAB-CHECKBOX = 'X'.
          ENDIF.
          MODIFY PT_OUTTAB FROM LS_OUTTAB.
        ENDLOOP.
        CALL METHOD G_GRID->REFRESH_TABLE_DISPLAY.
    ENDIF.

    Hello Kaushik
    Using method go_grid->GET_FILTERED_ENTRIES you get an index list of the filtered entries.
    DATA: lt_filtered     TYPE lvc_t_fidx,
              ld_indx        LIKE LINE OF lt_filtered.
      CALL METHOD go_grid->GET_FILTERED_ENTRIES
         IMPORTING
           ET_FILTERED_ENTRIES = lt_filtered.
      LOOP AT lt_filtered INTO ld_indx.
        READ TABLE gt_outtab INTO ls_outtab INDEX ld_indx.
      ENDLOOP.
    Regards
      Uwe

  • Page-break in alv background job for alv output variant not coming correctl

    Hi,
    I have created an ALV grid report. When i run the report in background i get the output with correct page-break on FIELD1. Now when i run the report in background with an "ALV output variant" (its the ALV variant that controls the fields display in the output; this is not the program variant), i do not get the page-break on FIELD1.  I have already build the sort criteria and using:
    gs_sort-group = '* '.     "New-Page
    Please let me know what could be reason for not getting the page-break in background when i am using the alv output variant and how do i correct this problem.
    Regards,
    Rakesh

    Hello Everyone,
    I have solved the problem. While running the program in background, we get the page-breaks when we use the below part of code in the sort catalogue with the condition that the program variant should not use any ALV layout variant.
    gs_sort-group = '* '.     "New-Page
    If you are using the ALV layout variant in the program variant then we can check the ROWPOS, COLPOS, and NO_OUT for that ALV layout variant and pass them along in the fieldcatalog table. You should be careful with not to pass the layout variant in the DISVARIANT. You can notice that i have cleared it and simply passing the program name into that.
    *C-- Process separately for jobs running in Background. Actually
    *C-- sortcat-group solves the problem only in Foreground. In background
    *C-- when ALV layout variant is not selected then it works otherwise it
    *C-- fails. So for background jobs we are reading the fieldcat and then
    *C-- passing the same in the display FM.
      IF sy-batch = 'X'.
        CALL FUNCTION 'REUSE_ALV_VARIANT_SELECT'
          EXPORTING
           i_dialog                  = ' '
           i_user_specific           = ' '
           i_default                 = ' '
    *   I_TABNAME_HEADER          =
    *   I_TABNAME_ITEM            =
            it_default_fieldcat       = gt_fieldcat
            i_layout                  = gs_layout
    *   I_BYPASSING_BUFFER        =
    *   I_BUFFER_ACTIVE           =
         IMPORTING
    *   E_EXIT                    =
           et_fieldcat               = lt_fieldcat
    *     et_sort                   = gt_sort[]
    *   ET_FILTER                 =
    *     es_layout                 = gs_layout
         CHANGING
           cs_variant                = gs_disvariant
         EXCEPTIONS
           wrong_input               = 1
           fc_not_complete           = 2
           not_found                 = 3
           program_error             = 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.
        CLEAR gs_fieldcat.
        LOOP AT gt_fieldcat INTO gs_fieldcat.
    *C-- Transfer all position changes to gt_fieldcat from lt_fieldcat
          CLEAR ls_fieldcat.
          READ TABLE lt_fieldcat
                INTO ls_fieldcat
                WITH KEY fieldname = gs_fieldcat-fieldname.
          IF sy-subrc = 0.
            gs_fieldcat-row_pos = ls_fieldcat-row_pos.
            gs_fieldcat-col_pos = ls_fieldcat-col_pos.
            gs_fieldcat-no_out = ls_fieldcat-no_out.
            MODIFY gt_fieldcat FROM gs_fieldcat INDEX sy-tabix.
            CLEAR gs_fieldcat.
          ENDIF.
        ENDLOOP.
    *C-- Clear the disvariant for the background job as it contains the ALV
    *C-- layout varinat
        CLEAR gs_disvariant.
        gs_disvariant-report = 'ZGPPMP0001'.
    Then pass gt_fieldcat to 'REUSE_ALV_GRID_DISPLAY'.
    The reason i'm doing it this way is that when we pass the layout variant name, the contents in gt_fieldcat were getting modified.
    One more thing i'd like to point out is that that, i tried to delete the fields with no_out = 'x'. Now when i ran the program in background with all the fields in sort catalog (suppose there are 2 fields field1 and field2) also in fieldcatalog it ran fine. In the next run in background i removed one of the fields in sort catalog from the fieldcatalog (delete the fields with no_out = 'x') and i got dump. Basically i had hidden field1 and so the code which was deleting fields with no_out = 'x' deleted this field from gt_fieldcat. So basically we should not delete fields with no_out = 'x'.
    I was getting ABAP runtime errors    MESSAGE_TYPE_X in the following part of the standard code.
    000310     LOOP AT CT_SORT INTO LS_SORT.
    000320
    000330       READ TABLE IT_FIELDCAT ASSIGNING <LS_FIELDCAT>
    000340            WITH KEY FIELDNAME = LS_SORT-FIELDNAME BINARY SEARCH.
    000350       IF SY-SUBRC NE 0.
         >         MESSAGE X000(0K).
    000370       ENDIF.
    000380
    000390       LS_SORT-SELTEXT = <LS_FIELDCAT>-SELTEXT.
    i have just mentioned this part because when i checked the forum many people were getting such errors "MESSAGE_TYPE_X". This could also be one of the reasons.

  • EVENTS IN ALV OOPS

    HI GUYS,
           CAN ANYONE PLS HELP ME OUT HANDLING EVENTS IN ALV(OOPS)....iS THERE ANY CLASS TO BE DEFINED ?????? PLS HELP IF ANYONE HAS THE CODE FOR THAT...........

    Hi,
    Declare as below.
    CLASS LCL_EVENT_RECEIVER DEFINITION DEFERRED.
    DATA : O_ALVGRID TYPE REF TO CL_GUI_ALV_GRID ,
           O_DOCKINGCONTAINER TYPE REF TO CL_GUI_DOCKING_CONTAINER ,
           O_EVENTRECEIVER TYPE REF TO LCL_EVENT_RECEIVER.
    Then class definition should be as follows:
    CLASS LCL_EVENT_RECEIVER DEFINITION.
    Event receiver definitions for ALV actions
      PUBLIC SECTION.
        CLASS-METHODS:
    Row Double click for dirll down.
           HANDLE_DOUBLE_CLICK
             FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
                IMPORTING E_ROW
                          E_COLUMN
                          ES_ROW_NO.
    ENDCLASS.
    Then implementation should be as follows:
    CLASS LCL_EVENT_RECEIVER IMPLEMENTATION.
    *&      Method handle_double_click
    This method is called when the user double clicks on a line to drill
    down.
    The following are exported from the ALV
    LVC_S_ROW
    LVC_S_COL
    LVC_S_ROID
      METHOD HANDLE_DOUBLE_CLICK.
    The double click drill down processing should be
    coded in the form below.
        PERFORM F9007_HANDLE_DOUBLE_CLICK USING E_ROW
                                                E_COLUMN
                                                ES_ROW_NO.
      ENDMETHOD.
    ENDCLASS.
    *&      Form  F9007_HANDLE_DOUBLE_CLICK
    This form is called when the user double clicks on a line to drill
    down.
         -->P_E_ROW_ID    - Row ID  text
         -->P_E_COLUMN_ID - Column ID
         -->P_ES_ROW_NO   - Row number
    FORM f9007_handle_double_click USING p_row
                                         p_column
                                         p_row_no.
      DATA: lw_output LIKE LINE OF i_output.
    Need to check that a subtotal or grand total line has *not been double-clicked, otherwise the report will *produce a short dump!
      check p_row+0(1) is initial.
      READ TABLE i_output INDEX p_row INTO lw_output.
      CASE p_column.
        WHEN 'KNUMA'.
          IF NOT lw_output-knuma IS INITIAL.
            SET PARAMETER ID 'VBO' FIELD lw_output-knuma.
            CALL TRANSACTION 'VBO3' AND SKIP FIRST SCREEN.
          ENDIF.
       ENDCASE.
    ENDFORM.                    " F9007_HANDLE_DOUBLE_CLICK
    In PBO of the screen,
    MODULE status_9001 OUTPUT.
      IF o_dockingcontainer IS INITIAL.
       SET HANDLER o_eventreceiver->handle_double_click  FOR o_alvgrid.
    ENDMODULE.                 " STATUS_9001  OUTPUT
    In this I have mentioned double click event.
    Similarly you have to do for others.
    Regards,
    J.Jayanthi

  • Issuw with Fieldcatalog in ALV OOPS

    Hi All,
    I am displaying output using ALV OOPs. in output table ihave dropdown field called Manual Processing status.
    to get dropdown i used below logic.
      DATA: lt_dropdown TYPE lvc_t_drop,
            ls_dropdown TYPE lvc_s_drop.
      ls_dropdown-handle = '1'.
      ls_dropdown-value = 'OPEN'(016).
      APPEND ls_dropdown TO lt_dropdown.
      ls_dropdown-handle = '1'.
      ls_dropdown-value = 'CLOSED'(012).
      APPEND ls_dropdown TO lt_dropdown.
      ls_dropdown-handle = '1'.
      ls_dropdown-value = 'CANCELLED'(014).
      APPEND ls_dropdown TO lt_dropdown.
      ls_dropdown-handle = '1'.
      ls_dropdown-value = 'NO ACTION REQUIRED'(015).
      APPEND ls_dropdown TO lt_dropdown.
      ls_dropdown-handle = '1'.
      ls_dropdown-value = ' '.
      APPEND ls_dropdown TO lt_dropdown.
      CALL METHOD grid->set_drop_down_table
        EXPORTING
          it_drop_down = lt_dropdown.
    when i a, displaying the output lenth of this field is '9'(i mentioned while building the fieldcatalog) but in output its size is more. I used the below field catalog for this field.
      ls_feildcat-fieldname = pv_field.
      ls_feildcat-outputlen =  pc_length.
      ls_feildcat-coltext = pv_header.
      ls_feildcat-just = pc_true.
      ls_feildcat-no_out = gc_space.
      ls_feildcat-drdn_hndl = '1'.
      ls_feildcat-fix_column = 'X'.
    when i comment   ls_feildcat-drdn_hndl = '1' then its working fine but i am not getting dropdown. ANybody can sugeest me how to approach in this case.
    Regards,
    Maheedhar

    Hi,
    Not sure to get your point...could this be in relation with your layout settings (e.g by passing is_layout-cwidth_opt = 'X' to method set_table_for_first_display) ?
    Kr,
    m.

  • Using 'export to database' in background processing

    If i call a Function Module in Background will i be able to  Export values to Database ?
    like:
    CALL FUNCTION 'func_name' IN BACKGROUND TASK TABLES table = table1.
    and in FM:
    EXPORT <one> FROM <two> TO DATABASE indx(some) ID 'some1'.
    I am only able to export if i dont use the background processing.
    thanks
    Edited by: shalaxy s on Feb 10, 2009 3:18 PM

    Hi Shalaxy,
    Calling Function Module in Background/Update Task is normally used for bundling techniques where your requirement is to execute all the database updates in single database LUW (Logical Unit of Work) in order to maintain data integrity. All your database updates gets successfull or none of them.
    If you call FM in Background Task, it is not executed immediatly, it is registered with all its values and executed only when COMMIT WORK statement is executed.
    I think there is no explicit COMMIT WORK statement in your code and that is why you are not able to see effect of EXPORT TO DATABASE statement as LUW is not at all initiated.
    I feel, as your requirement is only to suppress the ALV output, you should handle it through some other alternative e.g. using parameter or something like that and If function module you are talking about is Z and you are willing to change it.
    Regards,
    Vishal

  • GUI_DOWNLOAD and background processing

    Hello,
    I have created a process which creates a file. this process uses GUI_DOWNLOAD to put the file on the users C drive or other directory on our network. The user wants to run this process in background and the program is returning a 6  (error unknown) from the GUI_DOWNLOAD FM. I was looking on SDN and found out the GUI_DOWNLOAD only works in foreground. You have to use OPEN and CLOSE DATASET statements to process in background. I am thinking about putting a button to denote foreground/background processing and using the appropriate statements to process the file. I will then have to get the file from the app server to a place will the user can get access to it.
    <b>first question</b> - is there a FM to do a FTP from the app server to a directory on our network for the user to access?
    <b>second question</b> - is this the right approach or is there something else that I should be doing.
    thanks in advance for your help

    Hi,
    Yes, your right, GUI_DOWNLOAD wil not work in background mode, you need to place the file in Application server, here.
    See the below link for a FTP program, use the proper commands(i do not know whether downloading the file is possible through the commands)
    http://www.sap-img.com/ab003.htm
    or else, write a small program which downloads the data from the application server, but it should run in the foreground
    Regards
    Sudheer

  • The request could not be submitted for background processing.

    Post Author: Chriss
    CA Forum: Administration
    It's an BOE XI SR2, on Win2k3 server, with a print cluster with two print spools, handling 3000+ printers. I discovered this error to be intermittent and only on one of the spools. It turned out that the only common factor was an HP4250 print driver. I backed all the 4250s down to 4200 drivers and the intermitent error ("Error in File. The request could not be submitted for background processing.") went from about 100 a day to zero. The other spool had a different version of the HP4250 driver and would on rare occassion cause this error, "Error in File ... Page header or footer longer than a page." but never the background processing error.
    For reference, when I got this error in XI R1, this was the solution for 'the error with one name and many causes':The error "The request could not be submitted for background processing" can be related to a corrupt or wrong versioned crpe32.dll in the Crystal bin folder. Renaming to crpe32.dll_bak and using the repair command in the the "Add/Remove Programs" tool in the "Control Panel" will reinstall the correct dll. Then restart the Crystal services.

    Post Author: krishna.moorthi
    CA Forum: Administration
    For Crystal reports :
    Error : "The request could not be submitted for background processing"
    I think,this was not related to a corrupt or wrong versioned crpe32.dll.
    but the below mentioned is one of the reason for getting this error.
    I got the error when the main report(crystalreports10) having more than 2 subreports not assigned proper tables for the subreports.
    Example: (this code raise the abone mentioned error.)
    rpt.SetDataSource(Exdataset);
    rpt.Subreports&#91;"subreportname1"&#93;.SetDataSource(Exdataset); // Exdatatset.Tables&#91;1&#93;
    rpt.Subreports&#91;"subreportname2"&#93;.SetDataSource(Exdataset);// Exdatatset.Tables&#91;2&#93;

  • How to Create Excel File in Background processing with different colors

    HI All
    I am trying to create Excel file in background & send it to user through e-mail, this i could acheive using fucntion module SO_DOCUMENT_SEND_API1, but here my requirement is i want to put different colors to columns of excel & this should happen in Background processing,
    Initially i completed above requirement by using HTML type of document with attachment type 'ALI'  & formatted output using write statement & used colors, after that i took this o/p using save_list function module & then table compress...etc.
    but i don't know how to achieve same if we need o/p in excel as size of object of excel file is less than that of HTML
    I am thankfull to everybody who will help me.
    Regards
    Lokesh

    Lokesh,
    Iam also trying to populate my text file with colors as an attachment . If you know this please let me know.

  • When running the workflow background process for drop shipment order, sale order line's status gets automtically closed instead of awaiting shipping

    Hello friends,
    I am created a drop shipment order with all the setups done . now i have booked the sale order as source type external. but when i run the workflow background process , after completing the report when i check the sale order line status it changes to "closed" instead of "awaiting shipping".
    Plz guide me if i have missed something in the setups.
    thanks,
    Sachin

    Hi Sachin,
    pls check the below notes from MOS
    Drop Ship Sales Order Cycle In Order Management (Doc ID 749139.1)
    Vision Demo - How To Create A Drop Ship Sales Order/Purchase Order (Doc ID 1060343.1)
    Thanks
    -Arif.

  • To set HOTSPOT for a field in ALV-oops and when clecked should call transac

    Hi,
    I need to set HOTSPOT for a field in O/P list using ALV-oops and when clecked should take me to Transaction VA01. Please help....
    Thanks,
    Prabhu

    Hi,
         Please go through this code it may help u.
    REPORT zcls_alv_oops MESSAGE-ID z1.
    TABLES : mara.
    Types Declaration..\
    TYPES :
    BEGIN OF t_mara,
    matnr TYPE matnr,
    mtart TYPE mtart,
    maktx TYPE maktx,
    END OF t_mara,
    BEGIN OF t_marc,
    matnr TYPE matnr,
    werks TYPE werks_d,
    mtart TYPE mtart,
    maktx TYPE maktx,
    END OF t_marc.
    Internal Tables Declaration..\
    DATA :
    i_mara TYPE TABLE OF t_mara,
    i_marc TYPE TABLE OF t_marc,
    i_fcat1 TYPE lvc_t_fcat,
    i_fcat2 TYPE lvc_t_fcat.
    Constants Declaration..\
    CONSTANTS :
    c_cont1 TYPE scrfname VALUE 'CONT1',
    c_cont2 TYPE scrfname VALUE 'CONT2'.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
    SELECT-OPTIONS:
    s_matnr FOR mara-matnr NO INTERVALS.
    SELECTION-SCREEN SKIP 1.
    PARAMETERS :
    p_hotspt RADIOBUTTON GROUP r1 DEFAULT 'X',
    p_bttn RADIOBUTTON GROUP r1.
    SELECTION-SCREEN END OF BLOCK b1.
    \* Class forward referncing.
    CLASS lcl_rcvr_class DEFINITION DEFERRED.
    \* Pointers Declaration..
    DATA :
    lp_rcvr TYPE REF TO lcl_rcvr_class,
    lp_cont1 TYPE REF TO cl_gui_custom_container,
    lp_cont2 TYPE REF TO cl_gui_custom_container,
    lp_grid1 TYPE REF TO cl_gui_alv_grid,
    lp_grid2 TYPE REF TO cl_gui_alv_grid.
    \* Local Class Definiton.
    CLASS lcl_rcvr_class DEFINITION.
    PUBLIC SECTION.
    METHODS :
    hotspot_click FOR EVENT hotspot_click OF cl_gui_alv_grid
    IMPORTING e_row_id e_column_id es_row_no,
    handle_double_click FOR EVENT double_click OF cl_gui_alv_grid
    IMPORTING e_row e_column.
    ENDCLASS.
    \* Local Class Implementation.
    CLASS lcl_rcvr_class IMPLEMENTATION.
    METHOD hotspot_click.
    DATA :
    wa_mara TYPE t_mara,
    wa_marc TYPE t_marc.
    DATA :
    l_index TYPE sy-tabix.
    READ TABLE i_mara INTO wa_mara INDEX e_row_id-index.
    IF sy-subrc EQ 0.
    REFRESH i_marc.
    SELECT matnr
    werks
    INTO TABLE i_marc
    FROM marc
    WHERE matnr EQ wa_mara-matnr.
    IF sy-subrc EQ 0.
    LOOP AT i_marc INTO wa_marc.
    l_index = sy-tabix.
    wa_marc-mtart = wa_mara-mtart.
    wa_marc-maktx = wa_mara-maktx.
    MODIFY i_marc FROM wa_marc INDEX l_index
    TRANSPORTING mtart maktx.
    ENDLOOP.
    CALL SCREEN 200.
    ELSE.
    MESSAGE e121 WITH text-005 wa_mara-matnr.
    ENDIF.
    ENDIF.
    ENDMETHOD.
    METHOD handle_double_click.
    DATA :
    wa_mara TYPE t_mara,
    wa_marc TYPE t_marc.
    DATA :
    l_index TYPE sy-tabix.
    READ TABLE i_mara INTO wa_mara INDEX e_row-index.
    IF sy-subrc EQ 0.
    REFRESH i_marc.
    SELECT matnr
    werks
    INTO TABLE i_marc
    FROM marc
    WHERE matnr EQ wa_mara-matnr.
    IF sy-subrc EQ 0.
    LOOP AT i_marc INTO wa_marc.
    l_index = sy-tabix.
    wa_marc-mtart = wa_mara-mtart.
    wa_marc-maktx = wa_mara-maktx.
    MODIFY i_marc FROM wa_marc INDEX l_index
    TRANSPORTING mtart maktx.
    ENDLOOP.
    CALL SCREEN 200.
    ELSE.
    MESSAGE e121 WITH text-005 wa_mara-matnr.
    ENDIF.
    ENDIF.
    ENDMETHOD.
    ENDCLASS.
    \* Start of Selection
    START-OF-SELECTION.
    \* Extract the Material Master data for the Input Material.
    SELECT a~matnr
    a~mtart
    b~maktx
    INTO TABLE i_mara
    FROM mara AS a
    INNER JOIN makt AS b
    ON a~matnr EQ b~matnr
    WHERE a~matnr IN s_matnr
    AND b~spras EQ sy-langu.
    END-OF-SELECTION.
    IF NOT i_mara\[\] IS INITIAL.
    \* Call Screen to display the Material Master data.
    CALL SCREEN 100.
    ELSE.
    MESSAGE s121 WITH text-006.
    ENDIF.
    \*& Module DISP_GRID OUTPUT
    \* text
    MODULE disp_grid OUTPUT.
    \* Build the Field catelog for Material Master data.
    PERFORM build_fcat.
    \* Display the Material Master data using ALV.
    PERFORM disp_alv.
    ENDMODULE. " DISP_GRID OUTPUT
    \*& Module USER_COMMAND_0100 INPUT
    \* text
    MODULE user_command_0100 INPUT.
    \*when exit or cancel is clicked program has to come out
    CASE sy-ucomm.
    WHEN 'EXIT' OR 'CANC'.
    LEAVE PROGRAM.
    WHEN 'BACK'.
    LEAVE TO SCREEN 0.
    ENDCASE.
    ENDMODULE. " USER_COMMAND_0100 INPUT
    \*& Form build_fcat
    \* text
    \* \--> p1 text
    \* <-\- p2 text
    FORM build_fcat.
    DATA : ws_fcat TYPE lvc_s_fcat.
    ws_fcat-fieldname = 'MATNR'.
    ws_fcat-scrtext_m = text-001.
    ws_fcat-tabname = 'I_MARA'.
    IF p_hotspt EQ 'X'.
    ws_fcat-hotspot = 'X'.
    ENDIF.
    APPEND ws_fcat TO i_fcat1.
    CLEAR ws_fcat.
    ws_fcat-fieldname = 'MTART'.
    ws_fcat-scrtext_m = text-002.
    ws_fcat-tabname = 'I_MARA'.
    APPEND ws_fcat TO i_fcat1.
    CLEAR ws_fcat.
    ws_fcat-fieldname = 'MAKTX'.
    ws_fcat-scrtext_m = text-003.
    ws_fcat-tabname = 'I_MARA'.
    APPEND ws_fcat TO i_fcat1.
    CLEAR ws_fcat.
    ENDFORM. " build_fcat
    \*& Form disp_alv
    \* text
    \* \--> p1 text
    \* <-\- p2 text
    FORM disp_alv.
    IF lp_cont1 IS INITIAL.
    \* Create the Container Object of Material Master.
    CREATE OBJECT lp_cont1
    EXPORTING
    container_name = c_cont1
    EXCEPTIONS
    cntl_error = 1
    cntl_system_error = 2
    create_error = 3
    lifetime_error = 4
    lifetime_dynpro_dynpro_link = 5
    others = 6 .
    IF sy-subrc NE 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ELSE.
    \* Create the Object for Grid of Material Master.
    CREATE OBJECT lp_grid1
    EXPORTING
    i_parent = lp_cont1
    EXCEPTIONS
    error_cntl_create = 1
    error_cntl_init = 2
    error_cntl_link = 3
    error_dp_create = 4
    others = 5.
    IF sy-subrc NE 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ELSE.
    \* Dipslay Material Master data by calling method.
    CALL METHOD lp_grid1->set_table_for_first_display
    CHANGING
    it_outtab = i_mara
    it_fieldcatalog = i_fcat1
    EXCEPTIONS
    invalid_parameter_combination = 1
    program_error = 2
    too_many_lines = 3
    OTHERS = 4.
    IF sy-subrc NE 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ELSE.
    \* Set Handler for the Hot Spot Event.
    CREATE OBJECT lp_rcvr.
    IF p_hotspt EQ 'X'.
    SET HANDLER lp_rcvr->hotspot_click FOR lp_grid1.
    ELSE.
    SET HANDLER lp_rcvr->handle_double_click FOR lp_grid1.
    ENDIF.
    ENDIF.
    ENDIF.
    ENDIF.
    ENDIF.
    ENDFORM. " disp_alv
    \*& Module STATUS_0100 OUTPUT
    \* text
    MODULE status_0100 OUTPUT.
    SET PF-STATUS 'MAIN_STAT'.
    SET TITLEBAR 'T_100'.
    ENDMODULE. " STATUS_0100 OUTPUT
    \*& Module STATUS_0200 OUTPUT
    \* text
    MODULE status_0200 OUTPUT.
    SET PF-STATUS 'PLANT_STAT'.
    SET TITLEBAR 'T_200'.
    ENDMODULE. " STATUS_0200 OUTPUT
    \*& Module DISP_GRID_plant OUTPUT
    \* text
    MODULE disp_grid_plant OUTPUT.
    \* Build the Field catelog for Material Plant data.
    PERFORM build_fcat_plant.
    \* Display the Material Master Plant data using ALV.
    PERFORM disp_alv_plant.
    ENDMODULE. " DISP_GRID_plant OUTPUT
    \*& Module USER_COMMAND_0200 INPUT
    \* text
    MODULE user_command_0200 INPUT.
    \*when exit or cancel is clicked program has to come out
    CASE sy-ucomm.
    WHEN 'EXIT' OR 'CANC'.
    LEAVE PROGRAM.
    WHEN 'BACK'.
    LEAVE TO SCREEN 0.
    ENDCASE.
    ENDMODULE. " USER_COMMAND_0200 INPUT
    \*& Form build_fcat_plant
    \* text
    \* \--> p1 text
    \* <-\- p2 text
    FORM build_fcat_plant.
    DATA : ws_fcat TYPE lvc_s_fcat.
    ws_fcat-fieldname = 'MATNR'.
    ws_fcat-scrtext_m = text-001.
    ws_fcat-tabname = 'I_MARC'.
    APPEND ws_fcat TO i_fcat2.
    CLEAR ws_fcat.
    ws_fcat-fieldname = 'WERKS'.
    ws_fcat-scrtext_m = text-004.
    ws_fcat-tabname = 'I_MARC'.
    APPEND ws_fcat TO i_fcat2.
    CLEAR ws_fcat.
    ws_fcat-fieldname = 'MTART'.
    ws_fcat-scrtext_m = text-002.
    ws_fcat-tabname = 'I_MARC'.
    APPEND ws_fcat TO i_fcat2.
    CLEAR ws_fcat.
    ws_fcat-fieldname = 'MAKTX'.
    ws_fcat-scrtext_m = text-003.
    ws_fcat-tabname = 'I_MARC'.
    APPEND ws_fcat TO i_fcat2.
    CLEAR ws_fcat.
    ENDFORM. " build_fcat_plant
    \*& Form disp_alv_plant
    \* text
    \* \--> p1 text
    \* <-\- p2 text
    FORM disp_alv_plant.
    IF lp_cont2 IS INITIAL.
    \* Create the Container Object of Material Plant data.
    CREATE OBJECT lp_cont2
    EXPORTING
    container_name = c_cont2
    EXCEPTIONS
    cntl_error = 1
    cntl_system_error = 2
    create_error = 3
    lifetime_error = 4
    lifetime_dynpro_dynpro_link = 5
    others = 6.
    IF sy-subrc NE 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ELSE.
    \* Create the Object for Grid of Material Plant data.
    CREATE OBJECT lp_grid2
    EXPORTING
    i_parent = lp_cont2
    EXCEPTIONS
    error_cntl_create = 1
    error_cntl_init = 2
    error_cntl_link = 3
    error_dp_create = 4
    others = 5.
    IF sy-subrc NE 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ELSE.
    \* Dipslay Material Plant data by calling method.
    CALL METHOD lp_grid2->set_table_for_first_display
    CHANGING
    it_outtab = i_marc
    it_fieldcatalog = i_fcat2
    EXCEPTIONS
    invalid_parameter_combination = 1
    program_error = 2
    too_many_lines = 3
    OTHERS = 4.
    IF sy-subrc NE 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    ENDIF.
    ENDIF.
    ELSE.
    \* Call method 'REFRESH_TABLE_DISPLAY' to refresh the grid data.
    CALL METHOD lp_grid2->refresh_table_display.
    ENDIF.
    ENDFORM. " disp_alv_plant

  • Problem while placing a button in the Output using ALV OOPs

    Hi,
    I am using ALV OOPs to display  report output.
    In the toolbar i have to palce an update button  and if i click on that update it should then call the selection screen 500 .
    So,please  help me to achieve this using ALV OOPs.
    THANKS & REGARDS,
    Kiranmai.

    Hi,
    you can use set pf-status statement with the OOPs' concept where in you will have to give this in the events table and pass it to the method to display the alv ...
    Regards,
    Siddarth

Maybe you are looking for