F4 changes in Classic ALV Grid

Hi
I'm using REUSE_ALV_GRID_DISPLAY , I have a Requirement to display F4 for MRP Group based on the plant in ALV GRID  DIsplay.
How Can I capture F4 event and modify Standard F4 by using normal ALV.
Thanks for all your suggestions and time.

Check this Code it will be helpful
{TYPE-POOLS: slis.
DATA: it_fcat TYPE slis_t_fieldcat_alv,
      wa_fcat LIKE LINE OF it_fcat.
DATA: it_data TYPE vbap_t.
SELECT *
  FROM VBAP
  INTO TABLE it_data
  UP TO 20 ROWS.
wa_fcat-fieldname = 'VBELN'.
wa_fcat-tabname  = 'IT_DATA'.
wa_fcat-ref_fieldname = 'VBELN'.
wa_fcat-ref_tabname = 'VBAK'.
APPEND wa_fcat TO it_fcat.
clear wa_fcat .
wa_fcat-fieldname = 'POSNR'.
wa_fcat-tabname  = 'IT_DATA'.
wa_fcat-seltext_l = 'Item'.
APPEND wa_fcat TO it_fcat.
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_interface_check       = sy-repid
      it_fieldcat             = it_fcat
    TABLES
      t_outtab                = it_data
    EXCEPTIONS
      program_error           = 1.}
Edited by: Pradeep Mohandass on Mar 7, 2012 2:09 PM

Similar Messages

  • How to keep track of the changes done in ALV GRID Report

    Hi Experts,
    how to keep track of the changed record in ALV GRID Report. how to set the field to be editable even for the entire row also. Can anybody guide along with code also?...
    Valuable answers will be rewarded.
    Thanks,
    Satish.

    Hi,
    Access the table through SM30. It comes blank as standard. Click "New Entries" and make entries for changes to be tracked. For example, whenever an org. unit changes 002 and 003 relationship, you will make entries like:
    01 O 1001 B002 Activate box checked
    01 O 1001 B003 Activate box checked
    Here, 01 is your active plan version, O is org. unit, 1001 is infotype and B002 and B003 are the subtypes. You can also use * for infotype and subtype which means every change will be logged.
    If you then run the report RHCDOC_DISPLAY through SA38, it will pick up all the changes pertaining to B002 and B003 relationship for org. units (in the above example).
    Similarly, you can set up this table for other object types.
    For more information, follow SPRO>Personnel Management>OM>Basic Settings>Activate change documents and go through the documentation for that node. Also, read up the documentation for the report.
    Hope this helps.
    Donnie

  • How to capture changed value in ALV Grid

    Hi Guys,
    I have an ALV grid report where I have 'Edit On' for one of the quantity fields in the report. How do I capture the new (changed) value in the suboutine for user command when user changes the value in the report and clicks on a button ?
    Points assured for helpful replies.

    FORM USER_COMMAND USING P_UCOMM LIKE SY-UCOMM...........
    Data ref1 type ref to cl_gui_alv_grid.
    CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
    IMPORTING
    E_GRID = ref1.
    call method ref1->check_changed_data
    ENDFORM.
    Also chk the blog
    /people/community.user/blog/2007/01/10/displaychange-mode-of-editable-fields-in-alv-using-function-modules-but-not-custom-containers

  • How to update changed data in alv grid.

    hi experts,
    i have a editable alv report how to update the changed data on the grid to database table when i click save.
    can anybody tell me how to do this if possible with example.
    thanks in advance.
    regards,
    venu

    The code below isn't a working program, but has most of what you should need.  Field-symbol <dyn_table> will always have what is in the grid.
    FIELD-SYMBOLS: <dyn_table> TYPE STANDARD TABLE,
                   <dyn_wa>.
    DATA: pt_fieldcat TYPE lvc_t_fcat,
          ls_fcat TYPE lvc_s_fcat,
          new_table TYPE REF TO data,
          new_line TYPE REF TO data.
    CREATE OBJECT g_custom_container
          EXPORTING container_name = g_container.
    CREATE OBJECT g_grid EXPORTING i_parent = g_custom_container.
    CLEAR ls_fcat.
    ls_fcat-fieldname = 'MATERIAL'.
    ls_fcat-datatype  = 'CHAR'.
    ls_fcat-intlen    = 18.
    ls_fcat-outputlen = 18.
    ls_fcat-coltext   = 'Material'.
    ls_fcat-edit      = 1.
    APPEND ls_fcat TO pt_fieldcat.
    CLEAR ls_fcat.
    ls_fcat-fieldname = 'QUANTITY'.
    ls_fcat-datatype  = 'INT4'.
    ls_fcat-intlen    = 6.
    ls_fcat-outputlen = 6.
    ls_fcat-coltext   = 'Qty'.
    ls_fcat-edit      = 1.
    APPEND ls_fcat TO pt_fieldcat.
    CALL METHOD cl_alv_table_create=>create_dynamic_table
                 EXPORTING
                    it_fieldcatalog = pt_fieldcat
                 IMPORTING
                    ep_table = new_table.
    * assign ref variable  to a field symbol
    ASSIGN new_table->* TO <dyn_table>.
    * Create dynamic work area and assign to FS
    CREATE DATA new_line LIKE LINE OF <dyn_table>.
    ASSIGN new_line->* TO <dyn_wa>.
    * data_itab is filled with data that you want in grid
    LOOP AT data_itab INTO data_wa.
      CLEAR <dyn_wa>.
      ASSIGN COMPONENT 'MATERIAL' OF STRUCTURE <dyn_wa> TO <fs>.
      <fs> = data_wa-material.
      ASSIGN COMPONENT 'QUANTITY' OF STRUCTURE <dyn_wa> TO <fs>.
      <fs> = data_wa-quantity.
      APPEND <dyn_wa> TO <dyn_table>.
    ENDLOOP.
    CALL METHOD g_grid->set_table_for_first_display
        EXPORTING
          i_structure_name              = '<DYN_TABLE>'
          is_variant                    = gs_variant
          i_save                        = 'A'
          i_default                     = 'X'
          is_layout                     = gs_layout
          it_toolbar_excluding          = gt_exclude
        CHANGING
          it_outtab                     = <dyn_table>
          it_fieldcatalog               = pt_fieldcat[]
          it_sort                       = gt_sort[].

  • Alv grid - call transaction 'ME22N' and reflect the change made in alv grid

    Hi,
    <u>Scenario</u>
    I have an alv list which has fields Purchase document no. (EBELN) and Item delivery date (EINDT). EBELN field is hot spot enabled. when i click on that transaction 'ME22' is called. I have done this using USER_COMMAND subroutine.the code is given.
          FORM USER_COMMAND                                             *
    Call transaction ME22N on clicking Document number                 *
    FORM USER_COMMAND USING F_UCOMM LIKE SY-UCOMM
                    I_SELFIELD TYPE SLIS_SELFIELD.
      DATA: F_SUBRC LIKE SY-SUBRC,
            s_arseg like G_T_PORD. "the internal table used is G_T_PORD
      CASE F_UCOMM.
        WHEN '&IC1'.
          IF i_selfield-fieldname = 'EBELN'.
            READ TABLE G_T_PORD INDEX i_selfield-tabindex INTO s_arseg.
            SET PARAMETER ID 'BES' FIELD s_arseg-ebeln.
            CALL TRANSACTION 'ME22N' AND SKIP FIRST SCREEN.
          ENDIF.
      ENDCASE.
    endform.
    <u>Requirement</u>
    After calling the transaction, If the user changes the Item delivery date (EINDT) at the ME22 transaction screen, the new date needs to be reflected in the ALV grid.
    Plz help it is very urgent.

    The first method (using selfield-refresh = 'X'.) didn't work as the internal table doesnt get modified when the user make changes in Item delivery date(EINDT) at ME22 transaction screen. The 2nd method is OO,which can't be used in my case.
    I tried calling the subroutine for populating the itab (G_T_PORD) and the subroutine for displaying the alv grid immediately after calling ME22N transaction. Still it is not reflecting the new date in the output alv. The code is given below.
          FORM USER_COMMAND                                             *
    Call transaction ME22N on clicking Document number                 *
    FORM USER_COMMAND USING F_UCOMM LIKE SY-UCOMM
                    I_SELFIELD TYPE SLIS_SELFIELD.
      DATA: F_SUBRC LIKE SY-SUBRC,
            s_arseg like G_T_PORD.
      CASE F_UCOMM.
        WHEN '&IC1'.
          IF i_selfield-fieldname = 'EBELN'.
            READ TABLE G_T_PORD INDEX i_selfield-tabindex INTO s_arseg.
            SET PARAMETER ID 'BES' FIELD s_arseg-ebeln.
            CALL TRANSACTION 'ME22N' AND SKIP FIRST SCREEN.
          ENDIF.
      ENDCASE.
            refresh G_T_PORD.
            perform F1000_POPULATE_PO.
            perform F2000_DISPLAY_PO .
    endform.

  • Change/Display in ALV Grid

    Hello All,
    I am using FM 'REUSE_ALV_GRID_DISPLAY'.  It is required that when the user presses a button on the screen, that a few fields toggle from display mode to changed mode.  I know that setting the input and edit fields to X for the field catalog table will allow a user to change the table but only on the initial display of the grid.  Does anyone know how I toggle between the change and display mode of the ALV grid?  Thanks for your help in advance.
    John

    Hello Ashish,
    I am setting V_SELFIELD-REFRESH = 'X' in my program.  I debugged it and found that the sy-subrc is 1 after it passes the FM REUSE_ALV_LIST_LAYOUT_INFO_GET.  Do you have any idea as to why this would be 1 and not 0?  This is my code so far:
          CALL FUNCTION 'REUSE_ALV_LIST_LAYOUT_INFO_GET'
           IMPORTING
             ET_FIELDCAT                      = int_fcat[]
          TABLES
            ET_OUTTAB                        = itab[]
           EXCEPTIONS
             NO_INFOS                         = 1
             PROGRAM_ERROR                    = 2
             OTHERS                           = 3
          IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.

  • Changing Values on ALV Grid (using Classes)

    Hi all,
        I have ALV Grid output, on which ZMENG (Target Qty) column is editable. So user will enter in value in ZMENG column and press ENTER. Then TOTAL column should be populated with ZMENG * NETWR columns. I have tried with changing/ entering values with char data type columns like MAKTX etc.. Its working fine with them. But when I entered in value in ZMENG, the actual value which I have entered is not flowing into LS_GOOD-VALUE. For char data types its been populated with user entered values.
          Can anyone please tell why its not happening with Quantity or Currency fields.
      method handle_data_changed.
        DATA: ls_good TYPE lvc_s_modi,
              l_netwr TYPE vbap-netwr,
              l_total TYPE vbap-netwr,
              l_zmeng TYPE vbap-zmeng.
        LOOP AT er_data_changed->mt_good_cells INTO ls_good.
          CASE ls_good-fieldname.
            WHEN 'ZMENG'.
              <<<<l_zmeng = ls_good-value.>>>>
              call method er_data_changed->get_cell_value
                             exporting i_row_id = ls_good-row_id
                                       i_fieldname = 'NETWR'
                             importing e_value = l_netwr.
              l_total = l_zmeng * l_netwr.
              call method er_data_changed->modify_cell
                        exporting i_row_id = ls_good-row_id
                                  i_fieldname = 'TOTAL'
                                  i_value     = l_total.
          ENDCASE.
      ENDLOOP.
    ENDMETHOD.
    Fieldcatlog for Quantity field:
      l_fcat-tabname = 'IT_VBAP'.
      l_fcat-fieldname = 'ZMENG'.
      l_fcat-coltext = 'Qty'.
      l_fcat-outputlen = 17.
      l_fcat-edit = 'X'.
      APPEND l_fcat TO ct_fcat.
      CLEAR l_fcat.

    Hi Jaker 
    Try calling cl_gui_alv_Grid->refresh_table_display.
    refresh table display when ever the qty is changed.
    It should work.
    Venkat.

  • How to Edit the CheckBox in Classic ALV GRID Display

    Hi,
    I want to Edit the checkbox in Grid Display.
    I have one checkbox field in my internal Table,
    Code Of the Program,
    Data :
    Begin of itab occurs 0,
    CHK type C,
    MATNR like MARA-MATNR,
    end of itab.
    Iam building the fieldcatelog using Merge Funcion module.
    After that I am chaning the properties of the field
    catelog like below,
    loop at I_FCAT assigning <FCAT>.
    Case <FCAT>-Fieldname
    When 'CHK'.
    <FCAT>-Checkbox = 'X'.
    <FCAT>-INPUT = 'X'.
    I dont have edit option in fieldcatelog.
    modify I_FCAT from <FCAT>.
    endcase.
    endloop.
    In the Layout,
    I_LAYOUT-box_fieldname = 'CHK'.
    I_LAYOUT-box_tabname = 'ITAB'.
    It is displaying the Checkbox field.but I couldnt edit the checkBox.
    I can able to edit in REUSE_ALV_LIST_DISPLAY.
    But I  have to use REUSE_ALV_GRID_DISPLAY.How to edit the checkbox.
    Thanks in Advance,
    Sumithra

    Hi vasu,
    The below procedure explains you to create a checkbox cloumn in the grid and allows you to edit i hope this will helps u.
    The ALV Grid Control displays the cells of a column as checkboxes if the column is marked as a checkbox column in the field catalog.
    •     Add another field to the output table in which you want to display checkboxes
    OR
    •     Define an existing field as a checkbox.
    Procedure
    1.     Add a field to your output table:
    Data: gt_fieldcat type lvc_t_fcat.
    Types: begin of gs_outtab.
    Types: checkbox type c. "field for checkbox
    Include structure <ABAP Dictionary structure> .
    Types: end of gs_outtab.
    Data: gt_outtab type gs_outtab occurs 0 with header line.
    2 * Add an entry for the checkbox to the field catalog
    clear ls_fcat.
    ls_fcat-fieldname = 'CHECKBOX'.
    * Essential: declare field as checkbox and
    * mark it as editable field:
    ls_fcat-checkbox = 'X'.
    ls_fcat-edit = 'X'.
    * do not forget to provide texts for this extra field
    ls_fcat-coltext = text-f01.
    ls_fcat-tooltip = text-f02.
    ls_fcat-seltext = text-f03.
    append ls_fcat to gt_fieldcat.
    regards,
    venu.

  • F4 Help for Classical ALV Grid ( REUSE_ALV_GRID_DISPLAY_LVC)

    Hi All,
    We have an ABAP program that displays data using REUSE_ALV_GRID_DISPLAY_LVC. There is an editable column in the report for which we need to display F4 help. The functionality of the F4 help will completely user-defined.
    Please let me know how to provide custom F4 help for editable column in ALV.
    Thanks,
    sathish.

    Hi satish,
    Use ' F4IF_INT_TABLE_VALUE_REQUEST' function module after PROCESS ON VALUE-REQUEST event.
    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
           EXPORTING
              retfield         = 'LAND1'
    *       PVALKEY          = ' '
             dynpprog         = sy-repid
             dynpnr           = sy-dynnr
             dynprofield      = 'T_LCDETAILS-DEST_COUNTRY'
             callback_program = sy-repid
             value_org        = 'S'
           TABLES
             value_tab        = t_country
           EXCEPTIONS
             parameter_error  = 1
             no_values_found  = 2
             OTHERS           = 3.
         IF sy-subrc <> 0.
    * Implement suitable error handling here
         ENDIF.
    Regards,
    Venkat.

  • Regarding Reading contents in classical ALV

    Hi Experts,
    I have a problem in Classical ALV Grid Display.
    I donot know how to read the contents of  modified fields after the grid is displayed.ie. i will modify some cells and press a button which is defined by me then the modified contents need to be read and updated in the data base.i am not able to read those modified contents.so please help me.i am using REUSE_ALV_GRID_DISPLAY.that is my requirement.i cannot use ALV Objects.i am posting the code.please verify and help me.
    REPORT  ZMRMMO_CUSTPOCHANGE.
    *******************************TABLES***************************************
    TABLES : VBAK,   "Sales Document:Header Data.
             VBUK,   "Sales Document:Header Status And Administrative Data.
             VBAP.   "Sales Document:Item Data.
    ********************************TYPES***************************************
    INCLUDE ZPOCHANGE_DECLARATIONS.   "Include Program for declaration part.
    ****************************SELECTION SCREEN********************************
    INCLUDE ZPOCHANGE_SELSCREEN.      "Include Program for selection screen.
    ****************************INITIALIZATION**********************************
    INITIALIZATION.
    COM1 = 'Select Reject Open Sale Order Radio Button To Delete An Open Sale Order'.
    COM2 = 'Select Remove Rejection Radio Button To Undo The Delete sale Order'.
    ****************************START OF SELECTION******************************
    START-OF-SELECTION.
    *CREATE OBJECT obj1.
    PERFORM F_CUSTPOSELECTION. "Subroutine for selection of data from the tables.
    PERFORM F_BUILDFCAT.      "Subroutine To bulid a field catalog.
    *I_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
    *I_LAYOUT-BOX_TABNAME = 'I_FINAL'.
    *I_LAYOUT-BOX_FIELDNAME = 'X'.
    *APPEND I_LAYOUT.
    PERFORM F_EVENTSGET.
    IF FLAG = 'X'.
    PERFORM F_ALVGRIDDISPLAY. "Subroutine to call the ALV Grid Display Function Module inorder to display the data
    ELSE.
    EXIT.
    ENDIF.
    FORM F_POCHANGEPFSTATUS USING RT_EXTAB TYPE SLIS_T_EXTAB.
      SET PF-STATUS 'PO_CHANGE'. "EXCLUDING RT_EXTAB.
    ENDFORM.
    FORM F_POCHNGUSERCOMMAND USING R_UCOMM LIKE SY-UCOMM RS_SELFIELD TYPE SLIS_SELFIELD.
    RS_SELFIELD-REFRESH = 'X'.
    IF R_UCOMM EQ 'UPD'.
    PERFORM F_POCHANGECHECK." USING RS_SELFIELD.
    ENDIF.
    ENDFORM.
    INCLUDE ZMRMMO_CUSTPOCHANGE_F_BUILDF01.
    INCLUDE ZMRMMO_CUSTPOCHANGE_F_POPULF01.
    INCLUDE ZMRMMO_CUSTPOCHANGE_F_ALVGRF01.
    INCLUDE ZMRMMO_CUSTPOCHANGE_F_CUSTPF01.
    INCLUDE ZMRMMO_CUSTPOCHANGE_F_TESTF01.
    INCLUDE ZMRMMO_CUSTPOCHANGE_F_POCHAF01.
    INCLUDE ZMRMMO_CUSTPOCHANGE_F_EVENTF01.
    *&  Include           ZPOCHANGE_DECLARATIONS
    TYPE-POOLS : SLIS.
    TYPES :BEGIN OF TY_VBAK,
           VBELN LIKE VBAK-VBELN,
           BSTNK LIKE VBAK-BSTNK,
           KUNNR LIKE VBAK-KUNNR,
           LIFSK LIKE VBAK-LIFSK,
           GWLDT LIKE VBAK-GWLDT,
           END OF TY_VBAK,
           BEGIN OF TY_VBUK,
           VBELN LIKE VBUK-VBELN,
           LFGSK LIKE VBUK-LFGSK,
           END OF TY_VBUK,
           BEGIN OF TY_VBAP,
           VBELN LIKE VBAP-VBELN,
           LPRIO LIKE VBAP-LPRIO,
           ABGRU LIKE VBAP-ABGRU,
           END OF TY_VBAP,
           BEGIN OF TY_FINAL,
           VBELN LIKE VBAK-VBELN,
           BSTNK LIKE VBAK-BSTNK,
           KUNNR LIKE VBAK-KUNNR,
           LFGSK LIKE VBUK-LFGSK,
           LIFSK LIKE VBAK-LIFSK,
           GWLDT LIKE VBAK-GWLDT,
           LPRIO LIKE VBAP-LPRIO,
           ABGRU LIKE VBAP-ABGRU,
           END OF TY_FINAL.
    ****************************INTERNAL TABLES*********************************
    DATA :I_VBAK TYPE STANDARD TABLE OF TY_VBAK,
          I_VBUK TYPE STANDARD TABLE OF TY_VBUK,
          I_VBAP TYPE STANDARD TABLE OF TY_VBAP,
          I_FINAL TYPE STANDARD TABLE OF TY_FINAL,
          WA_VBAK TYPE TY_VBAK,
          WA_VBUK TYPE TY_VBUK,
          WA_VBAP TYPE TY_VBAP,
          WA_FINAL TYPE TY_FINAL.
    DATA : I_FCAT TYPE SLIS_T_FIELDCAT_ALV,
           I_LAYOUT TYPE SLIS_LAYOUT_ALV, "OCCURS 0,
           WA_FCAT LIKE LINE OF I_FCAT,
          WA_LAYOUT TYPE SLIS_LAYOUT_ALV,
           I_EVENTS TYPE SLIS_T_EVENT,
           WA_EVENTS LIKE LINE OF I_EVENTS,
           I_FCAT1 TYPE SLIS_T_FIELDCAT_ALV,
           WA_FCAT1 LIKE LINE OF I_FCAT1.
    *DATA : obj1 TYPE REF TO CL_GUI_ALV_GRID_BASE.
    *DATA :G_ROWNO TYPE I.
    DATA FLAG VALUE 'X'.
    *&  Include           ZPOCHANGE_SELSCREEN
    ****************************SELECTION SCREEN********************************
    SELECTION-SCREEN : BEGIN OF BLOCK SC1 WITH FRAME TITLE TEXT-000.
    PARAMETERS : P_KUNNR TYPE VBAK-KUNNR OBLIGATORY,
                 P_BSTNK TYPE VBAK-BSTNK.
    SELECTION-SCREEN : END OF BLOCK SC1.
    SELECTION-SCREEN : BEGIN OF BLOCK SC2 WITH FRAME TITLE TEXT-001.
    PARAMETERS : R_REMSET RADIOBUTTON GROUP RAD1,
                 R_CNGGAR RADIOBUTTON GROUP RAD1,
                 R_CNGDEL RADIOBUTTON GROUP RAD1,
                 R_REJSO RADIOBUTTON GROUP RAD1,
                 R_REMREJ RADIOBUTTON GROUP RAD1.
    SELECTION-SCREEN : COMMENT /1(79) COM1,
                       COMMENT /1(79) COM2.
    SELECTION-SCREEN : END OF BLOCK SC2.
    ***INCLUDE ZMRMMO_CUSTPOCHANGE_F_CUSTPF01 .
    *&      Form  F_CUSTPOSELECTION
          text
    -->  p1        text
    <--  p2        text
    FORM F_CUSTPOSELECTION .
    IF P_BSTNK IS INITIAL.
      SELECT VBELN BSTNK KUNNR LIFSK GWLDT
             FROM VBAK
             INTO TABLE I_VBAK
             WHERE KUNNR EQ P_KUNNR.
      IF SY-SUBRC <> 0.
        MESSAGE I000(YMES).
        FLAG = '0'.
      ELSE.
        SORT I_VBAK BY VBELN.
      ENDIF.
    ELSE.
      SELECT VBELN BSTNK KUNNR LIFSK GWLDT
             FROM VBAK
             INTO TABLE I_VBAK
             WHERE KUNNR EQ P_KUNNR AND
                   BSTNK EQ P_BSTNK.
      IF SY-SUBRC <> 0.
        MESSAGE I000(YMES).
        FLAG = '0'.
        ELSE.
        SORT I_VBAK BY VBELN.
      ENDIF.
    ENDIF.
    *IF I_VBAK[] IS NOT INITIAL.
    LOOP AT I_VBAK INTO WA_VBAK.
       WRITE :/    WA_VBAK-VBELN,
             10  WA_VBAK-BSTNK,
             20  WA_VBAK-KUNNR,
             30  WA_VBAK-LIFSK,
             40  WA_VBAK-GWLDT.
    ENDLOOP.
    *ENDIF.
    IF I_VBAK[] IS NOT INITIAL.
      SELECT VBELN LFGSK
             FROM VBUK
             INTO TABLE I_VBUK
             FOR ALL ENTRIES IN I_VBAK
             WHERE VBELN = I_VBAK-VBELN AND
                   LFGSK <> 'C'.
    ENDIF.
    IF SY-SUBRC <> 0.
      MESSAGE I000(YMES).
      FLAG = '0'.
    ELSE.
      SORT I_VBUK BY VBELN.
    ENDIF.
    *IF I_VBUK[] IS NOT INITIAL.
    LOOP AT I_VBUK INTO Wa_VBUK.
       WRITE :/ WA_VBUK-VBELN,
             10 WA_VBUK-LFGSK.
    ENDLOOP.
    *ENDIF.
    IF I_VBUK IS NOT INITIAL.
      SELECT VBELN LPRIO ABGRU
             FROM VBAP
             INTO TABLE I_VBAP
             FOR ALL ENTRIES IN I_VBUK
             WHERE VBELN = I_VBUK-VBELN.
    ENDIF.
    IF SY-SUBRC <> 0.
      MESSAGE I000(YMES).
    FLAG = '0'.
    ELSE.
      SORT I_VBAP BY VBELN.
    ENDIF.
    LOOP AT I_VBUK INTO WA_VBUK.
    MOVE :WA_VBUK-VBELN TO WA_FINAL-VBELN,
          WA_VBUK-LFGSK TO WA_FINAL-LFGSK.
    READ TABLE I_VBAK INTO WA_VBAK WITH KEY WA_VBUK-VBELN.
    MOVE :WA_VBAK-BSTNK TO WA_FINAL-BSTNK,
          WA_VBAK-KUNNR TO WA_FINAL-KUNNR,
          WA_VBAK-LIFSK TO WA_FINAL-LIFSK,
          WA_VBAK-GWLDT TO WA_FINAL-GWLDT.
    READ TABLE I_VBAP INTO WA_VBAP WITH KEY WA_VBUK-VBELN.
    MOVE :WA_VBAP-LPRIO TO WA_FINAL-LPRIO,
          WA_VBAP-ABGRU TO WA_FINAL-ABGRU.
    APPEND WA_FINAL TO I_FINAL.
    CLEAR WA_FINAL.
    ENDLOOP.
    ENDFORM.                    " F_CUSTPOSELECTION
    ***INCLUDE ZMRMMO_CUSTPOCHANGE_F_BUILDF01 .
    *&      Form  F_BUILDFCAT
          text
    -->  p1        text
    <--  p2        text
    FORM F_BUILDFCAT .
    PERFORM F_POPULATE_FCAT USING '1' 'VBELN' 'I_FINAL' '' '' '10' 'Sales Document' 'VBELN' 'VBAK'.
    PERFORM F_POPULATE_FCAT USING '2' 'BSTNK' 'I_FINAL' '' '' '10' 'Customer PO No.' 'BSTNK' 'VBAK'.
    PERFORM F_POPULATE_FCAT USING '3' 'KUNNR' 'I_FINAL' '' 'X' '10' 'Sold-to Party' 'KUNNR' 'VBAK'.
    PERFORM F_POPULATE_FCAT USING '4' 'LFGSK' 'I_FINAL' '' '' '1' 'Delivery Status' 'LFGSK' 'VBUK'.
    CASE 'X'.
    WHEN R_REMSET.
    PERFORM F_POPULATE_FCAT USING '5' 'LIFSK' 'I_FINAL' '' '' '2' 'Delivery BlocK' 'LIFSK' 'VBAK'.
    PERFORM F_POPULATE_FCAT USING '6' 'LIFSK' 'I_FINAL' 'X' '' '2' 'Present Delivery BlocK' 'LIFSK' 'VBAK'.
    WHEN R_CNGGAR.
    PERFORM F_POPULATE_FCAT USING '5' 'GWLDT' 'I_FINAL' '' '' '8' 'Guarantee Date' 'GWLDT' 'VBAK'.
    PERFORM F_POPULATE_FCAT USING '6' 'GWLDT' 'I_FINAL' 'X' '' '8' 'Present Guarantee Date' 'GWLDT' 'VBAK'.
    WHEN R_CNGDEL.
    PERFORM F_POPULATE_FCAT USING '5' 'LPRIO' 'I_FINAL' '' '' '2' 'Delivery Priority' 'LPRIO' 'VBAP'.
    PERFORM F_POPULATE_FCAT USING '6' 'LPRIO' 'I_FINAL' 'X' '' '2' 'Present Delivery Priority' 'LPRIO' 'VBAP'.
    WHEN R_REJSO.
    PERFORM F_POPULATE_FCAT USING '5' 'ABGRU' 'I_FINAL' '' '' '2' 'Reason For Rejection' 'ABGRU' 'VBAP'.
    PERFORM F_POPULATE_FCAT USING '6' 'ABGRU' 'I_FINAL' 'X' '' '2' 'Reason For Rejection' 'ABGRU' 'VBAP'.
    WHEN R_REMREJ.
    PERFORM F_POPULATE_FCAT USING '5' 'ABGRU' 'I_FINAL' '' '' '2' 'Reason For Rejection' 'ABGRU' 'VBAP'.
    PERFORM F_POPULATE_FCAT USING '6' 'ABGRU' 'I_FINAL' 'X' '' '2' 'Reason For Rejection' 'ABGRU' 'VBAP'.
    ENDCASE.
    ENDFORM.                    " F_BUILDFCAT
    ***INCLUDE ZMRMMO_CUSTPOCHANGE_F_EVENTF01 .
    *&      Form  F_EVENTSGET
          text
    -->  p1        text
    <--  p2        text
    FORM F_EVENTSGET .
    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    EXPORTING
       I_LIST_TYPE           = 0
    IMPORTING
       ET_EVENTS             = I_EVENTS
    EXCEPTIONS
       LIST_TYPE_WRONG       = 1
       OTHERS                = 2
    IF SY-SUBRC <> 0.
    SORT I_EVENTS BY NAME.
    ENDIF.
    *READ TABLE I_EVENTS INTO WA_EVENTS WITH KEY NAME = 'USER_COMMAND'.
    *IF SY-SUBRC = 0.
    *MOVE 'USER_COMMAND' TO WA_EVENTS-FORM.
    *MODIFY I_EVENTS FROM WA_EVENTS INDEX SY-TABIX."TRANSPORTING FORM WHERE NAME = 'WA_EVENT-NAME'.
    *ENDIF.
    READ TABLE I_EVENTS INTO WA_EVENTS WITH KEY NAME = 'LIST_MODIFY'.
    IF SY-SUBRC = 0.
    MOVE 'LIST_MODIFY' TO WA_EVENTS-FORM.
    MODIFY I_EVENTS FROM WA_EVENTS INDEX SY-TABIX.
    ENDIF.
    *READ TABLE I_EVENTS INTO WA_EVENTS WITH KEY NAME = 'PF_STATUS_SET'.
    *IF SY-SUBRC = 0.
    *MOVE 'PF_STATUS_SET' TO WA_EVENTS-FORM.
    *MODIFY I_EVENTS FROM WA_EVENTS INDEX SY-TABIX.
    *ENDIF.
    ENDFORM.                    " F_EVENTSGET
    ***INCLUDE ZMRMMO_CUSTPOCHANGE_F_ALVGRF01 .
    *&      Form  F_ALVGRIDDISPLAY
          text
    -->  p1        text
    <--  p2        text
    FORM F_ALVGRIDDISPLAY .
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
       I_CALLBACK_PROGRAM                =  SY-REPID
       I_CALLBACK_PF_STATUS_SET          = 'F_POCHANGEPFSTATUS'
       I_CALLBACK_USER_COMMAND           = 'F_POCHNGUSERCOMMAND'
      I_CALLBACK_TOP_OF_PAGE            = ' '
      I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
      I_BACKGROUND_ID                   = ' '
      I_GRID_TITLE                      =
      I_GRID_SETTINGS                   =
       IS_LAYOUT                         = I_LAYOUT
       IT_FIELDCAT                       = I_FCAT
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         = 'X'
       I_SAVE                            = 'U'
      IS_VARIANT                        =
       IT_EVENTS                         = I_EVENTS
      IT_EVENT_EXIT                     =
      IS_PRINT                          =
      IS_REPREP_ID                      =
      I_SCREEN_START_COLUMN             = 0
      I_SCREEN_START_LINE               = 0
      I_SCREEN_END_COLUMN               = 0
      I_SCREEN_END_LINE                 = 0
      I_HTML_HEIGHT_TOP                 = 0
      I_HTML_HEIGHT_END                 = 0
      IT_ALV_GRAPHICS                   =
      IT_HYPERLINK                      =
      IT_ADD_FIELDCAT                   =
      IT_EXCEPT_QINFO                   =
      IR_SALV_FULLSCREEN_ADAPTER        =
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
      TABLES
        T_OUTTAB                          = I_FINAL
    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.
    *CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DATA_GET'
    EXPORTING
       I_HEADER_TABNAME       =
       I_ITEM_TABNAME         =
    IMPORTING
      ET_FIELDCAT            =
      ET_SORT                =
    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.                    " F_ALVGRIDDISPLAY
    ***INCLUDE ZMRMMO_CUSTPOCHANGE_F_POCHAF01 .
    *&      Form  F_POCHANGECHECK
          text
    -->  p1        text
    <--  p2        text
    FORM F_POCHANGECHECK.
    ENDFORM.                    " F_POCHANGECHECK

    Hi
    I sure that there is a better way,but this one will work also...
    In PBO enter rows you will show in report to itab you define (same type)
    In PAI (after change) compare this tables (your grid table and itab with values before the change) and you will get rows which have been changed...
    REGARDS
    Yossi

  • Recording on ALV GRID

    Hi All,
    I have a requirement to update a custom field in customer (xd02) screen from a file. Xd01/xd02 are extended with custom screens. One of these screens holds a ALV grid. I have to change one of the record value. when i select a record and click on change button on Alv grid, a modal dialog box apprears, which allows me to change the value of it. Here is my concern, was not able to capture actions made on ALV grid in recording. Any suggestions...
    Thanks,
    Priya.

    Is the custom field in a custom table or has it been appended to a sttandard SAP table?
    Rob

  • Data transfer from ALV-Grid to internal table

    Hello,
    I use an editable alv-grid in my program. But the data changes in the alv-grid are not transferred back to the internal table which stores the data of the alv-grid. Is there a function I have to call to transfer the data or is there a property in the alv-grid I have to set? Thanks.
    Regards, Lars.

    Hi
    The problem is if you back from grid, the system doesn't trigger the PAI of grid, so your changing aren't moved to internal table.
    You should press some button of grid bar to update your internal table. So it should be better you insert a SAVE button in your status to update the changing.
    Max
    Message was edited by: max bianchi
    Message was edited by: max bianchi

  • ALV Grid - DATA_CHANGED_FINISHED and ROW_ID

    I am trying to modify the internal table based on a field change in an ALV grid using the DATA_CHANGED_FINISHED event. Is it possible to convert the ROW_ID from ET_GOOD_CELLS into an index for the internal data table used by the grid?

    If you want to stick to the standard insert/delete ALV functions and don't want to re-invent the wheel doing your own insert/delete funcions, you can do the following:
    In ALV event DATA_CHANGED you get parameter ER_DATA_CHANGED, which is an object of class CL_ALV_CHANGED_DATA_PROTOCOL. This class contains a public attribute called MT_ROID_FRONT, which is a table that maps any ROW ID to its corresponding index to the internal table used by the ALV object.
    All you have to do to convert the ROW ID to the corresponding intetrnal table index is:
    READ TABLE er_data_changed->mt_rowid_front TRANSPORTING NO FIELDS
               WITH KEY row_id = <put your row id variable here> BINARY SEARCH.
    After the READ TABLE, variable sy-tabix will contain the actual index to the internal table used by the ALV.
    The only thing I couldn't figure out is how do I do this conversion in the ALV event DATA_CHANGE_FINISHED, which occurs after DATA_CHANGED and only if there were no errors in the edited data (ie, if there were no entries in PROTOCOL table).
    This event receives parameter ET_GOOD_CELLS, which makes reference to ROW IDs, but since you don't get the  ER_DATA_CHANGED parameter as in ALV event DATA_CHANGED, there's no ER_DATA_CHANGED->MT_ROWID_FRONT table to use for this conversion.
    My current solution to this is to save the contents of table MT_ROID_FRONT while inside event DATA_CHANGED and use this saved table in event DATA_CHANGED_FINISHED. Since event DATA_CHANGED is always caled before DATA_CHANGED_FINISHED, everything should be alright.
    The only thing that bothers me is using a global variable (MT_ROWID_FRONT) inside a method cos it kinda violates the encapsulation principle of OOP, but...
    I hope the above helps.
    Cheers!
    Lino Lopes
    Edited by: Lino Lopes on Feb 19, 2011 4:52 PM

  • How can we find out data in an editable ALV grid has been changed or not?

    Hi Experts,
    How can we find out whether a data in an editable ALV grid has been changed or not.
    I am using the
    FM -> REUSE_ALV_GRID_DISPLAY_LVC
    for ALV display.
    I have to chekc whther data has been changed or not befor saving. if changed then only i want to
    SAVE
    . I cannot use the internal table comparison method for this purpose also i am not using OOP ALV.
    So kindly sugest me an alternative.
    Thanks and Regards,
    Shahana

    Hi,
    Thanks for your answer. I already saw this post.
    See this method.
    CALL METHOD reuse_alv_grid->check_changed_data
    IMPORTING
    e_valid = lv_check.
    This will update the internal table with the edited values. Then we can go for internal table comparison.
    But my scenario will not allow me for itab comparisons.I just want to know the ALV data has been changed or not.
    Regards,
    Shahana

  • ALV Grid: how to save changes made in an editable Grid

    Hi,
    How to save changes made bu the user in any of the editable cells in a ALV Grid?
    Regards,
    deb.

    Hi,
    If you are using the FM look at the following example code...
    data: LC_GLAY TYPE LVC_S_GLAY.
    LC_GLAY-EDT_CLL_CB = 'X'.<<<<<------
    gt_layout-zebra = 'X'.
    gt_layout-detail_popup = 'X'.
    gt_layout-colwidth_optimize = 'X'.
    call function 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    i_callback_program = i_repid
    i_callback_user_command = 'USER_COMMAND1'
    it_fieldcat = header
    is_layout = gt_layout
    i_callback_top_of_page = 'TOP-OF-PAGE1'
    i_grid_title = text-h17
    it_sort = gt_sort[]
    i_default = 'X'
    i_save = 'U'
    is_variant = gt_variant
    it_events = gt_events
    I_GRID_SETTINGS = LC_GLAY<<<<<<------
    TABLES
    t_outtab = itab.
    clear itab.
    Form USER_COMMAND1
    FORM USER_COMMAND1 USING u_ucomm LIKE sy-ucomm
    us_selfield TYPE slis_selfield."#EC CALLED
    case u_ucomm.
    when '&DATA_SAVE'.<<<<<<<<----
    This will come after the data was EDITTED and when SAVE was clicked by user in output scren.
    Here now in the final internal table(ITAB) you can find the data changed in EDIT mode.
    After this you can do manipulation what ever you want.
    Thanks.
    If this helps you reward with points.

Maybe you are looking for