Edit a selected row in an alv report after pressing a push button ?

hi all ,
I want to edit a selected row in an alv report but that too after i press a push button . After pressing the push button , a pop up shud *** showing all the entries of the selected row which shud be editable and after editing it shud be saved into the database table.
How can i do this please help asap ???

May this prog. of mine can solve your requirement.
REPORT z_demo_alv_jg.
TYPE-POOLS                                                          *
TYPE-POOLS: slis.
INTERNAL TABLES/WORK AREAS/VARIABLES                                *
DATA: i_fieldcat TYPE slis_t_fieldcat_alv,
      i_index TYPE STANDARD TABLE OF i WITH HEADER LINE,
      w_field TYPE slis_fieldcat_alv,
      p_table LIKE dd02l-tabname,
      dy_table TYPE REF TO data,
      dy_tab TYPE REF TO data,
      dy_line TYPE REF TO data.
FIELD-SYMBOLS                                                       *
FIELD-SYMBOLS: <dyn_table> TYPE STANDARD TABLE,
               <dyn_wa> TYPE ANY,
               <dyn_field> TYPE ANY,
               <dyn_tab_temp> TYPE STANDARD TABLE.
SELECTION SCREEN                                                    *
PARAMETERS: tabname(30) TYPE c,
            lines(5)  TYPE n.
START-OF-SELECTION                                                  *
START-OF-SELECTION.
Storing table name
  p_table = tabname.
Create internal table dynamically with the stucture of table name
entered in the selection screen
  CREATE DATA dy_table TYPE STANDARD TABLE OF (p_table).
  ASSIGN dy_table->* TO <dyn_table>.
  IF sy-subrc <> 0.
    MESSAGE i000(z_zzz_ca_messages) WITH ' No table found'.
    LEAVE TO LIST-PROCESSING.
  ENDIF.
Create workarea for the table
  CREATE DATA dy_line LIKE LINE OF <dyn_table>.
  ASSIGN dy_line->* TO <dyn_wa>.
Create another temp. table
  CREATE DATA dy_tab TYPE STANDARD TABLE OF (p_table).
  ASSIGN dy_tab->* TO <dyn_tab_temp>.
  SORT i_fieldcat BY col_pos.
Select data from table
  SELECT * FROM (p_table)
  INTO TABLE <dyn_table>
  UP TO lines ROWS.
  REFRESH <dyn_tab_temp>.
Display report
  CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
      i_callback_program       = sy-repid
      i_structure_name         = p_table
      i_callback_user_command  = 'USER_COMMAND'
      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  SET_PF_STATUS
      Setting custom PF-Status
     -->RT_EXTAB   Excluding table
FORM set_pf_status USING rt_extab TYPE slis_t_extab.
  SET PF-STATUS 'Z_STANDARD'.
ENDFORM.                    "SET_PF_STATUS
*&      Form  user_command
      Handling custom function codes
     -->R_UCOMM      Function code value
     -->RS_SELFIELD  Info. of cursor position in ALV
FORM user_command  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.
        IF sy-subrc = 0.
        Make all the fields input enabled except key fields
          w_field-input = 'X'.
          MODIFY i_fieldcat FROM w_field TRANSPORTING input
          WHERE key IS INITIAL.
        ENDIF.
      Display the record for editing purpose
        CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
          EXPORTING
            i_callback_program    = sy-repid
            i_structure_name      = p_table
            it_fieldcat           = i_fieldcat
            i_screen_start_column = 10
            i_screen_start_line   = 15
            i_screen_end_column   = 200
            i_screen_end_line     = 20
          TABLES
            t_outtab              = <l_tab>
          EXCEPTIONS
            program_error         = 1
            OTHERS                = 2.
        IF sy-subrc = 0.
        Read the modified data
          READ TABLE <l_tab> INDEX 1 INTO <l_wa>.
        If the record is changed then track its index no.
        and populate it in an internal table for future
        action
          IF sy-subrc = 0 AND <dyn_wa> <> <l_wa>.
            <dyn_wa> = <l_wa>.
            i_index = rs_selfield-tabindex.
            APPEND i_index.
          ENDIF.
        ENDIF.
      ENDIF.
  When save button is pressed
    WHEN 'SAVE'.
    Sort the index table
      SORT i_index.
    Delete all duplicate records
      DELETE ADJACENT DUPLICATES FROM i_index.
      LOOP AT i_index.
      Find out the changes in the internal table
      and populate these changes in another internal table
        READ TABLE <dyn_table> ASSIGNING <dyn_wa> INDEX i_index.
        IF sy-subrc = 0.
          APPEND <dyn_wa> TO <dyn_tab_temp>.
        ENDIF.
      ENDLOOP.
    Lock the table
      CALL FUNCTION 'ENQUEUE_E_TABLE'
        EXPORTING
          mode_rstable   = 'E'
          tabname        = p_table
        EXCEPTIONS
          foreign_lock   = 1
          system_failure = 2
          OTHERS         = 3.
      IF sy-subrc = 0.
      Modify the database table with these changes
        MODIFY (p_table) FROM TABLE <dyn_tab_temp>.
        REFRESH <dyn_tab_temp>.
      Unlock the table
        CALL FUNCTION 'DEQUEUE_E_TABLE'
          EXPORTING
            mode_rstable = 'E'
            tabname      = p_table.
      ENDIF.
  ENDCASE.
  rs_selfield-refresh = 'X'.
ENDFORM.                    "user_command
Regards,
Joy.

Similar Messages

  • Print Selection Screen Parameters in ALV report only once

    Does anyone know how to print the selection screen within a ALV report.
    I've tried everything. I have the code to capture the selection parameters into a internal table. I can use top_of_page but I only want it printed once.

    Hi,
      If you have captured the selection screen entries in an internal table, then you could display it once by using the BLOCK LIST ALV.
    Check the function module.
    REUSE_ALV_BLOCK_LIST_DISPLAY
    Using this function module more than 1 alv could be display in the report.
    In our case ..there will be two alvs ...one for the selection screen n other for the main report output.
    Check the following example on the block List ALV....
    <b>BALVBT01</b>.
    Regards,
    Vara

  • Display and edit currently selected row of ADF Table in ADF Form

    I have an ADF Read-only Table and ADF Form, which were created from the same Data Control.
    I need to be able to edit the selected row of the table in the form (just like in "Binding Data Controls to your JSF page" part of "Developing RIA Web Applications with Oracle ADF" Tutorial). However, I can't figure out how to do this :(
    I found the following solution on the Web: #{bindings.DeptView1.currentRow.dataProvider.dname} - but it doesn't work, since "the class oracle.jbo.server.ViewRowImpl does not have the property dataProvider".
    Sorry for the newbie question.
    Thanks in advance for any help!

    Hi,
    AFAIK, dataProvider is not supported on ADF BC, hence the error.
    If you have created ADF Read only table and form from the same data control you just need to refresh the form based on table selection to show up the selected record, to do which you just need to add partialTriggers property to the panelFormLayout and set its value to the id of table
    Sireesha

  • Can we adjust ROW height in ALV report as like of Excel ?

    Dear all,
    Can we adjust ROW height in ALV report as like of Excel sheet ?
    Can we increase/decrease the row height in the output display ?
    How ?

    kps204020 wrote:
    Thanks a lot for your response.
    I've tried your proposal, but it has no affect. The report cells show all their content using as much lines as necessary for this.This is the default behaviour for HTML table data (tables and cells expand to fit their content).
    So I still have rows with lots of lines and rows with only a few lines mixed in my IR dependant on the cell content. Because some rows filling nearly the whole screen, it is difficult to get an overview with regard to adjacent rows.
    I'm using Application Express 4.1.1.00.23. with Theme 21. Scarlet and Firefox 17.0.1.Are all users using Firefox?
    Actually I'm working on my first APEX Solution for usage in my company and the customers demanding a solution for this topic . So I'm very keen to find a solution.
    I'm very much looking forward to your response.I've been involved with similar issues in the past. My first response is simple: Does this data have to be shown in the report? Can the offending column(s) be removed from the primary report? They will still be visible in the single row view, and the detail view if there is one.
    The second option is to create a detail view for the report with a structure that is better suited to the data involved, and make this the default view. (For an example of this, see the treatment of the PRODUCT_DESCRIPTION column in the detail view of the Products report in the Sample Database Application: click on the View Detail button on the Products page.)
    The third possibility is some kind of customization of the presentation of the data. This will involve using some combination of HTML/CSS/Dynamic Actions/Plug-ins/JavaScript that you may not be familiar with: do you have experience of these? To go down that route you need to describe in detail how you want to present the data, or what behaviour is required when the data is too long, and share an example of the report on apex.oracle.com that we can work with.

  • How to select multiple records in ALV with out pressing ctrl

    Hi Experts,
    Is there a way to select multiple records in ALV with out pressing ctrl button on the key board?
    Selection and deselection should allow multiple records.
    any clue is highly appreciated.
    regards,
    Ajay

    The keyboard always plays a role, although with the Shift key you can select blocks of records.
    ○       CTRLclick, CTRLspacebar
    Toggles a selection.
    ○       SHIFTclick, CTRLshift
    Selects the area from the lead selection to the row selected. If no lead selection is set, the selection starts from the first row. In the multiNoLead mode, the selection starts from the row last selected

  • F4 help in alv report ( after execution )

    hi all,
    i want f4 help in my alv report( after execute it) in a particular filed.
    is this possible???
    In Advance  Thanks
    Amit Singh

    hi,
    use ref_fieldname and ref_tabname
    like below
    wa_fieldcat-ref_fieldname= 'NAME1'.
    wa_fieldcat-ref_tabname = 'KNA1'.
    Hope this helps
    Regards
    Ritesh J

  • Display output list by pressing a push button on selection screen.

    Hi All,
    Is there any possibility of displaying the output list by pressing a push button on the selection screen.
    Thanks,
    Neslin.

    Hi,
    Just write the code like this
    Case sy-ucomm.
    when 'PRE'.
    Here write the output list
    " leave to list-processing. Write this statement
    endcase.
    Regards
    Sarves

  • ALV Grid OO : Set Field editable for  selected rows

    Hello ABAPers,
    I used object  cl_gui_alv_grid to created ALV grid and i succed to set an editable
    field for all rows. However my request is to set it for and only for selected rows
    I could get the row index but i didn't know how to use it
    Thanks in advance
    Amine

    Hi Amine,
    I think the standard SAP sample program might help you, BCALV_EDIT_02.
    I will tell the procedure to make the selected rows editable on ALV.
    1. Add a additional field of type LVC_T_STYL in the internal table that you are displaying in the ALV. LVC_T_STYL is a actually a table type.
    2. Place a button on the ALV toolbar for EDIT/DISPLAY.
    3. Once you press the EDIT button after selecting the rows, loop through the records which you have selected (you have already said that you have the index of selected records).
    4. The table type LVC_T_STYL has fields for FIELDNAME and STYLE.
       If you have 10 fields in the internal table, then all these ten fields name should be appended to the newly added field in the internal table (LVC_T_STYL) and their style should be populated with value cl_gui_alv_grid=>mc_style_enabled.
    Regards,
    Rahul MB

  • How to select multiple lines in ALV report

    hi gurus,
    I am working on an interactive ALV report where i have to select multiple lines from the basic list into an internal table, based on check box clicks. Using RS_SELFIELD i can select only 1 row. The coding has been done based on Call Function. Can u please suggest some way.
    Regards,
    Satyajit

    hi,
    try like this
    TABLES:     ekko.
    TYPE-POOLS: slis.                                 "ALV Declarations
    TYPES: BEGIN OF t_ekko,
      sel,                         "stores which row user has selected
      ebeln TYPE ekpo-ebeln,
      ebelp TYPE ekpo-ebelp,
      statu TYPE ekpo-statu,
      aedat TYPE ekpo-aedat,
      matnr TYPE ekpo-matnr,
      menge TYPE ekpo-menge,
      meins TYPE ekpo-meins,
      netpr TYPE ekpo-netpr,
      peinh TYPE ekpo-peinh,
    END OF t_ekko.
    DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
          wa_ekko TYPE t_ekko.
    DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE,
          fieldcatalog1 TYPE slis_t_fieldcat_alv WITH HEADER LINE,
          gd_tab_group TYPE slis_t_sp_group_alv,
          gd_layout    TYPE slis_layout_alv,
          gd_repid     LIKE sy-repid.
    DATA : BEGIN OF det_tab OCCURS 0,
            ebeln LIKE ekpo-ebeln,
           END OF det_tab.
    START-OF-SELECTION.
      PERFORM data_retrieval.
      PERFORM build_fieldcatalog.
      PERFORM build_layout.
      PERFORM display_alv_report.
    *&      Form  BUILD_FIELDCATALOG
    *       Build Fieldcatalog for ALV Report
    FORM build_fieldcatalog.
      fieldcatalog-fieldname   = 'EBELN'.
      fieldcatalog-seltext_m   = 'Purchase Order'.
      fieldcatalog-outputlen   = 10.
      fieldcatalog-emphasize   = 'X'.
      fieldcatalog-key         = 'X'.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'EBELP'.
      fieldcatalog-seltext_m   = 'PO Item'.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'STATU'.
      fieldcatalog-seltext_m   = 'Status'.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'AEDAT'.
      fieldcatalog-seltext_m   = 'Item change date'.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'MATNR'.
      fieldcatalog-seltext_m   = 'Material Number'.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'MENGE'.
      fieldcatalog-seltext_m   = 'PO quantity'.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'MEINS'.
      fieldcatalog-seltext_m   = 'Order Unit'.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'NETPR'.
      fieldcatalog-seltext_m   = 'Net Price'.
      fieldcatalog-outputlen   = 15.
      fieldcatalog-do_sum      = 'X'.        "Display column total
      fieldcatalog-datatype     = 'CURR'.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'PEINH'.
      fieldcatalog-seltext_m   = 'Price Unit'.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
    ENDFORM.                    " BUILD_FIELDCATALOG
    *&      Form  BUILD_LAYOUT
    *       Build layout for ALV grid report
    FORM build_layout.
      gd_layout-box_fieldname     = 'SEL'.
      "set field name to store row selection
      gd_layout-edit              = 'X'. "makes whole ALV table editable
      gd_layout-zebra             = 'X'.
    ENDFORM.                    " BUILD_LAYOUT
    *&      Form  DISPLAY_ALV_REPORT
    *       Display report using ALV grid
    FORM display_alv_report.
      gd_repid = sy-repid.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program       = gd_repid
          i_callback_user_command  = 'USER_COMMAND'
          i_callback_pf_status_set = 'SET_STAT'
          is_layout                = gd_layout
          it_fieldcat              = fieldcatalog[]
          i_save                   = 'X'
        TABLES
          t_outtab                 = it_ekko
        EXCEPTIONS
          program_error            = 1
          OTHERS                   = 2.
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " DISPLAY_ALV_REPORT
    *&      Form  DATA_RETRIEVAL
    *       Retrieve data form EKPO table and populate itab it_ekko
    FORM data_retrieval.
      SELECT ebeln ebelp statu aedat matnr menge meins netpr peinh
       UP TO 10 ROWS
        FROM ekpo
        INTO CORRESPONDING FIELDS OF TABLE it_ekko.
    ENDFORM.                    " DATA_RETRIEVAL
    *       FORM USER_COMMAND                                          *
    *       --> R_UCOMM                                                *
    *       --> RS_SELFIELD                                            *
    FORM user_command USING r_ucomm LIKE sy-ucomm
                      rs_selfield TYPE slis_selfield.
    * Check function code
      CASE r_ucomm.
        WHEN '&IC1'.
          IF rs_selfield-fieldname = 'EBELN'.
            READ TABLE it_ekko INTO wa_ekko INDEX rs_selfield-tabindex.
            SET PARAMETER ID 'BES' FIELD wa_ekko-ebeln.
            CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
          ENDIF.
        WHEN 'DET'.  "button add by me
          CLEAR det_tab.
          REFRESH det_tab.
          LOOP AT it_ekko INTO wa_ekko WHERE sel = 'X'.
            MOVE-CORRESPONDING wa_ekko TO det_tab.
            APPEND det_tab.
          ENDLOOP.
          PERFORM build_cat.
          PERFORM dis_data.
      ENDCASE.
    ENDFORM.                    "user_command
    *&      Form  set_stat
    *       text
    *      -->RT_EXTAB   text
    FORM set_stat USING rt_extab TYPE slis_t_extab.
      SET PF-STATUS 'ZSTAT' EXCLUDING rt_extab.
    ENDFORM.                    "set_stat
    *&      Form  build_cat
    *       text
    FORM build_cat.
      CLEAR fieldcatalog1.
      REFRESH fieldcatalog1.
      fieldcatalog1-fieldname = 'EBELN'.
      fieldcatalog1-tabname = 'DET_TAB'.
      fieldcatalog1-seltext_m = 'Order No.'.
      fieldcatalog1-outputlen = 10.
      APPEND fieldcatalog1 TO fieldcatalog1.
      CLEAR fieldcatalog1.
    ENDFORM.                    "build_cat
    *&      Form  dis_data
    *       text
    FORM dis_data.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program = 'ZTEST_DS'
          it_fieldcat        = fieldcatalog1[]
          i_save             = 'X'
        TABLES
          t_outtab           = det_tab.
    ENDFORM.                    "dis_data
    here i have copied standard gui status of ALV into my z status ZSTAT and add one button DET......
    here u can select morethan one line using control(ctrl)
    reward if usefull...

  • How to preselect all rows before displaying ALV report

    I would like to select all rows before sending ALV Grid Display. User then can unselect couple of rows for further processing. How do I do that ?. Im using Method grid1->SET_TABLE_FOR_FIRST_DISPLAY for ALV Report Display. Any help appreciated.

    Ok,
    I've started the editor and check my code. I made few small mistakes (like with this exporting/importing), here's the sample - correctly working - code:
    DATA: it_selected TYPE lvc_t_row,
          wa_selected TYPE lvc_s_row,
          wa_sflight TYPE sflight,
          ltp_layout TYPE lvc_s_layo.
         SELECT *
           FROM sflight
           INTO TABLE gi_sflight.
    ltp_layout-stylefname = 'CELLTAB'.
    ltp_layout-sel_mode = 'A'.
    LOOP AT gi_sflight INTO wa_sflight.
          wa_selected-index = sy-tabix.
          APPEND wa_selected TO it_selected.
    ENDLOOP.
    *   * Load data into the grid and display them
         CALL METHOD go_grid->set_table_for_first_display
           EXPORTING i_structure_name = 'SFLIGHT'
                     is_layout            = ltp_layout
                     i_save = 'A'
           CHANGING  it_outtab        = gi_sflight.
    CALL METHOD go_grid->set_selected_rows
          EXPORTING
            it_index_rows = it_selected.
    This time it is 100% correct.
    Edited by: Marcin Cudo on Apr 11, 2010 2:13 AM

  • Row position in alv report

    Hi experts....
    I want to put data in first row in alv report. I am using reuse_alv_list_display for alv report output.
    I used "FIELDCAT_LN-ROW_POS = '1'. '
    but it doesn't make any effect in output.
    please help me.
    thank you.

    Hi..
    Code is like this...
    *& Report  Z_MATERIAL_ANALYSIS
    Report  Z_MATERIAL_ANALYSIS.
    TYPE-POOLS: SLIS , VRM.
    DATA: G_REPID LIKE SY-REPID,
    GS_PRINT            TYPE SLIS_PRINT_ALV,
    GT_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER,
    GT_EVENTS           TYPE SLIS_T_EVENT,
    i_sort TYPE slis_t_sortinfo_alv,
    gs_layout           TYPE SLIS_LAYOUT_ALV,
    GT_FIELDCAT         TYPE SLIS_T_FIELDCAT_ALV,
    FIELDCAT_LN LIKE LINE OF GT_FIELDCAT,
    COL_POS TYPE I.
    DATA: gs_variant LIKE disvariant,
          g_save.
    TABLES : MSEG , MKPF.
    DATA : BEGIN OF ITAB1 OCCURS 0,
           601_602 LIKE MSEG-MENGE,
           END OF ITAB1.
    DATA : BEGIN OF ITAB OCCURS 0,
            LGORT LIKE MSEG-LGORT,
            BWART LIKE MSEG-BWART,
            ZEILE LIKE MSEG-ZEILE,
            MENGE LIKE MSEG-MENGE,
            MEINS LIKE MSEG-MEINS,
            MATNR LIKE MSEG-MATNR,
            WERKS LIKE MSEG-WERKS,
            SHKZG LIKE MSEG-SHKZG,
            MBLNR LIKE MKPF-MBLNR,
            BUDAT LIKE MKPF-BUDAT,
            SIGN(2),
            101_102 LIKE MSEG-MENGE,
            301 LIKE MSEG-MENGE,
            311 LIKE MSEG-MENGE,
            321 LIKE MSEG-MENGE,
            601_602 LIKE MSEG-MENGE,
            641_642 LIKE MSEG-MENGE,
            653 LIKE MSEG-MENGE,
            671 LIKE MSEG-MENGE,
            END OF ITAB.
    DATA: TOTAL_PLUS,
          TOTAL_MINUS,
          TOTAL.
    SELECT-OPTIONS : MATNR FOR MSEG-MATNR,
                     DAT  FOR MKPF-BUDAT.
    PARAMETERS :     LGORT LIKE MSEG-LGORT,
                     WERKS LIKE MSEG-WERKS,
                     BWART LIKE MSEG-BWART.
    SELECT MSEG~MATNR
           MSEG~LGORT
           MSEG~BWART
           MSEG~ZEILE
          MSEG~MENGE
           MSEG~MEINS
           MSEG~WERKS
           MSEG~SHKZG
           MKPF~MBLNR
           MKPF~BUDAT
           INTO CORRESPONDING FIELDS OF TABLE ITAB
           FROM MSEG
           INNER JOIN MKPF ON MSEGMBLNR = MKPFMBLNR
           WHERE MSEG~MATNR IN MATNR
           AND MSEG~LGORT EQ LGORT
           AND MKPF~BUDAT IN DAT
           AND MSEG~WERKS EQ WERKS.
    *LOOP AT ITAB.
    *IF ITAB-BWART EQ
    *WRITE : / 'MATNR', 10 'LGORT',20 'BWART', 30 'ZEILE',40 'MENGE',50
    *'101102', 60
    *'MEINS', 70 'MBLNR', 80 'BUDAT'.
    LOOP AT ITAB.
    IF ITAB-BWART = '101' OR ITAB-BWART = '102'.
      SELECT MENGE INTO (ITAB-101_102) FROM MSEG  WHERE MATNR = ITAB-MATNR
      AND MBLNR = ITAB-MBLNR
      AND LGORT = ITAB-LGORT
      AND WERKS = ITAB-WERKS
      AND ZEILE = ITAB-ZEILE.
      MODIFY ITAB.
      ENDSELECT.
    ENDIF.
    IF ITAB-BWART = '601' OR ITAB-BWART = '602'.
      SELECT MENGE INTO (ITAB-601_602) FROM MSEG WHERE MATNR = ITAB-MATNR
      AND MBLNR = ITAB-MBLNR
      AND LGORT = ITAB-LGORT
      AND WERKS = ITAB-WERKS
      AND ZEILE = ITAB-ZEILE.
    AND BWART IN ('601','602').
      MODIFY ITAB.
      ENDSELECT.
    ENDIF.
    IF ITAB-BWART = '641' OR ITAB-BWART = '642'.
        SELECT MENGE INTO CORRESPONDING FIELDS OF TABLE ITAB1 FROM MSEG
    WHERE MATNR = ITAB-MATNR
        AND MBLNR = ITAB-MBLNR
      AND LGORT = ITAB-LGORT
      AND WERKS = ITAB-WERKS
      AND ZEILE = ITAB-ZEILE.
      MODIFY ITAB.
    ENDSELECT.
    ENDIF.
    ENDLOOP.
    LOOP AT ITAB.
    IF ITAB-SHKZG = 'H'.
      ITAB-SIGN = '+'.
        MODIFY ITAB.
    ELSE.
      ITAB-SIGN = '-'.
    MODIFY ITAB.
    ENDIF.
    ENDLOOP.
    *LOOP AT ITAB.
    *WRITE : /
    ITAB-MATNR,
             ITAB-LGORT,
             ITAB-BWART,
             ITAB-ZEILE,
             ITAB-MENGE,
             ITAB-TOT ,
             ITAB-101_102,
             ITAB-SIGN,
             ITAB-601_602.
             ITAB-SIGN.
             ITAB-MEINS,
             ITAB-MBLNR,
             ITAB-BUDAT,
             ITAB-SHKZG.
    *AT LAST.
    *SUM.
    *WRITE : / ITAB-101_102.
    *ENDAT.
    *ENDLOOP.
    PERFORM BUILD.
    PERFORM CALL_ALV.
    FORM BUILD.
    DATA: FIELDCAT_IN TYPE SLIS_FIELDCAT_ALV.
    REFRESH GT_FIELDCAT.
    *CLEAR GT_FIELDCAT.
    CLEAR FIELDCAT_LN.
    FIELDCAT_LN-FIELDNAME = '101_102'.
    FIELDCAT_LN-TABNAME   = 'ITAB'.
    FIELDCAT_LN-ROW_POS = '1'.
    FIELDCAT_LN-COL_POS = '1'.
    APPEND FIELDCAT_LN TO GT_FIELDCAT.
    CLEAR FIELDCAT_LN.
    FIELDCAT_LN-FIELDNAME = '301 '.
    FIELDCAT_LN-TABNAME   = 'ITAB'.
    FIELDCAT_LN-NO_OUT    = 'X'.
    FIELDCAT_LN-SELTEXT_L = 'Description'.
    FIELDCAT_LN-OUTPUTLEN = 22.
    FIELDCAT_LN-DO_SUM        = 'X'.   "SUM UPON DISPLAY
    APPEND FIELDCAT_LN TO GT_FIELDCAT.
    CLEAR FIELDCAT_LN.
    FIELDCAT_LN-FIELDNAME = '601_602'.
    FIELDCAT_LN-TABNAME   = 'ITAB1'.
    FIELDCAT_LN-ROW_POS = '1'.
    FIELDCAT_LN-COL_POS = '1'.
    *FIELDCAT_LN-NO_OUT    = 'X'.
    FIELDCAT_LN-SELTEXT_L = 'Base qty'.
    FIELDCAT_LN-NO_ZERO = 'X'.
    FIELDCAT_LN-just = 'C'.
    *FIELDCAT_LN-DO_SUM        = 'X'.   "SUM UPON DISPLAY
    APPEND FIELDCAT_LN TO GT_FIELDCAT.
    g_repid = sy-repid.
        gs_variant-report = g_repid.
        g_save           = 'A'.
    ENDFORM.
    FORM EVENTTAB_BUILD CHANGING LT_EVENTS TYPE SLIS_T_EVENT.
    CONSTANTS:
    GC_FORMNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE'.
    *GC_FORMNAME_END_OF_PAGE TYPE SLIS_FORMNAME VALUE 'END_OF_PAGE'.
      DATA: LS_EVENT TYPE SLIS_ALV_EVENT.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
           EXPORTING
                I_LIST_TYPE = 0
           IMPORTING
                ET_EVENTS   = LT_EVENTS.
      READ TABLE LT_EVENTS WITH KEY NAME =  SLIS_EV_TOP_OF_PAGE
                               INTO LS_EVENT.
      IF SY-SUBRC = 0.
        MOVE GC_FORMNAME_TOP_OF_PAGE TO LS_EVENT-FORM.
        APPEND LS_EVENT TO LT_EVENTS.
      ENDIF.
    ENDFORM.
    FORM CALL_ALV.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
      I_CALLBACK_PROGRAM = G_REPID
    I_STRUCTURE_NAME = 'ITAB'
      IS_LAYOUT =  gs_layout
      i_save                            = g_save
      is_variant                        = gs_variant
      IT_FIELDCAT = GT_FIELDCAT[]
       IT_SORT = I_SORT
        IT_EVENTS = GT_EVENTS[]
        IS_PRINT = GS_PRINT
      TABLES
      T_OUTTAB = ITAB
      EXCEPTIONS
      PROGRAM_ERROR = 1
      OTHERS = 2.
    ENDFORM.

  • How can I get the selected rows from two ALV grids at the same time?

    I have a program that uses two ALV grids in one dialog screen. I'm using the OO ALV model (SALV* classes).
    The user can select any number of rows from each grid. Then, when a toolbar pushbutton is pressed, I'd have to retrieve the selected rows from both grids and start some processing with these rows.
    It is no problem to assign event handlers to both grids, and use the CL_SALV_TABLE->GET_SELECTIONS and CL_SALV_SELECTIONS->GET_SELECTED_ROWS methods to find out which rows were marked by the user. Trouble is, this only works when I raise an event in each grid separately, for instance via an own function that I added to the grid's toolbar. So, I can only see the selected rows of the same grid where such an event was raised.
    If I try to do this in the PBO of the dialog screen (that contains the two grids), the result of CL_SALV_SELECTIONS->GET_SELECTED_ROWS will be empty, as the program does not recognize the marked entries in the grids. Also, an event for grid1 does not see the selected rows from grid2 either.
    As it is right now, I can have an own button in both grid's toolbar, select the rows, click on the extra button in each grid (this will tell me what entries were selected per grid). Then, I'd have to click on a third button (the one in the dialog screen's toolbar), and process the selected rows from both grids.
    How can I select the rows, then click on just one button, and process the marked entries from both grids?
    Is it somehow possible to raise an event belonging to each grid programmatically, so that then the corresponding CL_SALV_SELECTIONS->GET_SELECTED_ROWS will work?
    Thanks.

    Hello Tamas ,
    If I try to do this in the PBO of the dialog screen (that contains the two grids), the result of CL_SALV_SELECTIONS->GET_SELECTED_ROWS will be empty, as the program does not recognize the marked entries in the grids. Also, an event for grid1 does not see the selected rows from grid2 either.--->
    is it possible to  have a check box in each grid  & get the selected lines in PAI of the screen ?
    regards
    prabhu

  • To add additonal rows(text)  in ALV report

    Hi there,
    I want to add additional ROWS at the bottom of each grouping.
    Right now I am getting customer wise total comission amount but the requirement is on commsion amt ,i need to calculate 10 % tax and 2% tax and these taxes should get genrated below the commsion amt column as like below:
    Company code Customer Commsion Amt
    2000 101 1000
    2000 101 2000
    Total Comsion 3000
    10% Service Tax 300
    2% Edn Tax 6
    Total 3306
    2000 102 1230
    2000 102 678
    The output should be like this in ALV report .Could anyone plz help me out on this.
    I will really appreciate your help.
    Thanks,

    Hi Archana,
    You can have the subtotal displayed for each company code and commision in the alv.
    At end of each  comp code and customer , pass the total of the whole amount into a line and you can display a line of this total. 
    Your alv gets displayed like this .
    2000 101 1000
    2000 101 2000
    Total Comsion 3000
    10% Service Tax 300
    2% Edn Tax 6
                            3306
    Thanks,
    Guru

  • How to Print Selection-Screen along with ALV Report output

    Hi,
    I have a requirement wherein i need to also print the Selection Screen of a report when I print the ALV report output.
    Basically i need to print the ALV output along with selection screen.
    Could you plz suggest me the way.
    Regards,
    Nitin

    Hi,
    My selection Screen is a very big one. It contains around 30 select-options.
    So is their any standard method in which you can choose whether you want to take the output printout with or without Selection screen.
    Regards,
    Nitin

  • Select Options use in ALV Report in ABAP Webdynpro

    Hello Experts,
    I Already Done ALV Report In webdynpro with use of view Container UI element.But i do not know ALV  report with help of select option.so
    Kindly Give Me simple Example of Use in select Option In ALV.
    Reply ASAP.
    Regards,
    Ameya Karadkhedkar

    First you need to add the component WDR_SELECT_OPTIONS to the tab "Used components" of your Web Dynpro component and then also in the properties tab of your view. In the layout you need to create another view container and embed the view WND_SELECTION_SCREEN of the new used component to it.
    Then in the WDDOINIT method of your view you can write this code (where SEL_OPT is the given name for the used component) in order to set the select option (This example is a select option for a date):
    DATA: lo_cmp_usage           TYPE REF TO if_wd_component_usage,
          lo_interfacecontroller TYPE REF TO iwci_wdr_select_options,
          lo_r_helper_class      TYPE REF TO if_wd_select_options,
          rt_range_date          TYPE REF TO data.
    * Instantiate used component WDR_SELECT_OPTIONS (SEL_OPT)
    lo_cmp_usage = wd_this->wd_cpuse_sel_opt( ).
    IF lo_cmp_usage->has_active_component( ) IS INITIAL.
      lo_cmp_usage->create_component( ).
    ENDIF.
    * Call method in used controller
    lo_interfacecontroller = wd_this->wd_cpifc_sel_opt( ).
    lo_r_helper_class = lo_interfacecontroller->init_selection_screen( ).
    * Create select option for the date
    CALL METHOD lo_r_helper_class->create_range_table
      EXPORTING
        i_typename    = 'DATS'
      RECEIVING
        rt_range_table = rt_range_date.
    CALL METHOD lo_r_helper_class->add_selection_field
      EXPORTING
        i_id          = 'DATS'
        it_result     = rt_range_date
        i_read_only   = ABAP_FALSE.
    * Hide unnecessary buttons
    CALL METHOD lo_r_helper_class->set_global_options
      EXPORTING
        i_display_btn_cancel  = abap_false
        i_display_btn_check   = abap_false
        i_display_btn_reset   = abap_false
        i_display_btn_execute = abap_false.
    Finally you need to write the following code in the action of the button in order to fetch the range table selected by the user.
    DATA: lo_cmp_usage            TYPE REF TO if_wd_component_usage,
          lo_interfacecontroller  TYPE REF TO iwci_wdr_select_options,
          lo_r_helper_class       TYPE REF TO if_wd_select_options,
          rt_date                 TYPE REF TO data.
    FIELD-SYMBOLS: <fs_date> TYPE table.
    * Instantiate used component WDR_SELECT_OPTIONS (SEL_OPT)
    lo_cmp_usage = wd_this->wd_cpuse_sel_opt( ).
    IF lo_cmp_usage->has_active_component( ) IS INITIAL.
      lo_cmp_usage->create_component( ).
    ENDIF.
    * Call method in used controller
    lo_interfacecontroller = wd_this->wd_cpifc_sel_opt( ).
    lo_r_helper_class = lo_interfacecontroller->init_selection_screen( ).
    * get selected range of inspections date
    CALL METHOD lo_r_helper_class->get_range_table_of_sel_field
      EXPORTING
        i_id          = 'DATS'
      RECEIVING
        rt_range_table = rt_date.
    ASSIGN rt_date->* TO <fs_date>.
    Then you can use the value that is assigned to the field symbol <fs_date> to continue with your ALV.

Maybe you are looking for

  • TS4268 IMessaging on iPad mini to "iPod registered to email address" user

    I have an android phone and a Macbook air running 10.7.5.  I recently bought an iPad Mini and am trying to use iMessage on it.  So far noone with an iphone has responded to any messages I have sent!  so I am wondering if it is working-. I have 2 Appl

  • How do I get photos out of iphone and in PC

    I have a PC. How in the world do I get my 90 photos out of the iphone and onto my pc without having to email them one at a time to myself. Can someone please help me. I am sure I am overlooking something very simple. Perry

  • To find the completely Delivered Order

    Hi all, i want to check weather a sales order is delivered completely or not.  Suppose if a sales order is having say 3 items , out of that only 3 i delivered, 2 are pending, in that case i have to ignore that order, if all the items are delivered th

  • OIC SELECT ALL doesn't

    We are Unable to Select All Resources on Payrun Worksheet to Lock or Submit Worksheet. WE WOULD GREATLY APPRECIATE ANY WORK-AROUND TO RESOLVE THIS PROBLEM. We have > 31,000 commissionable resources. Expanding the # of lines/screen to 100 will still r

  • Applets and 3rd party jars

    Hi, I'm trying to use a 3rd party jar with an applet. I can access the functions just fine when using an applet viewer, but when I try deploying the applet from a web page I get classNotFound exceptions. How do I go about getting the applet to recogn