Validation of column fields while entering values in editable ALV

Hi,
I am currently working on a ALV,I have to validate the editable field of ALV,while entering values.SO if there is a field Item number,the range should be between M01-M99,and user should not take any value other than the F4 help assigned to the field.Can all this calculation be done using a FM & Not OOPs process for making ALV.
Please advice.
Thanks.

>
p317980 wrote:
> REF_TABNAME    LIKE DD03P-TABNAME,
> Will the field just pick values from the F4 & not any random value entered by user?
>>yes.
> if these values entered at runtime need to be saved into a Ztable,will I have to use Classes for defining my ALV?
>>write some code to check if the entry exists.. if not then update the Ztable..
>>select single field from table. if sy-subrc eq 0. fine else. update ztable.if.

Similar Messages

  • Retrieve front end values of editable alv in same format

    I have a problem to retrieve the front end values in editable alv filled by user.
    I am able to get it from MODIFIED CELL method but it gives the values after
    alv automatically conversion. For example if user filled 1 in cell of type numc
    then i want to keep it as 1 not as 00..001 format of numc.
    Same for when user fill alphbets in small letter the alv convert it in CAPS.
    I want to retain it as it as filled by user.
    Example: User filled aAbBcFG in a cell
    then it should update in database in same format not like AABBCFG as alv did
    <offer removed by moderator>
    Edited by: Rocky_S on Jan 20, 2011 7:50 AM
    Edited by: Rocky_S on Jan 20, 2011 7:51 AM
    Edited by: Thomas Zloch on Jan 20, 2011 11:24 PM

    Hi Srinivas I have used CONVERSION_EXIT_ALPHA_OUTPUT for number input. My problem is that
    when user fill 0 in the alv cell then alv automatically convert it into 00000000. My field is of type numc
    that why it converts in 00000000. I want to retrieve it as the user fill in alv cell. Through this function
    module the import parameter parameter is of numc format not as filled by user. In my case if it is 0
    then then i should retrieve it as it is.
    My actual scenario is i have a numc type field in alv and i want to keep it as mandatory. For which i am
    writing a logic. Because in my table there is a valid entry of 0. If user do not fill 0 then it takes automatically
    0 as input because of initial value of numc field. I want to restict it. I can not convert this field as char.
    Give me some logic to make numeric field mandatory.

  • Unable to enter value in editable field of ALV (set_current_cell_via_id)

    In the Editable screen of ALV, I have to set the cursor on the 3rd field 'VBELN' ( which is editable ).
    Using the method set_current_cell_via_id of ALV grid the focus has been set on the particular field. The field Sales order 'VBELN' is already set as editable (EDIT = 'X').
    But still I am unable to enter values unless and until I click anywhere on the screen.
    Please help me with the solution.
    Thanks in Advance.

    No...Whenever my screen is called, the focus is set on the 'VBELN' field but I can not enter the value.
    See the code below:
    Display the ALV report.
          CALL METHOD grf_alv_popup->set_table_for_first_display
            EXPORTING
              is_layout                     = gs_layout
              it_toolbar_excluding          = gt_exclude
            CHANGING
              it_outtab                     = fp_output[]
              it_fieldcatalog               = gt_fieldcat_popup
            EXCEPTIONS
              invalid_parameter_combination = 1
              program_error                 = 2
              too_many_lines                = 3
              OTHERS                        = 4.
          IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
    ls_row-row_id = 1.
    ls_col-fieldname = 'VBELN'.
          CALL METHOD grf_alv_popup->set_current_cell_via_id
            EXPORTING
              is_column_id = ls_col
              is_row_no    = ls_row.
    With the method set_current_cell_via_id, the field VBELN displays as highlighted but to enter the value I need to click on the screen first.

  • Short dump SAVE_NOT_ALLOWED while using CL_GUI_ALV_GRID in editable ALV

    I created an editable ALV field and when i changed the value in that field and click tab  or enter, then i am getting a shortdump. This is not happening regularly.
    can anyone let me know the reason for this.
    Sharath.

    Hi
    Set the handlers for the events DATA_CHANGED and DATA_CHANGED_FINISHED for your grid and handles changes in these methods accordingly.
    *...local class definition
                        for event data_changed of cl_gui_alv_grid
                        importing er_data_changed,
                        handle_data_changed_finished
                        for event data_changed_finished of cl_gui_alv_grid
    *...display the grid
        call method grid1->set_table_for_first_display
          exporting
            i_bypassing_buffer   = abap_true
            i_structure_name      = viewname
            is_print                      = gs_print
            is_layout                   = gs_layout
            it_toolbar_excluding = i_exclude
            i_save                      = 'A'
          changing
            it_outtab                   = <i_itab>
            it_fieldcatalog           = gt_fieldcat.
        if sy-subrc ne 0.
          exit.
        endif.
        set handler handle_double_click
                    handle_button_click
                    handle_user_command
                    handle_data_changed
                    handle_data_changed_finished
                    handle_onf4
                    handle_toolbar
                    for grid1.
    regards
    Isaac Prince

  • When i press enter on my editable ALV nothing happens - Why?

    Hi,
    i have an editable alv on an tabstrip and when i press enter after changes nothing happens, although i have programmed check_changed_data.
    That´s not normal, or? Mayby somebody can give me a hint.
    Timo

    Hi,
    After changing the data use the following method to refresh the table.
        CALL METHOD W_GRID1->REFRESH_TABLE_DISPLAY.
    If it solves your problem dont forget to reward me points.
    Regards,
    --Suman

  • SharePoint 2013: Hide/Show Column fields while uploading document in Document Library

    Dear all,
    I have created a document Library LIB001 and I have created One Column of type Choice, drop down list, (CCHOICE) and I have created 3 other columns, (Column1, Column2, Column3).
    What I want is while uploading a file in the document library, when I choose a certain value from CCHOICE, i want to show/hide and/or make the column mandatory.
    Can anyone help/guide me how to achieve this?
    Many Thanks
    Vinay

    Dear all, I am trying the following code, but it's not entering the onchange of drop down list event. <script> $(document).ready(function () { var countryField = SPUtility.GetSPField('Document Type'); var countryFieldValue = countryField.GetValue(); alert
    (countryFieldValue); // ----- Hide/Show the field based on new selected value. var id = SPUtility.GetSPField('Document Type').Dropdown.id; alert ('field ID: '+id); $('#' + id).on('change', function () { alert ('Inside on Change:'+countryFieldValue); if (countryFieldValue
    == 'Type1') { SPUtility.GetSPField('Column1').Hide(); } else if (countryFieldValue == 'Type2') { SPUtility.GetSPField('Column2').Hide(); } }); }); </script> Can anyone help me please. Many Thanks & Regards Vinay

  • Error while entering values in table.

    Hi All,
    I have a quantity field in table having data type as dec and length as 13 and decimal places as 5.
    But when i enter 255 in table,it automatically changes to .255 but it should be 255.
    Thanks and Regards,
    Amanpreet Sehgal

    hi
    check this one
    For calculations in business applications, use packed numbers. The program attribute Fixed point arithmetic affects calculations using packed numbers.
    If the program attribute Fixed point arithmetic is not set, type P fields are interpreted as integers without decimal places. The decimal places that you specify in the DECIMALS addition of the TYPES or DATA statement only affect how the field is formatted in the WRITE statement.
    DATA: PACK TYPE P DECIMALS 2.
    PACK = '12345'.
    WRITE PACK.
    If the program attribute Fixed point arithmetic is not set, the output is as follows:
    123.45
    If the program attribute Fixed point arithmetic is set, the output is as follows:
    12,345.00
    If the Fixed point arithmetic attribute is set, the decimal places are also taken into account in arithmetic operations. Calculations with packed numbers in ABAP use the same arithmetic as a pocket calculator. Intermediate results are calculated using up to 31 digits (before and after the decimal point). You should therefore always set the Fixed point arithmetic attribute when you use type P fields.
    DATA: PACK TYPE P.
    PACK = 1 / 3 * 3.
    WRITE PACK.
    If you have not set the Fixed point arithmetic attribute, the result is 0, since the calculation is performed using integer accuracy, and the result is therefore rounded internally to 0.
    If the program attribute Fixed point arithmetic is set, the result is 1 because the result of the division is stored internally as 0.333333333333333333333333333333 with an accuracy of up to 31 digits.

  • Validating if a field has changed value

    I have a custom field: Oportunity Number. This number will be generated for new Opts. by a web service.
    I am trying to validate if a user tries do change or delete this number with editing.
    I am using:
    FieldValue('<nNmero_Oport_ITAG>') = PRE('<nNmero_Oport_ITAG>')
    and it seems to be working fine for changes. OTH if the user just blanks out the field, above expression is not catching it...
    I´d appreciate any help.
    Txs.
    Antonio

    Just a guess. You can also try
    FieldValue('<nNmero_Oport_ITAG>') = PRE('<nNmero_Oport_ITAG>')
    OR [<nNmero_Oport_ITAG>] IS NOT NULL
    Thanks VK

  • To hide a button in a column field depending on the condition in ALV

    Hai,
    I have a column in ALV with buttons.I need to make that button Visible or invisible based on a condition.
    i have fiels with value x and blank.
    if the value is x i need to make the button visible and viceversa.
    Cheers,
    Madhu.

    Hi,
    I assume when you say that you have a field with value X or blank that you have a internal table with one of the field as mentioned above and also a context node with
    the same structure of the internal table so that you bind the internal table to the node
    and display the same in ALV.
    If my assumptions are right you must proceed as follows.
    1.Create an internal table with the same structure that u had passed for ALV.Add one more column to that table with type wdui_visibility.
    2.Create one more node with the structure of the internal table created above.
    3.Move the coresssponding data from your old internal table to the new internal table.
    4.For the new column of type wdui_visibility fill values by comparing the field with value X or blank.ie. IF value = X wdui_visibility_column-value = '02' .
                        IF value = blank wdui_visibility_column-value = '01' .
    5.Save the changes in the new internal table.
    6.Bind the new internal table to the new node.
    7.Use the new node to display data in ALV.
    8.Create an attribute "alv_table" of type "CL_SALV_WD_CONFIG_TABLE" in the view.
    9.In the wd_init method add the following codes.
    * create an instance of ALV component
      DATA:
        lr_salv_wd_table_usage TYPE REF TO if_wd_component_usage.
    * get ALV component
      DATA:
        lr_salv_wd_table TYPE REF TO iwci_salv_wd_table.
    * set cell editor for input fields (~make colum Wt editable)
      DATA: lr_column_settings TYPE REF TO if_salv_wd_column_settings,
            lr_column type ref to CL_SALV_WD_COLUMN,
            lr_column_hdr type ref to CL_SALV_WD_COLUMN_HEADER,
            lr_button_1 TYPE REF TO cl_salv_wd_uie_button.
      lr_salv_wd_table_usage = wd_this->wd_cpuse_<Alv component usage name>( ).
      IF lr_salv_wd_table_usage->has_active_component( ) IS INITIAL.
        lr_salv_wd_table_usage->create_component( ).
      ENDIF.
      lr_salv_wd_table = wd_this->wd_cpifc_<Alv component usage name>( ).
      wd_this->alv_table = lr_salv_wd_table->get_model( ).
    lr_column_settings ?= wd_this->alv_table.
    lr_column = lr_column_settings->get_column( '<column name which you want to show
                      as button>' ).
    CREATE OBJECT lr_button_1.
      lr_button_1->set_text( '<some releavnt text>' ).
      lr_button_1->SET_VISIBLE_FIELDNAME('<new column name of type
                         wdui_visibility>').
      lr_column->set_cell_editor( lr_button_1). 
    Hope this helps.
    Thanks,
    G.Jayaprakash

  • Portal Forms - How to make a Field with DEFAULT value NON-EDITABLE by Users

    I HAVE A FORM WITH A DATE FIELD ON IT WITH DEFAULT VALUE.
    THIS IS A TABLE-FIELD.
    I WANT THE FIELD TO BE DISPLAYED ON THE FORM BUT NOT TO ALLOW
    USERS TO EDIT/CHANGE IT.
    HOW CAN I DO THIS?
    TKS IN ADVANCE

    Hi,
    see Re: sequencing problem-Forms
    Regards Michael

  • Date field not updated when select on F4 value on editable ALV Grid

    Can some one look into this to see what was wrong.
    I have a report that display fields extracted from a ZTable and display on an ALV Editable Grid.
    The data are displayed as read only mode for these fields:
    Field A -   type char20 and have a search help available.
    Start Date - type dats
    End Date - type dats.
    Field B
    Field C ...
    When user select to add new record,  Field A, Start Date and End Date must be editable, the rest are read only.
    On field A because there is search help available, I have no problem select data on F4 pull down menu and the data is updated on the grid.
    But on field start date and end date, there is F4 menu and when you pull down, it shows the calendar date.  But when I select the date to change, it acts like nothing happens.  I run the debug mode and found out that in function module 'F4IF_FIELD_VALUE_REQUEST', after you select the date field, I got the return code irc = 8 from line 305 of this FM.
    Here is what I did.
    I build field catalog similar like BCALV_EDIT04  (add table type lvc_t_styl to each extracted record to indicate which field will be  editable.
    In the PBO,  I build field catalog and set style as enable for these fields:
    CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
          i_structure_name = p_struct
        CHANGING
          ct_fieldcat      = p_t_fieldcat.
    LOOP AT p_t_fieldcat INTO ls_fcat.
        CASE   ls_fcat-fieldname.
           when 'Field_A'.
               ls_fcat-ref_table = 'ZTABNAME'.
            ls_fcat-ref_field = 'FIELD_A'.
            ls_fcat-edit = 'X'.
            MODIFY p_t_fieldcat FROM ls_fcat.
       when 'START_DATE' or 'END_DATE'.
        ls_fcat-style = CL_GUI_ALV_GRID=>MC_STYLE_enabled.
             MODIFY p_t_fieldcat FROM ls_fcat.
       endcase.
    Just curious, I copied program BCALV_EDIT_08 to ZBCALV_EDIT08 and make field booking date as editable to test.  When I select to change booking date from F4 menu pull down, the new date is populated to the screen field.  So what was wrong between my program and BCALV_EDIT_08?  Thanks for your help.  I am stuck on this problem for 2 days and could not figure out what was wrong.

    not sure why you use that FM for date filed , you just need in the field catalog make sure that are use a date field of reference , anyway check program BCALV_EDIT_01

  • Handling Enter Key in Editable ALV Grid using REUSE_ALV_GRID_DISPLAY

    Hello All,
    I have seen a number of threads on captioned issue and everyone of them say to create FCODE for Enter in the Screen's PF Status and then handle the event.
    But the catch is when you hit Enter key in ALV Grid, it will not trigger any FCODE at all because the FCODE Enter you have created is for the screen and not for the GRID. Can anyone please let me know if SAP has given any standard utility in REUSE_ALV_GRID_DISPLAY FM for handling the Enter key event.
    Thanks and regards,
    Mahesh

    Hi,
    Set the PF-status for OK key and use the FCODE or u can usethe dynamic ok_code generated .
    Also try 'ENTE' .
    Hope thishelps.

  • Drop Down appearance for writeback column field

    How to display drop down appearance for writeback column field(set of values in drop down for that field in the Report UI)? Currently Writeback feature in 10g provides only text Box for writeback field.

    Not possible. Writeback is explicitely meant for specific updates and inserts and not for massive arbitrary record creation (official Oracle statement).

  • Mandatory field in Editable ALV

    Hi everyone,
    How to make a field as mandatory in an Editable ALV?
    Is there any field catalog parameter avaialble??
    or how can we do it.
    Please give me a solution.
    Regards
    Hemanth

    Hi!
    I use this solution. With this code, you can manage the mandantory filels via fileld cat.
    METHOD handle_data_changed.
        DATA: ls_fcat       TYPE lvc_s_fcat,
                    structure     TYPE REF TO data,
                    ls_modi       TYPE lvc_s_modi,
                    tabix         TYPE i,
                    index         TYPE sytabix,
                    lr_str_desc   TYPE REF TO cl_abap_structdescr,
                    ls_comp_desc  TYPE abap_compdescr,
                    ls_structure  type ty_zt921_alv.
        FIELD-SYMBOLS: <itab>     TYPE ANY TABLE,
                       <struct>         TYPE ANY,
                       <fs_strukture>   TYPE ANY,
                       <fs_field>       TYPE ANY.
        IF e_onf4 IS INITIAL.
          READ TABLE er_data_changed->mt_fieldcatalog INTO ls_fcat
                                      INDEX 1.
          CREATE DATA structure TYPE (ls_fcat-ref_table).
          ASSIGN structure->* TO <struct> CASTING TYPE (ls_fcat-ref_table).
          ASSIGN er_data_changed->mp_mod_rows->* TO <itab>.
          LOOP AT <itab> ASSIGNING <struct>.
            MOVE-CORRESPONDING <struct> TO ls_structure.
            ASSIGN ls_structure TO   <fs_strukture>.
            lr_str_desc ?= cl_abap_typedescr=>describe_by_data( <fs_strukture> ).
            index = index + 1.
            LOOP AT lr_str_desc->components INTO ls_comp_desc.
              ASSIGN COMPONENT ls_comp_desc-name OF STRUCTURE <fs_strukture> TO <fs_field>.
              READ TABLE er_data_changed->mt_fieldcatalog
                          INTO ls_fcat
                          WITH KEY fieldname = ls_comp_desc-name
                                   mark = 'X'.      
            IF sy-subrc = 0.
                IF <fs_field> IS INITIAL.           
                CALL METHOD er_data_changed->add_protocol_entry
                  EXPORTING
                    i_msgid     = 'ZH'
                    i_msgno     = '044'
                    i_msgty     = 'E'
    *        i_msgv1     = text-m03          
                    i_msgv2     = <fs_field>
    *        i_msgv3     = text-m05          
                    i_fieldname = ls_comp_desc-name
                    i_row_id    = index.
                  error_in_data = 'X'.
                ENDIF.
              ENDIF.
            ENDLOOP.
    ENDLOOP.
    ENDIF.
    ENDMETHOD. "handle_before_user_command

  • User entered values are lost on EO validation.

    Hi ,
    Subject : user entered values are lost on EO validation.
    WE have an EO which has 4 attributes all are not null (mandatory)
    There is a VO based on this EO
    We have added 4 more attributes using a join in EO query using expert mode.
    On the page there is a Table , that has 8 columns all mapped to these 8 attributes.
    The First column is an LOv that populates 4 column attributes(2 EO based and 2 added thru expert mode)
    When the user submits the page, without entering rest of the two EO mandatory atributes, the EO validation is raised and the 4 fields populated by LOv are cleared.
    Can you pls tell me what am i doing wrong.
    thanks
    Chaitanya

    Observation
    All the table columns that were loosing information were "MessageStyledText" and those not loosing were "MessageTextInput"
    Various approaches
    SO we converted the MessageStyledText columns into MessageTextInput and the data was retaining properly.
    But we wanted these columns are 'ReadOnly' so when we made these columns are MessageTextInput - ReadOnly, then data was not getting popluated by the lov in these.
    Working solution - The FormValue 'Glue'
    We created formValues correcponding columns and populated the FVs also along with the column (both FV and column have same ViewAtt and View instance) and found that in this case the formvalues 'Glues' the VO att value with the page and does not get lost on refresh.
    Strange solution but works, thought to share with all.
    thanks
    Chaitanya

Maybe you are looking for