Problem in editable  alv table .

hello friends ,
i am facing a problem in editable alv ,the problem is  while saving my data in internal table through editable alv one of my numeric field  is being  wrongly  updated  .
for eg :  if i am entering  '2.00 ' in the field the value updated is 0.02.
regards ,
arpit.

Dear Arpit
Please check the below code and it may very useful
TABLES: VBAK, VBAP.
TYPE-POOLS: SLIS, ICON.
DATA: BEGIN OF ITAB OCCURS 0,
      VBELN LIKE VBAK-VBELN,
      ERDAT LIKE VBAK-ERDAT,
      END OF ITAB.
DATA: BEGIN OF JTAB OCCURS 0,
      VBELN LIKE VBAP-VBELN,
      MATNR LIKE VBAP-MATNR,
      KWMENG LIKE VBAP-KWMENG,
      END OF JTAB.
DATA: TB_FCAT TYPE SLIS_T_FIELDCAT_ALV,
      WA_FCAT LIKE LINE OF TB_FCAT,
      WA_LAYOUT TYPE SLIS_LAYOUT_ALV,
      TB_EVENT TYPE SLIS_T_EVENT,
      WA_EVENT LIKE LINE OF TB_EVENT,
      TB_HEADER TYPE SLIS_T_LISTHEADER,
      WA_HEADER LIKE LINE OF TB_HEADER,
      WA_KEYINFO TYPE SLIS_KEYINFO_ALV.
CLEAR WA_FCAT.
WA_FCAT-ROW_POS = '1'.
WA_FCAT-COL_POS = '1'.
*WA_FCAT-REF_FIELDNAME  = 'VBELN'.
WA_FCAT-REF_TABNAME = 'VBAK'.
*WA_FCAT-OUTPUTLEN = '10'.
WA_FCAT-FIELDNAME = 'VBELN'.
WA_FCAT-EDIT = 'X'.
WA_FCAT-SELTEXT_M = 'DOCUMENT'.
APPEND WA_FCAT TO TB_FCAT.
CLEAR WA_FCAT.
WA_FCAT-ROW_POS = '1'.
WA_FCAT-COL_POS = '2'.
*WA_FCAT-REF_FIELDNAME  = 'ERDAT'.
WA_FCAT-REF_TABNAME = 'VBAK'.
WA_FCAT-FIELDNAME = 'ERDAT'.
*WA_FCAT-EDIT = 'X'.
WA_FCAT-SELTEXT_M = 'DATE'.
APPEND WA_FCAT TO TB_FCAT.
CASE SY-UCOMM.
  WHEN 'VBELN'.
    WA_FCAT-SELTEXT_M = 'SURENDRA'.
    MODIFY TB_FCAT FROM WA_FCAT.
ENDCASE.
SELECT VBELN ERDAT FROM VBAK INTO CORRESPONDING FIELDS OF TABLE ITAB UP TO 15 ROWS.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
   I_CALLBACK_PROGRAM                = SY-REPID
   IS_LAYOUT                         = WA_LAYOUT
   IT_FIELDCAT                       = TB_FCAT
TABLES
    T_OUTTAB                          = ITAB
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Thanks
Surendra P

Similar Messages

  • Urgent : Problem with Editable  ALV Grid  for Quantity and Currency Fields

    Hi All,
    I am using Editable ALV Grid display and have quantity and value as editable fields in the display.
    When user changes these values these values are not changing properly .
    For the quantity field the domain is MENG13 with 3 deciamal places and here  if we enter 500 it takes it as 0.500   .
    The same problem is for the currency field. Here the Domain is WERT7 with 3 decimal places.
    Here also it takes last 2 digits after decimal places by default.
    Please advice how to get proper values in this case from ALV editable fields.
    Thanks and Regards
    Harshad
    Edited by: Harshad Rahirkar on Dec 25, 2007 7:39 AM

    for all the currency field , it will display like that only.
    u have to manipulate uin program before displaying.
    if they are giving 500, in program multiply with 100 and move it to table.
    when u are getting from table, divinde and display.
    this is what I am doing.
    Reward if helpfull.

  • Problem with editable ALV

    Hi All,
    I am using the method set_table_for_first_display for ALV Editable. After entering the values on the alv screen the values are not getting reflected unless press enter or should come out of my last cell to reflect the changes.
    I have used the mc_evt_enter and mc_evt_modified.
    I need to trigger the change data event with out coming out of my last cell and pressing the enter bubtton.
    This should happen atleast while pressing the save button or as soon as we modify the value in the cell.
    Please suggest me the code to trigger this.
    Thanks & Regards,
    Raghuveer Kumar K.

    Hi,
    i HAVE ENCOUNTERED THE SAME PROBLEM BUT I DID WITH THE FOLLOWING SOLUTION.
    Add a Save button on the container and add the save functionality.
    Just add the following class methods
      CLASS-METHODS:
          handle_toolbar FOR EVENT toolbar OF cl_gui_alv_grid
          IMPORTING
            e_object ,
            handle_user_command FOR EVENT user_command OF cl_gui_alv_grid
          IMPORTING e_ucomm.
    then in implementation of the above methods declared class.
    METHOD handle_toolbar.
        DATA:
          lw_toolbar TYPE stb_button.
        CLEAR lw_toolbar.
        lw_toolbar-function = 'SAVE'.
        lw_toolbar-icon = 'ICON_DETAIL'.
        lw_toolbar-butn_type = '0'.
        lw_toolbar-text = 'SAVE'.
    APPEND lw_toolbar TO e_object->mt_toolbar.
    when user clicks save modify the internal table that contians the data.
    Regards and Best wishes.

  • Mapping Problem with 2 ALV Tables after sorting

    Hi,
    I have a context node INCIDENTS with a sub-node SUB_INCIDENTS.
    The sub-node is filled via a Supply Function.
    Both nodes are displayed in separate ALV Grids on the same view, which works pretty well.
    The only problem I face is when I try to sort one of the ALVs, then I get an error "The node specified in mapping ( SUB_INCIDENTS) could not be found ".
    I have no clue how to solve that, already tried to fill the sub-node with the ALV standard function "ON_STD_FUNCTION_AFTE", no effect.
    Does anybody can imagine what might be the reason?
    Best regards, Steffen
    Edited by: Steffen Weber on Aug 27, 2008 2:55 PM

    In general, having two ALVs for parent and then a sub node is not supported.  Here is a section from the online help that describes what happens when a sort occurs on the parent node in ALV:
    Important Exception: Sorting
    Here ALV has to use the entire dataset so that the data records can be arranged in the new order. For this purpose, the ALV component temporarily takes control of the internal data table and invalidates the corresponding context node of your application during this time. This ensures that the application cannot access the context node while the ALV component is editing the internal data table.
    Once the internal data table has been resorted, ALV rebuilds the context node, releases it again for the application, and displays the data accordingly.
    This ensures that the internal data table is never copied. This is important because large volumes of data would considerably impact performance and memory space.
    When you are planning your application, note the following side-effects of this mechanism:
    ●      When the context node is invalidated, information about current selections, and in particular the lead selection, is lost.
    ●      If your application has created subnodes for the context node, (master-detail scenario), these subnodes are lost as soon as the ALV component invalidates the context node. If the application then tries to access the subnodes, a runtime error occurs.
    Because of the invalidation that is described here, the subnode leadselection is lost and is invalidated as well. This leads to the error you are encountering.

  • Problem in editing  the table and again saving back to database through web

    hi ,
    i have created ztable and sucessfully able to display through webdynpro but my requirement is that the user should be able to select any of the record n that should be editable and after that the editable data should be saved again to data database .
    i have also alv components in methods of a view
    Create component usage for alv component
      data: l_ref_cmp_usage type ref to if_wd_component_usage.
      l_ref_cmp_usage =   wd_this->wd_cpuse_alv( ). >>>>>>errror
      if l_ref_cmp_usage->has_active_component( ) is initial.
        l_ref_cmp_usage->create_component( ).
      endif.
    Get config model
      data: l_ref_interfacecontroller type ref to iwci_salv_wd_table .
      l_ref_interfacecontroller = wd_this->wd_cpifc_alv( ).>>>>>error
      data: l_value type ref to cl_salv_wd_config_table.
      l_value = l_ref_interfacecontroller->get_model( ).
    set visible row count
    l_value->if_salv_wd_table_settings~set_visible_row_count( '5' ).
    Sort rows by seatsocc descending
    data: lr_field  type ref to cl_salv_wd_field.
    lr_field =
       l_value->if_salv_wd_field_settings~get_field( 'SEATSOCC' ).
    lr_field->if_salv_wd_sort~create_sort_rule( sort_order =
       if_salv_wd_c_sort=>sort_order_descending ).
    Display icon in column seatsocc
      data: lr_column type ref to cl_salv_wd_column,
            lr_image     type ref to cl_salv_wd_uie_image,
            lv_icon      type string.                           "#EC NEEDED
      lr_column = l_value->if_salv_wd_column_settings~get_column(
    'SEATSOCC'
      create object lr_image.
      lr_image->set_source_fieldname( 'STATUS' ).
      lr_column->set_cell_editor( lr_image ).              "Display traffic
    *light images in column 'SEATSOCCC'
    delete column STATUS
    l_value->if_salv_wd_column_settings~delete_column( 'STATUS' ).
    set cell editor for input fields (~make colum PRICE editable)
    DATA: lr_column_settings TYPE REF TO if_salv_wd_column_settings,
    lr_input_field TYPE REF TO cl_salv_wd_uie_input_field.
    lr_column_settings ?= l_value.
    lr_column = lr_column_settings->get_column( 'MATERIAL' ).
    CREATE OBJECT lr_input_field EXPORTING value_fieldname = 'MATERIAL'.
    lr_column->set_cell_editor( lr_input_field ).
    data: lr_table_settings type ref to if_salv_wd_table_settings.
    lr_table_settings ?= l_value.
    lr_table_settings->set_read_only( abap_false ).
    here in the code >>>error i have marked  it is saying that the method  wd_cpuse_alv  is unknown even with the method wd_cpifc_alv, firstly iam uable to edit the fields , ater that i can go futher , plz give me the step by step solution as iam new to it

    Hi shaik,
        I couldn't find any problem in the code.
    Whether that is the first method you are initializing the alv model?
    Try this, Comment the whole code in that method. Activate the whole component including views and then uncomment the code.
    Regards...
    Arun.

  • Problem with Editing a Table

    Hi All,
         I am working with normal tables with one column as editable using inputfield in the context binding for that field..When i update one field of  that column depending on the lead selection all the records of the table corresponding to field are changed to that value instead of updating the that particular record.
    Can anyone give me an idea regarding this........
    Thanks in Advance.

    Hi,
      Thanks for ur reply.But here i am using one button to update the database and written logic like this.
      Data declarations.
      Elem_Node1 = Node_Node1->get_Element(  ).
      Elem_Node1->get_Static_Attributes(
        importing
          Static_Attributes = Stru_Node1 ).
    update zlalli set zid = Stru_Node1-ZID.
    this leads to update all the records with the same id.Is there any alternative way to update single record using that id.

  • Editable ALV- I need to increase curr to be 12 chars from 8 chars in o/p.

    I am getting problem in Editable ALV, I wanted to increase the currency field from 8 chars to 12 chars at the output.
    But after the output i am able to enter only eight chars.
    I want '123456789012'  but i am able to put only '12345678'.
    Plz have alook.

    hi !
    check the length of field in your data declaration
    you can set the length of o/p field in alv for that just check
    intlen or outputlen in fieldcat
    but by using these you can not update these in your internal table b'coz of your type declaration for that field

  • ALV Table - Different Search Help depending on Cell

    Hey you experts,
    For my current project I'm working on an editable ALV Table. The table has three columns and shall contain:
    1) The name
    2) The Old value
    3) The New Value
    of an item.
    The name of the item is known (e.g. Product Category, Accounting Type and so on).
    The main problem: I have/want to offer search-help to the user in the second and third column depending on the content of the first cell ==> The search help can of course differ in several rows. Example:
    NAME         OLD-VALUE         NEW-VALUE
    P.Category     Computer           Notebook
    Acc.Type.       A                            B
    The Computer field, shall have a search-help for a differnt data-type (DDIC help) than the A/B types.
    Is this possible? There should be a kind of "On-Open-F4-Help" event in which i can adjust the F4 help, which shall be used depending on the currently selected cell.
    Thanks for any help,
    greetings,
    Timo Stark

    Hey Sam,
    Yes I was able to achieve it. Create a collective search help, which includes all relevant data-elements.
    Create a search hel exit.
    Use the following code:
      IF CALLCONTROL-STEP <> 'SELONE' AND
         CALLCONTROL-STEP <> 'SELECT' AND
         " AND SO ON
         CALLCONTROL-STEP <> 'DISP'.
         EXIT.
      ENDIF.
    * STEP SELONE  (Select one of the elementary searchhelps)
    * This step is only called for collective searchhelps. It may be used
    * to reduce the amount of elementary searchhelps given in SHLP_TAB.
    * The compound searchhelp is given in SHLP.
    * If you do not change CALLCONTROL-STEP, the next step is the
    * dialog, to select one of the elementary searchhelps.
    * If you want to skip this dialog, you have to return the selected
    * elementary searchhelp in SHLP and to change CALLCONTROL-STEP to
    * either to 'PRESEL' or to 'SELECT'.
      DATA: lv_line LIKE LINE OF SHLP_TAB,
            lv_line_tmp LIKE LINE OF SHLP_TAB.
      DATA lv_current_context_element TYPE REF TO IF_WD_CONTEXT_ELEMENT.
      DATA lv_parent_data TYPE /SIE/SRM_FYC_CHANGE.
      DATA:lv_current_node TYPE REF TO IF_WD_CONTEXT_NODE,
           lv_index TYPE i.
      IF CALLCONTROL-STEP = 'SELONE'.
        lv_current_context_element = CL_WDR_VALUE_HELP_HANDLER=>M_CONTEXT_ELEMENT.
        lv_current_node = lv_current_context_element->get_node( ).
        lv_index = lv_current_context_element->get_index( ).
        lv_current_node->get_static_attributes( exporting index = lv_index importing static_attributes = lv_parent_data ).
        "switch over parent data..
        CASE lv_parent_data-type.
          WHEN 10.
            "cost center
            lv_line-SHLPNAME = 'BBP_F4_COST_CTR'.
          WHEN 3.
            lv_line-SHLPNAME = 'COM_CAT'.
          WHEN OTHERS.
            lv_line-SHLPNAME = ''.
            callcontrol-step = 'EXIT'.
            EXIT.
         ENDCASE.
         LOOP AT shlp_tab INTO lv_line_tmp.
            IF lv_line_tmp-shlpname <> lv_line-shlpname.
              DELETE TABLE shlp_tab FROM lv_line_tmp.
              CONTINUE.
            ENDIF.
         ENDLOOP.
         callcontrol-step = 'PRESEL'.
        EXIT.
      ENDIF.
    * STEP PRESEL  (Enter selection conditions)
    * This step allows you, to influence the selection conditions either
    * before they are displayed or in order to skip the dialog completely.
    * If you want to skip the dialog, you should change CALLCONTROL-STEP
    * to 'SELECT'.
    * Normaly only SHLP-SELOPT should be changed in this step.
      IF CALLCONTROL-STEP = 'PRESEL'.
    *   PERFORM PRESEL ..........
        EXIT.
      ENDIF.
    * STEP SELECT    (Select values)
    * This step may be used to overtake the data selection completely.
    * To skip the standard seletion, you should return 'DISP' as following
    * step in CALLCONTROL-STEP.
    * Normally RECORD_TAB should be filled after this step.
    * Standard function module F4UT_RESULTS_MAP may be very helpfull in this
    * step.
      IF CALLCONTROL-STEP = 'SELECT'.
    *   PERFORM STEP_SELECT TABLES RECORD_TAB SHLP_TAB
    *                       CHANGING SHLP CALLCONTROL RC.
    *   IF RC = 0.
    *     CALLCONTROL-STEP = 'DISP'.
    *   ELSE.
    *     CALLCONTROL-STEP = 'EXIT'.
    *   ENDIF.
        EXIT. "Don't process STEP DISP additionally in this call.
      ENDIF.
    * STEP DISP     (Display values)
    * This step is called, before the selected data is displayed.
    * You can e.g. modify or reduce the data in RECORD_TAB
    * according to the users authority.
    * If you want to get the standard display dialog afterwards, you
    * should not change CALLCONTROL-STEP.
    * If you want to overtake the dialog on you own, you must return
    * the following values in CALLCONTROL-STEP:
    * - "RETURN" if one line was selected. The selected line must be
    *   the only record left in RECORD_TAB. The corresponding fields of
    *   this line are entered into the screen.
    * - "EXIT" if the values request should be aborted
    * - "PRESEL" if you want to return to the selection dialog
    * Standard function modules F4UT_PARAMETER_VALUE_GET and
    * F4UT_PARAMETER_RESULTS_PUT may be very helpfull in this step.
      IF CALLCONTROL-STEP = 'DISP'.
    *   PERFORM AUTHORITY_CHECK TABLES RECORD_TAB SHLP_TAB
    *                           CHANGING SHLP CALLCONTROL.
        EXIT.
      ENDIF.
    greetings

  • Web dynpro abap - Editable alv - check row

    Hi, I'm working with an editable ALV table and I'd like to check wether the row the user has just entered is valid.
    IF the entered row is not valid, then it should disappear from the table.
    ATM i'm trying something out in WDDOMODIFYVIEW,

    Hi,
    Yes you have to do coding in WDDOMODIFYVIEW only.

  • Editable ALV Standard buttons!! (bug or feature)

    Hi All,
    I have a little problem with editable alv. I couldn't catch the Standard editable alv buttons' events. ( Buttons: <b>Append Row, Delete Rows, Copy rows, Add new row</b>.)
    I would like to write a short code at <i>before_user_command</i> event, when the user press the add new line button on alv grid.
    When I press an other button (for.e. : Refresh ) on ALV I can catch the events.
    Why don't work this solution these 4 buttons?  It is a BUG? or a feature ?
    Can anyone sent me a short example about the best solution of this problem?
    THX.
    mike

    I haven't been able to achieve that myself...Only solution found for Append Row what to use this event...
          handle_data_finished
          FOR EVENT data_changed_finished OF cl_gui_alv_grid
          IMPORTING e_modified
    Greetings,
    Blag.

  • Problem with Foreign Key check in an editable ALV

    Hi,
    I've implemented an editable ALV.
    The underlying context node is referenced to a structure and within the structure the foreign keys are defined.
    In my example, I have two editable columns with different foreign key checks.
    My problem is, the foreign key check works only for one column.
    So if I enter in both columns incorret values, only a message for the first column is thrown,
    but not for the second column!
    Only if I enter two errors in one(!) column (in two rows), than I get two error messages.
    Examples:
    does not work:
    COL1 | COL2
    err1  | err2   -> only one error message is displayed (for err1)
    It works in this case:
    COL1 | COL2
    err1  |  ok
    err2  |  ok
    => two messages for err1 and err2
    and in this case
    COL1 | COL2
    err1  |  ok
    ok     |  err2
    => two messages for err1 and err2
    I've found nothing in OSS. My system is a 7.00 with SP18, so OSS 1153492 is already implemented.
    Do I somenthing wrong or is this an error in SAP?
    Thanks,
    Andreas

    Hi Lekha,
    thank you very much for your support!
    I try to give you an example.
    In general, you need an editable ALV with at least two columns.
    The node for the ALV table in the component controller has to be assigned to a dictionary structure!
    That is very important, otherwise the foreign key check will not work!
    And the two fields in this dictionary structure have to be assigned to a "check table".
    Prerequisition: NW70 SP16 or higher! See oss note 1153492.
    Maybe an easy way to reproduce it is using the WD component WDT_FLIGHTLIST_EDIT.
    So copy this component to a Z-component.
    Than create a dictionary structure for the node "NODE_FLIGHTTAB" with the same 10 fields as the node attributes.
    In your new dictionary structure, assign to the fields CARRID and CONNID the check tables SCARR and SPFLI. (see table SFLIGHT).
    Than make both columens (CARRID and CONNID) editable.
    This has to be done in the "RESULTVIEW" in the method "INIT".
    You can user the following code:
      lr_column = lr_column_settings->get_column( 'CARRID' ).
      create object lr_input_field
        exporting
          value_fieldname = 'CARRID'.
      lr_column->set_cell_editor( lr_input_field ). 
      lr_column = lr_column_settings->get_column( 'CONNID' ).
      create object lr_input_field
        exporting
          value_fieldname = 'CONNID'.
      lr_column->set_cell_editor( lr_input_field ).
    Copy this code below this code:
      lr_column_settings ?= l_value.
      lr_column = lr_column_settings->get_column( 'PRICE' ).
      create object lr_input_field
        exporting
          value_fieldname = 'PRICE'.
      lr_column->set_cell_editor( lr_input_field ).
    Than just activate all,  create a Web Dynpro Application and your are ready to test it.
    To test it, do the following:
    Append/Insert an empty row.
    Enter a CARRID and CONNID that does not exist and press ENTER.
    My result: only one error message is displayed for the wrong CARRID, but no error message for CONNID!
    Insert a new row.
    Enter in the first row, column CARRID an invalid value and in the second(!) row in column CONNNID.
    Than you get two(!) error messages. That's the behavior I expect.
    So thank you very much in advance for your help!
    Regards,
    Andreas

  • Problem While Saving the editable ALV GRID

    Dear Experts,
    I have a scenario in which i am display the ALV(using class) with some data in the custom container of module pool screen in the non-editable mode.Also i have save and edit buttons.If i click the edit button i have written the code to edit the some columns in the ALV grid, it is working fine.After editing it,when i click the save button then ALV has to refreshed with edited data and then it should go to non editable mode but it is not working.I have written the code for changing the editable ALv to non editable mode as follows :
      call method c_alvgd->set_ready_for_input
        exporting
          i_ready_for_input = 0.
    *****Row and column of the alv are refreshed after changing values
      stable-row = 'X'.
      stable-col = 'X'.
    *REfreshed ALV display with the changed values
    *This ALV is non editable and contains new values
      call method c_alvgd->refresh_table_display
        exporting
          is_stable = stable
        exceptions
          finished  = 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.
    Could you Suggest me solution for this issue ?
    Thanks & Regards,
    R.Dhineshraj.

    Dhinesh,
    I suppose that you are able to get your changes values on screen but not able to get your field in DISPLAY mode from editable mode, let me know if this is not your problem.
    When you press SAVE, after the PAI, again PBO will run and hence the editable code for that field will overwrite which will keep it editable.
    So, do something like this.
    data: gv_edit value 'X'.....  "global variable in TOP include
    PBO....
    loop at ...
    if gv_edit = 'X'.
    CALL METHOD lo_alv->set_ready_for_input
      EXPORTING
        i_ready_for_input = 1.
    else.
    CALL METHOD lo_alv->set_ready_for_input
      EXPORTING
        i_ready_for_input = 0.
    endif.
    endloop.
    PAI.
    when 'SAVE'.
    gv_edit =  space.
    When 'EDIT'.
    gv_edit = 'X'.
    Regards,
    Diwakar

  • Get data in editable ALV back to internal table without data_changed ev?

    Hi,
       I have an editable ALV using classes to whch I have users the option to edit directly on the screen or upload data from an excel. The event data_changed gets triggered when users edit the table on the screen.
    However when EXCEL is uploaded, I refresh the table display. So, I need a way to get the data from the ALV into a internal table to check which rows were update using the excel and save them into the db table.
    Prakash

    Hi!
    For more information, inspect programs suiting the mask "BCALVEDIT*" and the thread with header "How to make a row of ALV editable " (I know this is some more steps further from your demand but it may be useful) at URL " How to make a row of ALV editable " .
    If you want to study more BC412 "EnjoySAP Controls" may help you.
    *--Serdar

  • How To Edit Selected Row In ALV Table

    Hello Experts,
    In My Webdynpro Application, I am displaying records from database table into an ALV Table.
    I want to edit only selected record from  ALV table.
    Please Suggest How to achieve this.
    Thanks,
    Pratibha

    The link given above is for the UI element 'Table' and does not pertain to ALV.
    To Make an ALV Editable on lead selection for that particular lead selected row.
    1. The ALV should be made lead selectable, when initializing
    2. The ON_LEAD_SELECT function should be invoked.
    3. Withing this function the index has to be retrieved to know which row was selected.
    4. Based on the index retrived all the columns have to pass FALSE to read_only in the column properties.
    Regards,
    Pramod

  • In Alv table, a column is editable mode, but want few cells in read only

    Hi All,
    I have a ALV table which column A and B.
    Both are in editable mode. I want to make fews in column B, to be read only.
    How to make it. Please help me.
    Thanks
    Vimalraj

    hi,
    refer this program,
    *& Report  ZALV_COLOR_DISPLAY_EDIT
    REPORT  zalv_color_display_edit.
    TYPE-POOLS: slis.
    TABLES : zcust_master2.
    INTERNAL TABLE DECLARATION
    TYPES : BEGIN OF wi_zcust_master2,
            zcustid LIKE zcust_master2-zcustid,
            zcustname LIKE zcust_master2-zcustname,
            zaddr LIKE zcust_master2-zaddr,
            zcity LIKE zcust_master2-zcity,
            zstate LIKE zcust_master2-zstate,
            zcountry LIKE zcust_master2-zcountry,
            zphone LIKE zcust_master2-zphone,
            zemail LIKE zcust_master2-zemail,
            zfax LIKE zcust_master2-zfax,
            zstat LIKE zcust_master2-zstat,
            field_style  TYPE lvc_t_styl,
    END OF wi_zcust_master2.
    DATA: it_wi_zcust_master2 TYPE STANDARD TABLE OF wi_zcust_master2
                                                     INITIAL SIZE 0,
          wa_zcust_master2 TYPE wi_zcust_master2.
    *ALV data declarations
    DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE.
    DATA: it_fieldcat TYPE lvc_t_fcat,     "slis_t_fieldcat_alv WITH HEADER
    line,
          wa_fieldcat TYPE lvc_s_fcat,
          gd_tab_group TYPE slis_t_sp_group_alv,
          gd_layout    TYPE lvc_s_layo,     "slis_layout_alv,
          gd_repid     LIKE sy-repid.
    START-OF-SELECTION.
      PERFORM data_retrieval.
      PERFORM set_specific_field_attributes.
      PERFORM build_fieldcatalog.
      PERFORM build_layout.
      PERFORM display_alv_report.
    *&      Form  BUILD_FIELDCATALOG
          Build Fieldcatalog for ALV Report
    FORM build_fieldcatalog.
      wa_fieldcat-fieldname   = 'ZCUSTID'.
      wa_fieldcat-scrtext_m   = 'CUSTOMER ID'.
      wa_fieldcat-col_pos     = 0.
      wa_fieldcat-outputlen   = 10.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'ZCUSTNAME'.
      wa_fieldcat-scrtext_m   = 'CUSTOMER NAME'.
      wa_fieldcat-col_pos     = 1.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'ZADDR'.
      wa_fieldcat-scrtext_m   = 'ADDRESS'.
      wa_fieldcat-col_pos     = 2.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'ZCITY'.
      wa_fieldcat-scrtext_m   = 'CITY'.
      wa_fieldcat-col_pos     = 3.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'ZSTATE'.
      wa_fieldcat-scrtext_m   = 'STATE'.
      wa_fieldcat-col_pos     = 4.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'ZCOUNTRY'.
      wa_fieldcat-scrtext_m   = 'COUNTRY'.
      wa_fieldcat-col_pos     = 5.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'ZPHONE'.
      wa_fieldcat-scrtext_m   = 'PHONE NUMBER'.
      wa_fieldcat-col_pos     = 6.
    wa_fieldcat-edit        = 'X'. "sets whole column to be editable
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'ZEMAIL'.
      wa_fieldcat-scrtext_m   = 'EMAIL'.
      wa_fieldcat-edit        = 'X'. "sets whole column to be editable
      wa_fieldcat-col_pos     = 7.
      wa_fieldcat-outputlen   = 15.
      wa_fieldcat-datatype     = 'CURR'.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'ZFAX'.
      wa_fieldcat-scrtext_m   = 'FAX'.
      wa_fieldcat-col_pos     = 8.
      wa_fieldcat-edit        = 'X'. "sets whole column to be editable
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'ZSTAT'.
      wa_fieldcat-scrtext_m   = 'STATUS'.
      wa_fieldcat-col_pos     = 9.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
    ENDFORM.                    " BUILD_FIELDCATALOG
    *&      Form  BUILD_LAYOUT
          Build layout for ALV grid report
    FORM build_layout.
    Set layout field for field attributes(i.e. input/output)
      gd_layout-stylefname = 'FIELD_STYLE'.
      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'
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
        EXPORTING
          i_callback_program = gd_repid
          is_layout_lvc      = gd_layout
          it_fieldcat_lvc    = it_fieldcat
          i_save             = 'X'
        TABLES
          t_outtab           = it_wi_zcust_master2
        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
          text
    -->  p1        text
    <--  p2        text
    FORM data_retrieval .
      DATA: ld_color(1) TYPE c.
      SELECT zcustid zcustname zaddr zcity zstate zcountry zphone zemail
    zfax zstat UP TO 10 ROWS FROM zcust_master2 INTO CORRESPONDING FIELDS OF
    TABLE it_wi_zcust_master2.
    ENDFORM.                    "data_retrieval
    *&      Form  set_specific_field_attributes
          populate FIELD_STYLE table with specific field attributes
    FORM set_specific_field_attributes .
      DATA ls_stylerow TYPE lvc_s_styl .
      DATA lt_styletab TYPE lvc_t_styl .
    Populate style variable (FIELD_STYLE) with style properties
    The following code sets it to be disabled(display only) if 'ZFAX'
    is NOT INITIAL.
      LOOP AT it_wi_zcust_master2 INTO  wa_zcust_master2.
        IF  wa_zcust_master2-zfax IS NOT INITIAL.
          ls_stylerow-fieldname = 'ZFAX' .
          ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled.
                                          "set field to disabled
          APPEND ls_stylerow  TO  wa_zcust_master2-field_style.
          MODIFY it_wi_zcust_master2  FROM  wa_zcust_master2.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    "set_specific_field_attributes
    Regards,
    K.Tharani.

Maybe you are looking for

  • Details of A/C at the time of Goods receipt an IR

    hi please give details of accounts hits in following cases Ex:Po price:100 Excise duty:10 cess:2 1.what all accounts hits with Debit or credit indicator at the time of GR. 2.what all the a/cs hits at the time of posting J1iex. 3.what all the accounts

  • Want more robust form fields in InDesign for PDF forms.

    I wish that soon InDesign CS6 Interactive Form Fields will include the COMB field for entering data in various formats such as phone numbers, credit card numbers, using some sort of format like [number of characters] ["(nnn) nnn-nnnn"]. I use comb fi

  • Standby database unable to fetch missing archive sequence from primary

    Hi, My primary oracle db version is 10.2.0.5 which is n Windows 2003 server 32 bit in file system My standby database version is 10.2.0.5 which in wondows 2008 server in ASM instance. some of the archivelogs are not fetching by standby database from

  • Startup Error Message

    Ive had my Ibook G4 for awhile now, and never had a problem like this. This happened out of the blue. I started it up today and I get a big error message in the middle of the screen. It has a power button in the middle of it and says "You need to res

  • Unlock iPad 4 (WiFi + Cellular)

    Apple offers unlocked iPhone through its online store webpage. But, iPad is only provided with those 3 carriers. Is there any factory unlocked model or I must use other tricks to make it work?