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

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

  • 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.

  • 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.

  • 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

  • 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.

  • Mandatory input field in View

    Hi All,
    Mandatory input field in group
    In my web dynpro application i have marked the input field "required" and in output it shows with red asterisks...
    In my view i have 2 group elements with different fields. I am using method *check_mandatory_attr_on_view* to get mandatory fields in view, its not returning all mandatory fields in view. its just returning mandatory fields in first group.
    Has any one faced this kind of issue before? Is there anything additional to be done?
    Thanks
    Rajesh Yadla

    Depending on which NetWeaver SPS your are,
    there are some errors in this method,
    so better use the other method (CHECK_MANDATORY_ATTRIBUTES).
    This seems to work well.
    Check also SAP Notes:
    [Note 1026272 - WDA: Mandatory check on view of multiple context nodes|https://service.sap.com/sap/support/notes/1091460]
    [Note 1091460 - WDA: CHECK_MANDATORY_ATTR_ON_VIEW checks only LeadSelection|https://service.sap.com/sap/support/notes/1026272]

  • 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

  • How  to validate the mandatory fields in the view in WDA?

    Dear experts,
                            Iam new to WDA. i just want to know how  to validate the mandatory fields in the view in WDA?please refer any documents for validating the mandatory fields.
    Regards,
    murthy.
    Edited by: Murthy Ganti on Jul 13, 2009 2:31 PM

    Hi,
    Firstly goto view->select the element that you want to make mandatory and set the State property to required.
    Secondly place the below code in the WDDOBEFOREACTION
    DATA: l_view_controller TYPE REF TO if_wd_view_controller.
    * Get view controller
      l_view_controller = wd_this->wd_get_api( ).
    * Check for mandatory attribute
      cl_wd_dynamic_tool=>check_mandatory_attr_on_view(
      EXPORTING view_controller  = l_view_controller
                display_messages = abap_true
    Regards,
    Radhika.

  • Removing mandatory field checks

    Hi all
    We are working on ESS/MSS packages customization and we have a requirement where in we need to make a mandatory field in one of the screens, non-mandatory e.g. zip code in address information. I have the Webdynpro code of mentioned screen in my NWDS. Any pointers are welcome.
    with thanks
    amit

    Hi amit,
    The state of a webdynpro element can be set  using
    void setState(WDState value) in the implementation  of your view.
    Check the
    IWDAbstractInputField
    in
    <a href="https://help.sap.com/javadocs/NW04S/current/wd/index.html">WDAPI</a>
    Attributes  available
    static WDState NORMAL
              The normal state of a UI element.
    static WDState REQUIRED
              Indicates that a UI element must provide a value for performing a certain action.
    Thanks,
    Swathi

  • Check for mandatory fields while creating EP users using code .. :|

    Hello All,
    I have a code using which I can create user accounts/EP users on Portal, am working on EP6 SP9 & SP12.
    <u>My query</u>:
    1. <i>From Portal's perspective</i> -> While creating EP users, there are few mandatory fields like user-id, FirstName, LastName, Email-id and Password. If any of the above fields is null/empty, Portal would give us an error message.
    2. <i>From coding perspective</i> -> Here, only the user-id is required. Even if I do not enter/fill any of the above mentioned mandatory fields (except user-id), user account is created.
    In case wherein FirstName/LastName is not mentioned, Portal shows the userid in the Welcome Frame, i.e. Welcome <user-id>. Tried this by commenting the statements contains the methods related to setting/accepting FirstNme and LastName of user.
    <b>I want to know if this is all rite?
    If no, then please guide me as to how can I set mandatory fields in my code.</b>
    Awaiting Reply.
    Thanks and Warm Regards,
    Ritu R Hunjan

    Hi Ritu,
    >>please guide me as to how can I set mandatory fields in my code??
    In ur jsp file or in the controls code add the following attribute
    <hbj:label id="userIdLabel"
               text="User ID"
               labelFor="userIdInput"
               design="HEADER3"
               required="true"/>
    and to check the mandatory entry for that field do this in the submit button
    <hbj:button id="insert"
                text="Submit"
                design="emphasized"
                onClick="save"
                onClientClick="if(!isMandatory()) htmlbevent.cancelSubmit=true;;"/>
    and in the javascript write the client validation code.
    Hope this helps.
    Regards,
    Joshua Kiran

  • Check duplicate data entry in multi record block,which is a mandatory field

    Dear all,
    I have a situation where i have to check duplicate data entry(on a particular field,which is a mandatory field,i.e. it cannot be skipped by user without entering value) while data key-in in a Multi Record block.
    As for reference I have used a logic,such as
    1>In a When-Validate-Record trigger of that block I am assigning the value of that current item in Table type variable(collection type)
    as this trigger fire every time as soon as i leave that record,so its assigning the value of that current time.And this process continues
    then
    2>In a When-Validate-Item trigger of that corresponding item(i.e. the trigger is at item level) has been written,where it compares the value of that current item and the value stored in Table type variable(collection type) of When-Validate-Record trigger.If the current item value is matched with any value stored in Table type variable I am showing a message of ('Duplicate Record') following by raise_form_trigger failure
    This code is working fine for checking duplicate value of that multi record field
    The problem is that,if user enter the value in that field,and then goes to next field,enter value to that field and then press 'Enter Query 'icon,the bolth Validate trigger fires.As result first when-validate record fires,which stores that value,and then when-validate-item fires,as a result it shows duplicate record message
    Please give me a meaningful logic or code for solving this problem
    Any other logic to solve this problem is also welcome

    @Ammad Ahmed
    first of all thanks .your logic worked,but still i have some little bit of problem,
    now the requirement is a master detail form where both master and detail is multirecord ,where detail cannot have duplicate record,
    such as..........
    MASTER:--
    A code
    A1
    A2
    DETAIL:--
    D code
    d1
    d2 <-valid as for master A1 , detail d1 ,d2 are not duplicate
    d2 <--invalid as as for master A1 , detail d2 ,d2 are duplicate
    validation rule:  A Code –D Code combination is unique. The system will stop users from entering duplicate D Code for a A Code. Appropriate error message will be displayed.*
    actually i am facing a typical problem,the same logic i have been applied in detail section ,its working fine when i am inserting new records.problem starts when i query,after query in ' a ' field say 2 records (i.e. which has been earlier saved) has been pasted,now if i insert a new record with the value exactly same with the already present value in the screen(i.e. value populated after query) its not showing duplicate.................could u tell me the reason?and help me out...............its urgent plzzzzzzzzz
    Edited by: sushovan on Nov 22, 2010 4:34 AM
    Edited by: sushovan on Nov 22, 2010 4:36 AM
    Edited by: sushovan on Nov 22, 2010 8:58 AM

  • Product hiearchy field mandatory in sales view

    Dear Experts,
    How can I make product hiearchy field mandatory in sales view for only one plant
    Pooja

    For one plant it is not possible

  • Mandatory check on fields

    Hi,
    We have upgraded to CRM 7.0.
    We have placed mandatory check on some fields in service tickets in UI. But the mandatory checks work in a wired way.
    For example if I am in Interaction History work center where we have marked partner as mandatory field for search.
    But If I do not perform any search and try to navigate to the other workcenter the system throws a mandatory check error.
    Is this the standard behaviour in CRM 7.0.
    Regards
    Yogesh

    Hi Gopi,
    Why do you want to perform the checks on Serverside event....why not on client side event ie. onClientClick ?
    For validations on serevr side event onClick you can use the method
    Data: it_fields type  it_fields TYPE tihttpnvp .
    CALL METHOD request->get_form_fields
            CHANGING
              fields = it_fields.
    This table it_fields contains values of all the elements in the form.
    Hope it helps.
    Regards,
    Anubhav.

  • Mandatory field in COPA characteristic group not checked

    Hello,
    I have customized a COPA characteristic group in KEPA transaction entering the product as a mandatory characteristic.
    Then I have posted a document in FBD9 taking a reference document that does nor have filled the product and the system does not show an error and the document is posted without the mandatory field.
    How could I solve this problem?
    Thank you very much
    Regards

    Hi
    Did you assign this char group in KE4G against your Busn Trans or in KEVG2 against record type B?
    If yes, and still it is not reading it, then refer note 115500.. you may need to apply this note
    Regards
    Ajay M

Maybe you are looking for

  • Can I install an internal 2tb drive in my DP 2.5 G5?

    Just wonder if there is a limit to the size of the drives I can install internally and not being recognized by the G5? I'm looking to add a Hitachi 2tb... THANKS

  • Customer Hierarchy Characterstics in COPA

    How COPA document picks up the customer hierarchy values? I know that there is PAPARTNER structure. But i am not clear how COPA characterstic HIE02(Customer Hierarchy 02) picks up the value. Can you anyone helps me in understanding how HIE02 is picki

  • Incorrect data type when writing to FPGA Read/Write Control

    I have run in to a problem this morning that is causing me substantial headache.  I am programming a CompactRIO chassis running in FPGA mode (not using the scan engine) with LabVIEW 2012.  I am using the FPGA Read/Write Control function to pass data

  • Convertion from pdf is really bad

    Hi ! First, i m pretty ignorant in making pdf form... I need to make an interractive form from a pdf file (25 pages) given by a friend. he gave me 2 version of the file, a 'normal' pdf and one in form version (without any calcul or interractivity). (

  • Is there a simple tutorial for Garageband?

    Is there a simple tutorial for Garageband?