To make table cell as read-only based on some condition

Hello ABAPers,
I have a requirement to make the cell in the table of a Web Dynpro component read-only. There are 4 fields in the Table of a view which is mapped to the Context attribute, i.e. function, Number, Description etc. When the value of the Field 'Function' is
'0000016', I have to make the Number field as READ-ONLY(non-editable).
As suggested in SDN forums, I have created the sub-node to the main node in Context and added an attribute 'READ_ONLY'. I have made the cardinality as 1:1. I have also created the Supply Function Method(ZREADONLY) for sub-node that I have created and also set the context binding to the Read only property of the field 'Number' in the View Layout.
PFB the coding I have done in supply function method for setting the read-only attribute for the number field, but it is not working. Could anyone let me know what is the change I have to make this work?
DATA ls_parent_attributes TYPE wd_this->element_partner_h.
DATA l_partner LIKE ls_parent_attributes-partner _fct
Constants c_parent LIKE ls_parent_attributes-partner_fct VALUE '000016'.
DATA ls_zread_only TYPE wd_this->element_zreadonly
parent_element->get_static_attributes(
   IMPORTING
          static_attributes = ls_parent_attributes).
CLEAR l_partner.
l_partner = ls_parent_attributes-partner_fct.
IF l_partner = c_partner.
    ls_zread_only-readonly = abap_true.
     node->bind_structure(
     new_item = ls_zread_only
     set_initial_elements = abap_true ).
ELSE.
    CLEAR ls_zread_only-readonly.
    ls_zread_only-readonly = abap_false.
    node->bind_structure(
     new_item = ls_zread_only
     set_initial_elements = abap_false ).
ENDIF.
Thanks for your time!
Regards,
M M Jaffer

Hi,
the solution is quite simple.
Bind the property reaonly in the layout editor to the property readonly of the context-attribute.
Therfore you have to click at the binding button of the celleditor of the property read-only.
Then you select the  radiobutton in front of Bind to the property of the selected Attribute and choose Property R.
In you coding you have to fo the following in case you do that after binding the itab to the context:
node->bind_table( .... ).
data lt_elements type wdr_context_element_set.
lt_elements = node->get_elements( ).
LOOP at lt_elements into element.
element->get_attribute(
      exporting
        name = 'PARTNERFCT'
      importing
        value = lv_partnerfct
  if lv_partnerfct eq c_partner.
    call method lo_el_position->set_attribute_property
      exporting
        attribute_name = 'PARTNERFCT'
        property       = element->e_property-required
        value            = 'X'.
  else.
    call method lo_el_position->set_attribute_property
      exporting
        attribute_name = 'PARTNERFCT'
        property       = element->e_property-read_only
        value            = ''.
  endif.
endloop.
Of corse you have to modify the coding and i didn´t checked the syntax, baut this should help.
Best regards, Matthias

Similar Messages

  • How to make specific cell(s) read-only in a data-grid

    Hi there!
    Is there a way to make an specific cell read-only in a data-grid?
    Best regards,
    Ciro

    Hi !
    After some months... here is the solution:
    Private WithEvents _gridTaste As DataGrid
    Private Sub MyScreen_Created()
    AddHandler FindControl("GridTaste").ControlAvailable,
    Sub(s, e)
    _gridTaste = CType(e.Control, DataGrid)
    End Sub
    End Sub
    Private Sub _gridTaste_BeginningEdit(sender As Object, e As DataGridBeginningEditEventArgs) Handles _gridTaste.BeginningEdit
    ' I want do set the cell (2,0) as read only:
    If e.Row.GetIndex = 2 AndAlso e.Column.DisplayIndex = 0 Then
    e.Cancel = True
    End If
    End Sub
    I hope this post help you too!
    Best regards,
    Ciro

  • How to make a cell/column read only

    HI All,
    Is there any way to make a specific cell read only with in a specific data form?
    Similarly is there any way to make whole column read only inside a specific data form?
    I don't want to make changes in my dimension member (e.g Dynamic Calc), i want to make these changes at data form level because, these cell/column are read only at one form but on some other data form they are editable/enterable

    If you want to make a column read only then have a look at asymettric columns in the planning admin doc, if you use them then you can make one of the columns read only.
    If you want a make one cell read only then one method could be to use javascript, you could add an extra member which is dynamic calc and point to the original member with a formula but it doesn't sound like you want to do that.
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • In my output fianl int. table how to display 'X' based on some conditions

    Hi,
    can somebody tell me
    how to populate the value in my fianl table as 'X'.This is my requirement.How to do???
    In the LOOP on lt_stpox, if lb_recursive is set to X, then populate gs_output-rekri = X for all components for material.
    this is my coading.
    *Panthom item check
       IF  p_phant = c_x .
          DELETE lt_stpox WHERE dumps = c_y.
        ENDIF.
        CLEAR lb_recursive.
        READ TABLE lt_stpox TRANSPORTING NO FIELDS WITH KEY rekri = 'x'.
        IF sy-subrc EQ 0.
          lb_recursive = 'X'.
        ENDIF.
        DELETE lt_stpox WHERE rekri = c_y.
        LOOP AT  lt_stpox INTO ls_stpox.
    *Move header data to final table.
          MOVE-CORRESPONDING ls_topmat TO gs_output.
    *move comonent data to final table.
          MOVE ls_stpox-ojtxp TO gs_output-maktx1.
          MOVE ls_stpox-idnrk TO gs_output-idnrk.
          MOVE ls_stpox-mngko TO gs_output-menge.
          MOVE ls_stpox-rekri TO gs_output-rekri.
          MOVE ls_stpox-meins TO gs_output-meins.
          MOVE ls_stpox-stufe TO gs_output-dglvl.
          APPEND gs_output TO gt_output.
        ENDLOOP.
        CLEAR: gs_output,ls_stpox,ls_topmat.
      ENDLOOP.
    ENDFORM.                    " BUILD_OUTPUT

    Hi,
    As per my understanding of your question, You are checking whether lt_stpox-rekri = 'X'  in below code and then you are setting lb_recursive as 'X' accordingly.
    CLEAR lb_recursive.
    READ TABLE lt_stpox TRANSPORTING NO FIELDS WITH KEY rekri = 'x'.
    IF sy-subrc EQ 0.
    lb_recursive = 'X'.
    ENDIF.
    DELETE lt_stpox WHERE rekri = c_y.
    And after that you are looping at lt_stpox to populate final internal table.
    So, instead of doing this, you can directly loop at table lt_stpox and in loop check if  lt_stpox-rekri = 'X', if yes then gs_output-rekri = X.
    Refer below code.
    LOOP AT lt_stpox INTO ls_stpox.
    If ls_stpox-rekri eq 'X'.
    gs_output-rekri = X.
    Endif.
    *Move header data to final table.
    MOVE-CORRESPONDING ls_topmat TO gs_output.
    *move comonent data to final table.
    MOVE ls_stpox-ojtxp TO gs_output-maktx1.
    MOVE ls_stpox-idnrk TO gs_output-idnrk.
    MOVE ls_stpox-mngko TO gs_output-menge.
    MOVE ls_stpox-rekri TO gs_output-rekri.
    MOVE ls_stpox-meins TO gs_output-meins.
    MOVE ls_stpox-stufe TO gs_output-dglvl.
    APPEND gs_output TO gt_output.
    ENDLOOP.
    CLEAR: gs_output,ls_stpox,ls_topmat.
    ENDLOOP.
    Hope it helps.
    Thanks,
    Archana
    Edited by: Archana Pawar on Feb 1, 2010 11:43 AM

  • Make single option as read only in Radio group

    Hi
    How to make a option readonly with respect to condition in radio group in oracle apex 4.0. Example
    option1
    option2
    option3
    option4
    I want to make the option4 read only based on the condition.So Where the codition needs to be added.
    Regards
    Balaji
    Edited by: 904493 on Feb 7, 2012 1:19 AM

    Just thinking aloud (can't test it right now myself): I'm not sure whether you can disable (or set read only) a radio button. However, if you don't need one of these options, perhaps you should modify List of Values query which returns these options. Furthermore, it means that list shouldn't be static but dynamic (SELECT statement).
    So how do we restrict SELECT's result set? By using a WHERE clause.
    Now, you know the conditions that have to be met in order to (or not to) display certain options. Suppose that there's a page item (named P1_CONDITION) which - if set to 4 (as "option*4*) - won't allow option4 to be displayed.
    List of values' query might look like
    {code}select option_name, option_id
    from options
    where option_id <> nvl(:P1_CONDITION, -1) --> -1 is a non-existent option
    {code}

  • Make certain fields in the Account Detail Page Read-Only based on a Checkbo

    Hello
    We would like to make certain fields on the Account Detail Page Read-Only based on a checkbox that is on the Admin Account Detail Page. The fields we are looking to make read-only are Account Name, Primary Address, Phone Number.
    Thanks

    Brian,
    I think you'd need to use dynamic page layouts for this. Look at the Account type values, if you are already using it then replicate those values you have so if you have Business and Personal make it Business Read-only and Personal Read-only.
    When you are ready to lockdown those fields change the Account type from Business to Business Readonly and have the page layout for this screen with Account type, Name, Primary address and phone number as read only. You will a separate page layout for yourself so that Account Type stays as writable for you.
    You will need to check if you can have Account Name as read only as it is a required field.
    cheers
    Alex

  • How to make a schema really READ ONLY

    Our legacy database is on 11.2.0.1/Redhat. Last week, one developer by accident changed the legacy schema by executing drop/creat/alter table commands. This causes big problem. Now we want to make the legacy schema absolutely read only. Thus nobody can change the schemas object and data.
    There were posts talked about make the tablespace toe read only. That stopped inserting/deleting but one can still change the schema objecs with create, drop and alter, e.g.11:31:41 SQL> create table DUMMY(dummy int);
    Table created.
    11:32:06 SQL> alter table dummy add ( address varchar(20));
    Table altered.
    11:24:14 SQL> drop table DUMMY ;
    Table dropped.How can I stop this type of changes to the schema?

    Revoked most privileges from user LCCH (this is the one I want its schema READ ONLY), only leftselect distinct privilege,admin_option from (
    select r.role,user,r.privilege,r.admin_option from role_sys_PRIVS r
    union
    select 'sys',p.* from user_sys_PRIVS p order by 1,2,3
    PRIVILEGE                                ADM
    CREATE SESSION                           NO
    SELECT ANY DICTIONARY                    NO
    SELECT ANY TABLE                         NONow user LCCH can still create table in its own schema13:08:49 SQL> show user
    USER is "LCCH"
    13:08:56 SQL> create table lcch.DUMMY(dummy int);
    Table created.
    13:09:33 SQL> drop table dummy purge;
    Table dropped.I double checked the privileges granted and confirm that schema has not role granted, no object privileges granted and only the above 3 system privileges granted.

  • How to make an list row Read only

    Hi All,
        Can anyone please tel me how to make the List row (list item) read only where the status column value is Submit.(i.e the whole row has to be made as readonly, am using event handler to try this out)
    Thanks in advance 

    Hi,
    According to your description, my understanding is that you want to set the list item read only based on the status column.
    If you want to do it using Event Receiver, you need to check the status column value using Server Object Model, then break role  Inheritance and rest role assignments to set the item read only.
    Here are some detailed code demo for your reference:
    Change SharePoint list item permissions to Read only programmatically
    How to: Create an Event Receiver
    Thanks
    Best Regards
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Field Read Only based on a value of another field

    Hello,
    In our project we´d like to have Field A made Read Only based on a value of Field B. Otherwise it should be R/W.
    Would this be possible in OnDemand ?
    Txs. a lot for any help.
    Antonio

    If your field is the key field that helps in dynamic layout then this is possible. If not try doing a validation on the field.

  • How to make few DFF fields read only in Forms

    Hello.....
    I am having an Issue in forms customization through custom.pll
    I need to make few DFF fields read only in HRMS enter and maintain form through custom.pll
    I tried with fnd_descr_flex.update_definition but in vain
    So please help me how to rectify this issue.
    Edited by: user.nazeer25 on Jul 9, 2010 5:27 AM

    Hello,
    Wrong forum.
    Ask this kind of question in the E-Business Suite forum ;-)
    Francois

  • "The selected cells are read-only" error on Custom Field when trying to insert in Datasheet mode

    I have a custom field that works completely fine. Yesterday our QA team found out that when trying to insert in Datasheet format, the error "The selected cells are read-only" was thrown. Any ideas? I tried passing the following property to my fldtypes_field.xml file:
        <Field Name="ReadOnly">FALSE</Field>
    No luck.Victor Palma

    Unfortunately it did not work. I also developed the code and access the field and checked its property called "ReadOnlyField"  which is already set to false.
    Below is the xml that i am using. Can you please share the xml that you had used?
    <?xml version="1.0" encoding="utf-8"?>
    <FieldTypes>
      <FieldType>
        <Field Name="TypeName">MyCustomField</Field>
        <Field Name="ParentType">Text</Field>
        <Field Name="TypeDisplayName"> My Custom Field</Field>
        <Field Name="TypeShortDescription"> My Custom Field</Field>
        <Field Name="AllowBaseTypeRendering">True</Field>
        <Field Name="ReadOnlyField">False</Field>
        <Field Name="UserCreatable">TRUE</Field>
        <Field Name="ShowInListCreate">TRUE</Field>
        <Field Name="ShowInSurveyCreate">TRUE</Field>
        <Field Name="ShowInDocumentLibraryCreate">TRUE</Field>
        <Field Name="ShowInColumnTemplateCreate">TRUE</Field>
        <Field Name="FieldTypeClass">My Assembly Information goes here</Field>
      </FieldType>
    </FieldTypes>

  • Make a volume mount read-only

    Rather than dig for my Mac OS X Server DVD, I find it easier to clone the disc onto a small partition on a hard drive.
    However, the volume always mounts read-write, and I always get warnings about low disk space because of it. (I made the partition as small as possible.) Plus, I don't want to have anything mess with my Mac OS X Server "DVD".
    I noticed that Mac OS X doesn't use fstab for mounting volumes… is there a way to make a disc mount read-only all of the time? (chmod -R a-w * doesn't cut it for me.)

    I don't mean having it mount read-only when booting from it. I mean, while the server is running normally (not booted from the "disc").
    For peace of mind, I'd like to have my "disc" always be read-only, just to make sure that it isn't modified unless I explicitly allow it.
    On Linux, I could add "ro" to the mount options. Since Mac OS X doesn't use fstab, is there some plist that determines how volumes are mounted? I'd rather not edit the /etc/rc.* files unless absolutely necessary.

  • How to make a DFF in read only mode

    Hi All
    There is a requirement to male an descriptive flexfield (in Puchasing PO Headers) i read only mode for all the users.
    So that user must not select any values, Is any way to do this. Any workaround is possible ?
    Regards

    Hi;
    Please follow below and see its helpful:
    [Solved] How to make a DFF segment 'Read-Only' using Form Personalization?
    Also check:
    http://download-west.oracle.com/docs/cd/A60725_05/html/comnls/us/fnd/ogenff03.htm
    Regard
    Helios

  • How to make a column as read only for update integrator.

    Hi All,
    i came across one issue while creating integrator.
    for update integrator i have column rowid.rowid is a parameter. by using this(rowid) i'am updating.i want to make rowid column as read only .
    if i enable read only for rowid,then it is passing null as parameter and inserting new row instead of updating the row.
    If any one came across this problem you can help me in fixing this issue.

    Hi Sanket,
    Thanks for reply.
    i have created a dummy column and passed the value of the orginal column values to dummy cloumn. and hided the orginal column.
    in this process i have come across same issue. it is not passing the value as parameter and instead of updating the row it is inserting an new row.
    Any alternate for this scenario.
    Thanks in advance.

  • How to make a DFF as Read only field

    How to make a DFF as Read only field

    Hi,
    You can add the read only token ($RO$) to any of the segments in the list. For example:
    segmentlist = "Context1|Segment1($RO$)|Segment2..."
    Thanks,
    Kumar

Maybe you are looking for

  • I want to enhance screen using BADI

    hello sap guru i want to enhance screen using BADI.can i enhace screen with out using SPRO transaction? is abap consultant have authorization for SPRO trasaction?

  • Compiling error......class or interface expected

    here is what it said in my command prompt C:\j2sdk1.4.2_05\bin>javac C:\Java\Converter.java C:\Java\Converter.java:16: 'class' or 'interface' expected ^ 1 error and by the way sorry if this posted twice my computer is being a little annoying tonight

  • Forwarding a Voicemail

    One of my remote users called asking if he could forward a voicemail to another employee. I did a bit of testing and was able to do this to a co-worker in my office via Option 0, then option 6, then when it asks for "mailbox" entering his phone numbe

  • How to empty 5000 photos from iPhoto's trash

    hi guys a friend of mine -  a newcomer to Mac OSX.. - has piled up 5000+ photos in iPhoto's trash & when he tried to empty it , iPhoto simply freezes & has to be closed using ''force quit''. he asked for my help but, no matter what i tried i simply d

  • HT202213 How do I cancel my home sharing subscription?

    Can someone please explain to me how to cancel my home sharing subscription.  I have found it extremely difficuly navigate.  Mainly because when I am not connected to wifi the songs are not on my computer nor are they on my ipad.  It's very frustrati