Check Mandatory Fields when state is bound with context attribute

Hello All,
Currently i am facing  problem in my SAP SRM 7.0 standard component.
Actually, i have to remove  mandatory(State = Required) for one of my inputfileds for this I have written below code, but it has been  remove only Red mark * infront of Inputfield, after that, i am trying to save other data, still it is asking me enter the required value.
     here my input field  bound with Context attribute, it is standard attribute.
data:lo_input1 type ref to cl_wd_input_field.
   lo_input1 ?= VIEW->get_element( 'NAME_FIRST' ).
   lo_input1->set_state( '00' ).
I am trying to delete state = required property from below component and view
Component Name : /SAPSRM/WDC_MOFC_PERSON
       View  :  V_PERSON
Can you help me on this?
Thanks
Sandeep.

Hi Baskaran ,
Thanks for ur reply ..
Eveen in that component they have not used cl_wd_dynamic_tool class for mandatory attributes
I want to share another thing with u that is
I am trying it in another way
with the following code which i have done in post exit  is
let me explain u what i did
__first of all i got the child node of rootuielementcontaine
later
i get the childnode of container_left and assigned it to another class of ref cl_wd_uielemnent
now where i have struked is
*CALL METHOD LR_CHILD2->GET_CHILD
EXPORTING
   ID        = 'FORM_OF_ADDRESS_DROPDOWN'
   INDEX     =
RECEIVING
   THE_CHILD = LR_C1.
what the error i am getting is
OBJECTS_OBJREF_NOT_ASSIGNED
Please correct me if there is any wrong inn the code ...
FORM_OF_ADDRESS_DROPDOWN--->ui element dropdown
r__ DATA lr_container TYPE REF TO cl_wd_uielement_container.
DATA lt_children  TYPE        cl_wd_uielement=>tt_uielement.
DATA lr_view      TYPE REF TO if_wd_view.
DATA lr_child     TYPE REF TO cl_wd_uielement.
   DATA lr_child1     TYPE REF TO cl_wd_uielement.
   DATA lr_child2     TYPE REF TO cl_wd_uielement.
data : LR_CON1 TYPE REF TO CL_WD_TRANSPARENT_CONTAINER.
data : LR_CON2 TYPE REF TO CL_WD_TRANSPARENT_CONTAINER.
SANDEEP
lr_container ?= view->get_element( 'ROOTUIELEMENTCONTAINER' ).
lt_children = lr_container->get_children( ).
CALL METHOD lr_container->get_child
   EXPORTING
     id        = 'DATACONTAINER'
     index     = 1
   RECEIVING
     the_child = lr_CHILD.
LR_CON1 ?= LR_CHILD.
CALL METHOD LR_CON1->GET_CHILD
  EXPORTING
    ID        = 'CONTAINER_LEFT'
    INDEX     = 1
  RECEIVING
    THE_CHILD = LR_CHILD1 .
DATA : LR_CHILD2 TYPE REF TO CL_WD_TRANSPARENT_CONTAINER.
LR_CHILD2 ?= LR_CHILD1 .
*DATA : LR_C1 TYPE REF TO CL_WD_UIELEMENT.
*CALL METHOD LR_CHILD2->GET_CHILD
EXPORTING
   ID        = 'FORM_OF_ADDRESS_DROPDOWN'
   INDEX     =
RECEIVING
   THE_CHILD = LR_C1.
*DATA : LR_DD TYPE REF TO CL_WD_DROPDOWN_BY_KEY .
*LR_DD ?= LR_C1 .
*CALL METHOD LR_DD->SET_STATE
EXPORTING
   VALUE  = '00'
sandeep

Similar Messages

  • Strange problem while checking Mandatory fields

    Hi ,
    I am checking mandatory fields with the method following method.
    CL_WD_DYNAMIC_TOOL=>CHECK_MANDATORY_ATTR_ON_VIEW( VIEW_CONTROLLER = my_controller ).
    It was working fine for mandatory fields and also showing one extra input field which is not mandatory with red border .
    Please tell me how to avoid this and What could be the problem.
    Thanks and Best Regards,
    Vijay

    Hi Vijay,
                the extra vield thats showing in re d will be a field that doesnt support blank entry. try commenting the method thats calling CL_WD_DYNAMIC_TOOL.
                CL_WD_DYNAMIC_TOOL=>CHECK_MANDATORY_ATTR_ON_VIEW will check only mandatory fields.. thats for sure.
       the error message thats showing on the optional fild is coming from some standard check
    Regards
    Sarath

  • How to put Sales employee (Splcode) Mandatory Field, when adding A/R invoice

    Hi,
    Kindly solve, How to put Sales employee (Splcode) Mandatory Field, when adding A/R invoice.
    Regards,
    Rajeev.

    Follow this step..
    1. In SQL Server, go to the SAP B1 Database you're using. 
    2. then on the Object Explorer , go to Database Folder, explode the SAP DB->Programmability->Stored Procedures->SBO_SP_TransactionNotification * the only Stored Procedure that is allowed to be edited. Just right click and modify
    3.  Try to paste this -> and click F5
    If
    @object_type ='13' and @transaction_type in ('A','U')
    Begin
    If EXISTS
    select DocEntry from ONIV
    Where DocEntry = @list_of_cols_val_tab_del
    and  SlpCode<>'-1'
    Begin
    set @error_message = 'Please select the Sales Employee'
    set @error = 1
    END
    END
    Regards
    Kennedy

  • Check Mandatory Fields (Dynamic Programming)

    Hi All,
    I am currently generating UI elements dynamically. I have few elements in these dynamically generated elements which are mandatory. Does anyone has information about how to programmatically check whether the entries have been made before the user is allowed to proceed to the next step?  I have maintained the state property of the InputField and the webdynpro application doesnot automatically checks for the entries.
    Any help will be greatly appreciated.
    Thanks and regards,
    Hemanth

    Hi Hemanth,
    there are at least two ways to do this:
    1. Define some simple types in the local dictionary with minLength > 0 and use this simple types as the property types of the context attributes. If you bind the UI elements to this context attributes, the WD runtime will do the checks automatically.
    2. Check the contents of the UI elements with required input manually (by checking the contents of the bound context attributes). Use the report(Invalid)ContextAttribute... methods of the <a href="https://media.sdn.sap.com/html/submitted_docs/60_sp2_javadocs/webdynpro/com/sap/tc/webdynpro/progmodel/api/IWDMessageManager.html">Message Manager API</a> to report missing data.
    Hope that helps.
    Regards
    Stefan
    PS: The state property is just a visual indicator for required/not required fields and doesn't trigger any automatic validation.

  • Mandatory fields on the same page with dependent LOVs

    Hi,
    I am working on an ADF-BC application using JDeveloper 10.1.3.4
    I have an ADF Creation form with dependent LOVs and while implementing dependent LOVs we set the autoSubmit property of the selectOneChoiceListBox as true.
    If I have some mandatory fields on the same page then because of the autoSubmit property set as true whenever I select a value in the list the page gets submitted and the mandatory fields give an error that the values are required therefore I had to remove the mandatory fields.
    I tried using f:subview but even that dint serve the purpose because what I want is something like partialSubmit so that my mandatory fields do no give an error when I select a value in the list.
    Can somebody help me on this, how to have a dependent list and mandatory fields on the same page.
    P.S: It is very crucial for my application
    Thanks,
    Raksha

    Hello,
    This bug has been around since 10.1.3, its even still present in Trinidad and now in 11.
    One of the ways to avoid is to make your fields use:
    showRequired="true"instead of
    required="true"I have not found a decent way to avoid this in general.
    My idea was that this shiould be possible with a phaselistener and determine if this is a partial page event instead of a normal submit, but this didnt work.
    -Anton

  • Check mandatory fields of view in ViewContainer

    Hi Experts!
    I created a view (main view) which containes a ViewContainer UI element. After a click on the main view  I want to check the mandatory fields (with method check_mandatory_fields onview). But therefore I need the reference to the view controller which is embedded in the ViewContainer element. How can I solve this???
    Thanks!

    Hi
    This is how I achieved it:
    In DoINIT of the view which is embedded inside view container UI element I got the reference of view controller and stored it as a component controller public attribute
      wd_comp_controller->mo_api_controller = wd_this->wd_get_api( ).
    Here mo_api_conroller is a comp controller public attr of type ref to if_wd_view_controller.
    Now you can call your method like this in the main view
    cl_wd_dynamic_tool=>check_mandatory_attr_on_view(
        EXPORTING view_controller  = wd_comp_controller->MO_API_CONTROLLER
                  display_messages = abap_true
        IMPORTING messages = lt_messages
    Hope this helps.
    Regards
    Manas Dua

  • Check mandatory fields before saving

    Hello,
    In my Z-program, how can I check all mandatory fields in a dynpro before saving?
    Is there any function to do that?
    Thanks!!!

    Hi alberto,
    1. If the fields are mandatory (as set in the field attributes while designing the screen),
    2. then we don't have to write any additional logic for the same.
       The system will AUTOMATICALLY check for it, and issue appropriate message.
    regards,
    amit m.

  • Problem with context attributes

    Hello All,
      I am currently experiencing some strange behaviour in my WD application so I hope any experts here can give me a hand or spot my mistake.
    <u><b>Scenario</b></u>
    1) View A is being initialised and by default, will display the name of the manager.
    2) This name is being stored as a string attribute "tempName" in a context node of cardinality 1..1.
    3) Someone then decides to change the name of the manager in View A but half way, he changes his mind and clicks on a 'cancel button'.
    4) This cancel button has an action tagged to it and will then transfer the contents of the attribute "tempName" back to the UI element.
    <u><b>Problem</b></u>
    The problem that I am experiencing now is that for some strange reason, the name that I stored in "tempName" becomes a NULL whenever it attempts to transfer the contents back to the UI element.
    To ensure that tempName is assigned the correct data, I issued a "wdComponentAPI.getMessageManager().reportSuccess("From SearchButton :" + wdContext.currentApproverInfoElement().getPrevious1Name());" so that I know for sure that the correct data is being writtena nd displayed back to me.
    Hence, it is very puzzling as I have no idea whatelse may have gone wrong. Any suggestions or feedback will be greatly appreciated. Thank you.
    from
    Kwok Wei

    Hi Anilkumar,
      That is correct.
    During initialisation, I actually made a copy of the contents :
    1) String name1 = wdContext.currentApproverInfoElement().getApprover1Name();
    2) wdContext.currentApproverInfoElement().setPrevious1Name(name1);
    However, it seems that this information is lost when I try to recover back the data when someone hits the cancel button. The code below is assgined to the cancel action of the button.
    3) String previous1Name = wdContext.currentApproverInfoElement().getPrevious1Name();
    4) wdContext.currentApproverInfoElement().setApprover1Name(previous1Name);
    After lines 3) and 4) are executed, the UI Element is showing NULL instead.
    The UI element is binded to the context attribute ApproverInfo.Approver1Name.
    from
    Kwok Wei

  • FPM - Check Mandatory Fields

    Hi,
    Could you please let me know, how can I do the required fields check in FPM?
    I can do this requirement in a simple webdynpro application as below:
    lo_view_controller = wd_this->wd_get_api( ).
    cl_wd_dynamic_tool=>check_mandatory_attr_on_view(
    EXPORTING view_controller = lo_view_controller
    IMPORTING messages = lt_messages ).
    CHECK lt_messages[] IS INITIAL.
    Please let me know how can I do the same in FPM?
    Thanks,
    Vijay.

    There is really no guideline about that. You have decided to go for Dynamic UI elements and you have to find a way to validate them that is the price you would pay for doing things in Dynamic programming. You might have to rely on the looping of your UI elements and see if it is state is mandatory and go for validation in a dynamic way. Requires lots of programming and understanding of UI hierarchy.

  • Radio buttons in dynpro with mandatory field

    I have two radio buttons in a group and a field that should be mandatory when one (the first one) is checked.
    So when the other is checked it should not be mandatory.
    The problem is that when I check the second the field is mandatory until I have put something in the field. In that moment, the field is not mandatory. What I want is to make the field not mandatory when the second is checked so the status of the field was changed to not required in that moment not when I put something in it.
    Thank you

    Hi Maria,
    I think you have two possibility.
    One is to check the "mandatory field" by programming and not with the attribute in the dynpro.
    The second way is making a loop at screen in the PBO and depend on with radio button is checked modify the required field of screen table for the field of your interest .
    I hope this can help you.
    bye
    enzo

  • Reg: Mandatory fields updation with BAPI

    Hi..
    We are working on BDC using BAPI. In this if flat files contians only 4 fields and the mandatory fields in the application are seven then system needs to through error message. But with BAPI the program is updating the database without throwing error eventhough all mandatory fileds are not filled up with data.. Where exactly we need to do modifications to get error message when mandatory fields are not filled up with input.
    Regards

    Hi Verendra
    Sometimes the function modules/BAPI's used by SAP do a direct update on the database tables. In such scnearios the entries are created in the system even though if the mandatory entries are not filled.
    If the number of mandatory fields are small, then before the BAPI call,  check if all the mandatory fields are filled or not;throw error in case of empty fields & bypass the BAPI call.
    In case the mandatory fields are too high, then in that case, please use BDC recording to update the data.
    Regards
    Chetan
    PS:Reward points if you find this helpful.

  • Mandatory Fields in iView created from SHD0 (sceen variant)

    I am experiencing an issue with the Portal display of an (IAC) iView.  The iView displays PZ05 and a transaction variant was setup to handle Emergency contact info.  I created a screen variant for the second screen of this transaction (screen 0200) in which I made 7 of the fields mandatory in the variant.  When this is tested on the R/3 side the mandatory fields are displayed the way they are supposed to be (with the check mark in the box, denoting it as a required field) however when they are displayed in the iView on the Portal the mandatory fields are completely filled up with the "check mark in the box".  In other words the "Name" field is 40 character... and there are 52 "check marks in the box" characters filling up the field.  The iView works great but this looks ugly.  Any suggestions on what I should do to rectify the situation?
    We are running Portal 6.0 SP15 with a stand alone ITS on a 4.6c backend and the Business Package is 50.4.

    Hi Balaji,
    When you create Vendors properly in ECC it should not give such an error. You have to maintain basic data, Accounting data and purchasing data. Rest all are optional.
    For replicating vendors from R/3 to SRM you should have a Vendor root org / group in SRM. BBPGETVD is used to replicate vendors to SRM by mentioning the logical system and Vendor Group ID.
    Hope this makes you clear. Please explain the error clearly for further help.
    Award points for helpful answers.
    Rgds,
    Teja

  • Sales Order "Required Delivery Date" Mandatory Field

    Hi all,
    We want to create sales orders with blank required delivery date field. We will fill this field in future time cause of our processes. But it is a mandatory field when creating order.
    Can we implement this as above not a mandatory field and will it have negative effects to the system ?
    Thanks,

    Check with your SD/LE functional specialist on whether this can be configured.  Alternatively, you might insert a specific future date and update when the delivery date is known...Generally, however, one expects that someone wanting to buy something from us has a delivery date in mind...whether we agree to that date or can promise to deliver on that date is a different matter....

  • Mandatory fields in IP01

    Hi to All
    In IP01 while creating Maintenance Plan,
    For the maintenance plan category selected i.e. Maintenance Order
                   Required mandatory fields are Priority and Planner Group.
    For the maintenance plan category selected i.e Maintenance Notification
                   Required mandatory field is only Priority.
    With the help of user exit IPRM0004 (Maintenance plan / item: Customer check for time "SAVE"),   we could achieve two fields (Priority and Planner Group) mandatory in above both cases.
    But we donu2019t require planner group mandatory with the input selection of maintenance plan category i.e Notification, Please advice how to remove it.
    Regards
    CHSR

    Hi
    Kindly consult with your technical team and try to explain the scenario for mandatory fields according to the maintenance plan type
    I think you have maintained the short text for maintenance plan type PM and NO ask him to refer table T399W and if the MPTYP is PM both the fields to be mandatory and if MPTYP is NO only priority to be mandatory
    Regards
    thyagarajan

  • Mandatory field on Service Call

    Hi Expert,
    I would like to make certain fields mandatory on a Service Call. (When Status Closed, a UDF I have added must be populated, if not block the user)
    Will I be able to use transaction notifications? If this is the case, would you perhaps have some sample code that will guide me in the process?
    Thanks in advance,
    Adriaan

    Hi Adriaan,
    Use the Validate Item event of the Form_Data_Add and Form_Data_Update event's check mandatory fields.
    Regards,
    Vítor Vieira

Maybe you are looking for

  • Quicktime doesn't show up

    I just posted a website with a few Quicktime files. They do not show a thumbnail. I dragged them in after I "saved as" Quicktime for the web. It told me the files might be too big as I dropped them in the page. They are about 10-12 MGB. What am I doi

  • Problem with BADI BADI_HU_DIALOG.

    I want to  display some customer fields in the screen 'Addit. Data' in  the Handling Units (transaction vl02n/vl03n). Therefore I use the BADI 'BADI_HU_DIALOG', method DEFINITION_SUBSCREEN. I need the subscreen in the details, so I use the flag 'IF_D

  • Strange error in File-XI-JDBC scenario

    Dear All, I am working currently on File-XI-JDBC scenario and is facing with a stange problem. I have writtern one simple query which is downloading the data from R/3 and is sending to XI Server local folder. From that folder File is getting picked b

  • IPhone as a computer replacement

    A friend of mine is considering purchasing an iPhone. Her desire is to use the iPhone as her only phone AND as a replacement to her computer. Is anyone out there doing anything similar? If so, could you please offer me suggestions, cautions, limitati

  • Tube TV + Blu-Ray player??

    I have a tube tv, but want to upgrade to a blu-ray player from my current dvd player.  Is this possible??  I don't have the money right now for a hi-def TV.  But if I can upgrade the player, it's a start.  Anyone?  Thanks.