Default value for attribute "COUNTRY" in BP_HEAD_SEARCH/MainSearch

Hi Gurus,
Requirement is to set default value for attribute "COUNTRY" in BP_HEAD_SEARCH/MainSearch when user clicks on Corporate Account.
Below is code that i have written in DO_PREPARE_OUTPUT.
Code is working fine and in the debug also i can see the value of COUNTRY is set to DE, but it is not showing on the screen for first time but when i load component second time(Refresh the screen), it shows me value.
Any help would be appreciated. If somebody has otheralternative kindly share.
  CALL METHOD super->do_prepare_output( iv_first_time = iv_first_time ).
Calling Super Method
CALL METHOD super->do_prepare_output
   EXPORTING
     iv_first_time = abap_true.
Data Declatation
  DATA :lr_col            TYPE REF TO if_bol_bo_col,
        lr_current        TYPE REF TO if_bol_bo_property_access,
        lr_param          TYPE REF TO if_bol_bo_property_access,
        lr_qs             TYPE REF TO cl_crm_bol_dquery_service,
        lv_attr_name      TYPE name_komp,
        lv_sign           TYPE bapisign,
        lv_option         TYPE bapioption,
        w_country_exist   TYPE c,
        w_param           TYPE string,
        w_value           TYPE string,
        w_flag            TYPE c.
Getting SEARCH Context Node
  lr_qs ?= me->typed_context->search->collection_wrapper->get_current( ).
Get Selection Parameters
  lr_col ?= lr_qs->get_selection_params( ).
Start from first parmaters
  lr_current = lr_col->get_first( ).
Clearing Variables
  CLEAR : w_country_exist, w_flag, w_param, w_value.
Loop till we have selection paramters
  WHILE lr_current IS BOUND.         " While loop 1
checking attribute name is COUNTRY then setting some variable
    w_param = lr_current->get_property_as_string( 'ATTR_NAME' ).
    CASE w_param.
      WHEN 'COUNTRY'.
If country is filled then setting variable
        w_value = lr_current->get_property_as_string( 'LOW' ).
        IF w_value IS NOT INITIAL.
          w_country_exist = abap_true.
        ENDIF.
When we got COUNTRY attribute then setting flag
        w_flag = abap_true.
    ENDCASE.
Calling next parameter
    lr_current = lr_col->get_next( ).
  ENDWHILE.                          " While loop 1
In below block we are checking is COUNTRY attribute is blank and
we have found COUNTRY attribute in current selection paramters
  IF lr_qs IS BOUND.                 " SEACRCH CONTEXT BOUND
If vairable is blank means DE or any other value is not filled in COUNTRY Attribute
    IF w_country_exist IS INITIAL.   " w_contry_exist
We have to add selection attribute if we come accross COUNTRY attribute during our search
      IF w_flag EQ abap_true.        " w_flag
Adding COUNTRY attribute with default value 'DE'
        lr_qs->add_selection_param( EXPORTING iv_attr_name = 'COUNTRY'
                                              iv_sign      = 'I'
                                              iv_option    = 'EQ'
                                              iv_low       = 'DE' ).
      ENDIF.                         " w_flag
    ENDIF.                           " w_contry_exist
  ENDIF.                             " SEACRCH CONTEXT BOUND
In below block we will remove COUNTRY attribute when it has blank value
  IF lr_qs IS BOUND AND w_country_exist IS INITIAL.
    lr_current = lr_col->get_first( ).
    WHILE lr_current IS BOUND.
      w_param = lr_current->get_property_as_string( 'ATTR_NAME' ).
      CASE w_param.
        WHEN 'COUNTRY'.
          w_value = lr_current->get_property_as_string( 'LOW' ).
          IF w_value IS INITIAL.
            lr_col->remove( iv_bo = lr_current ).
          ENDIF.
      ENDCASE.
      lr_current = lr_col->get_next( ).
    ENDWHILE.
  ENDIF.
Edited by: Harsharandeep Singh on Apr 28, 2011 3:44 PM

Hi,
Try it like this:
  DATA:
    lr_bo        TYPE REF TO if_bol_bo_property_access ,
    lv_attr_name TYPE name_komp.
  FIELD-SYMBOLS:
    <ls_param>   TYPE crms_thtmlb_search_criterion.
  READ TABLE parameters
       ASSIGNING <ls_param>
       WITH KEY field = 'COUNTRY'.
  IF ( sy-subrc = 0 ).
    <ls_param>-value1 = ip_pfct.
  ENDIF.
  CHECK ( me->parameter_collection IS NOT INITIAL ).
  lr_bo = me->parameter_collection->get_first( ).
  WHILE lr_bo IS BOUND.
    CALL METHOD lr_bo->get_property_as_value
      EXPORTING
        iv_attr_name = 'ATTR_NAME'
      IMPORTING
        ev_result    = lv_attr_name.
    IF lv_attr_name EQ 'COUNTRY' .
      CALL METHOD lr_bo->set_property
        EXPORTING
          iv_attr_name = 'LOW'
          iv_value     = 'DE'.
      EXIT.
    ELSE.
      lr_bo = me->parameter_collection->get_next( ) .
    ENDIF.
  ENDWHILE .
Kind regards,
Micha

Similar Messages

  • Is there any way we can set default value for a Date Attribute to current date in Master Data Services

    Is there any way we can set default value for a Date Attribute to current date in Master Data Services.
    I as well wants to know that is there any posibility to show Calendar control while input data into respective date attributes.
    Thanks.

    Hi Anagha,
    So far i havent found any way to set todays date by default from MMI, but i guess this flow should work as workaroud
    1. Add buisness rule which can set a default value when Date = NULL/Blank
    2.get the entity table ,use -select EntityTable from mdm.tblEntity where Name = '<enter entity name>'
    3.Go to that table and add a after update trigger like
    if uda_<entityid>_<attributeid(Date attribute)> = default value
    update uda_<entityid>_<attributeid(Date attribute)> =getdate() where id = <LastUpdatedRow>
    I will check on this too from my side.
    By the way AFAIK i dont think so calendar control integration is possible .

  • How to set default value for vc2_255_arr in plsql parameter directive?

    Hi,
    I would like to set a default values for a plsql parameter which is of vc2_255_arr type. How to do that?
    Below is the example from PL/SQL Server Page.
    +" To set a default value, so that the parameter becomes optional, include a default="expression" attribute in the directive. The values for this attribute are substituted directly into a PL/SQL statement, so any strings must be single-quoted, and you can use special values such as null, as in the following example:+
    +<%@ plsql parameter="p_last_name" default="null" %> "+
    My plsql parameter is p_arr which is of "TYPE vc2_255_arr IS TABLE OF VARCHAR2(255) INDEX BY BINARY_INTEGER"
    *<%@ plsql parameter="p_arr" type="PMP_LIB.VC2_255_ARR" %>*
    Thanks in advance!
    kwong

    My plsql parameter is p_arr which is of "TYPE vc2_255_arr IS TABLE OF VARCHAR2(255) INDEX BY BINARY_INTEGER"You need to declare it in a package specification and initialize in the package body:
    SQL> create or replace package pmp_lib
    as
       type vc2_255_arr is table of varchar2 (255)
                              index by binary_integer;
       vc2_255_arr_default   vc2_255_arr;
    end pmp_lib;
    Package created.
    SQL> create or replace package body pmp_lib
    as
    begin
       vc2_255_arr_default (1) := 'abc';
       vc2_255_arr_default (2) := 'def';
    end pmp_lib;
    Package body created.
    SQL> declare
       arr   pmp_lib.vc2_255_arr := pmp_lib.vc2_255_arr_default;
    begin
       for i in 1 .. arr.count
       loop
          dbms_output.put_line (arr (i));
       end loop;
    end;
    abc
    def
    PL/SQL procedure successfully completed.so in your case it would probably be sth like (assuming pmp_lib is a package):
    <%@ plsql parameter="p_arr" type="PMP_LIB.VC2_255_ARR" default = "PMP_LIB.vc2_255_arr_default" %>

  • How to set a default value for particular field in SRM PO Portal

    Dear Gurus,
    Im desparetly need a help in web dynpro on how to set a default value for a field(flag) in PO header tab in portal.
    My requirement is whenever the user press the edit button in PO screen,automatically a flag field should be set as abap_false.
    I dont think this will handle in check badi or change badi. i tried this part in onbuttonpressed overwriteexit in CNR_VIEW views,i can get the function EDIT in debugging mode,but dont know how to proceed further.....
    Many of them suggested to go with get attribute and set attribute for changing any particular field in web dynpro,but im not very familiar in using those get and set attributes.I request you people can give me sample code on how to identify my target field in the node and set the values while pressing EDIT Button.
    Thanks in advance...
    Regards,
    Sathish

    Dear Laurent,
    Thanks for your response,
    But i searched in enhancement spot of WD_BADI, but couldnt get the exact way to change the coding,
    My real requirement is, that particular flag should be enable and disable dynamically by checking a condition in my header values.So in that case i dont know how to proceed further to handle in the PO screen.
    Kinly guide me how to get the particular node of field in the Purchase order screen.
    Thanks you in advance,
    Sorry for the inconvenience if any
    Regards,
    sathish

  • Account Creation - Badi for Default values for BP Role and Sales Area

    Hi all,
    my requirement regards the possibility to create a new prospect (a link should be available in the navigation bar or create section).
    Logically, a bp role as "Prospect" and particoular sales area should be created automatically.
    I created an implementation for the BADI definition "BADI_CRM_BP_UIU_DEFAULTS". But don't know how to create the default values for BP role and Sales area:
    In my code
    assign cr_me->('VIEW') to <lv_view_name>.
      if sy-subrc ne 0.
        exit.
      endif.
      lv_viewname = <lv_view_name>.
      case lv_viewname.
        when 'AccountDetails.htm'.
    I obtain the viewname "AccountDetails" , the related context "Header". After I don't know how to proceed to obtain the related entities through the relationship BuilRolesRel and BuilSalesArrangementRel.
    Am I following the right way? Is there another solution to prepare the output for default values?
    Any kind of suggestion will be appreciated.
    Regards, Roberto

    go to spro>cross-application components>sap busines partner>business partner> basic settings>field groupings>Configure Field Attributes per BP Role
    Double click the business role which you want to customaze (e.g. 'A') and change the proper settings.
    Regards.

  • Default Values for Select-options In Webdynpro-ABAP

    Hi Freinds,
    Kindly,Help me in setting the Default values for the Select-options in Webdynpro ABAP.
    Here the Node and the Attributes are Created Dynamically, and then Displayed Select-options Component View.
    Regards,
    Xavier.P

    Xavier Reddy Penta sent me this question via email and I answered it directly yesterday. Here is the solution that I provided to him, so that it is stored with the original question:
    I believe your problem is that you are not setting the value into the range correctly.  You are setting it directly into the field symbol of the range like such:
    <FS> = L_STRING2.
    But ranges are deep objects. They have four fields: Sign, Option, High, and Low. This is from the online help:
    1.     sign of type c and length 1. The content of sign determines for every row whether the result of the condition formulated in the column is included or excluded in the entire resulting set for all rows. Evaluable values are "I" for include and "E" for exclude.
    2.     option of type c and length 2. option contains the selection option for the condition of the row in form of logical operators. Analyzable operators are "EQ", "NE", "GE", "GT", "LE", "LT", "CP" and "NP" if column high is initial, and "BT", "NB" if column high is not initial. With the options "CP" and "NP", the data type of the columns low and high must be of the data type c, and special rules apply for entries on the selection screen.
    3.     low of the data type defined after FOR. This column is designated for the comparison value or the lower interval limitation.
    4.     high of the data type defined after FOR. This column is designated for the upper interval limitation.
    So when you are moving the value into the field symbol you are setting it into the sign column.
    Here is an example of how you can access the components of the range:
    * create a range table that consists of this new data element
        lt_range_table =
          wd_this->lv_sel_handler->create_range_table(
               i_typename = l_typename ).
        IF l_fieldname = 'CARRID'.
          FIELD-SYMBOLS: <tab>         TYPE INDEX TABLE,
                             <struct>      TYPE ANY,
                             <wa>          TYPE ANY,
                             <option>      TYPE char2,
                             <sign>        TYPE char1,
                             <high>        TYPE ANY,
                             <low>         TYPE ANY,
                             <wa_values>   TYPE ANY.
          ASSIGN lt_range_table->* TO <tab>.
          APPEND INITIAL LINE TO <tab> ASSIGNING <wa>.
          ASSIGN COMPONENT 'OPTION' OF STRUCTURE <wa> TO <option>.
          ASSIGN COMPONENT 'HIGH' OF STRUCTURE <wa> TO <high>.
          ASSIGN COMPONENT 'LOW' OF STRUCTURE <wa> TO <low>.
          ASSIGN COMPONENT 'SIGN' OF STRUCTURE <wa> TO <sign>.
          <sign> = 'I'.
          <option> =  'EQ'.
          <low> = 'AA'.
        ENDIF.

  • Set a default value for a radio button populated with a List of value

    Hi,
    I am using jdeveloper 11.1.1.3.0. I need to set a default value for a radio button populated with a List of value(Yes/No). Here's the selectonechoice code.
    <af:selectOneRadio value="#{bindings.Code.inputValue}"
    label="#{bindings.Code.label}"
    required="#{bindings.Code.hints.mandatory}"
    shortDesc="#{bindings.Code.hints.tooltip}"
    id="sor1" autoSubmit="true"
    valuePassThru="true" layout="horizontal">
    <f:selectItems value="#{bindings.Code.items}" id="si1"/>
    </af:selectOneRadio>
    I want to have the selectonechoice set to No by default. In the previous versions, I set the default value in the base attribute VO. But it is not working in the new version.
    Thanks

    Hi,
    this should work in JDeveloper 11.1.1.3 the same as in 11.1.1.2. If it doesn't then it is better to file a bug than to work around it
    Frank

  • Set Default Value for a Date Navigator

    Hi all
    Is it possible to set a default value for a date navigator.I mean with out picking the date from the Navigator, on load of the view itself i need a particualr date to be displayed (say 12/31/2000).
    Thanks in advance

    Hi,
      create a value attribute of type date bind to the input field and in wdInit()of view controller write this code..
      wdContext.currentContextElement().setValueAttrName(new Date(Calendar.getInstance().getTimeInMillis()));
    means ...
    u r setting the date entered into some context ....
    type of that attribute must be of date and for initial value write the above code ..if it is under node element create nodeelement bind it to context and write the code accordingly..
    Message was edited by: Yashpal Gupta

  • Default Values For Foreign Trade Header Data

    Hello,
    I have defined a price condition (ZPFR) to gather the price from the company to the custom office (the customs office through which the goods enter or leave the country).
    I want that price condition to be determined in the pricing procedure in foreign trades. The fields in the access sequence are the Plant and the Customs office. In customizing, in the point “Default Values For Foreign Trade Header Data”, I have defined a line for the Departure country, the Destination Country and the proper values for the Office of exit, Export Custom Office and Office of destination (the same that I have selected in the condition record). But when I create a sale document, this condition does not determine because the Customs office seems not to have any value in the document. Does anybody what I am doing wrong?
    Thank you in advance,
    Silvia

    You require to do thenecessay configuration for Foreign Trade Data:
    IMG --> Sales and Distribution --> Foreign Trade/Customs --> Basic Data for Foreign Trade --> (Do the necessary configuration here)
    In most probability, it will not default, but it is required to be maintained in Invoice (based on configuration)
    Regards,
    Rajesh Banka
    Reward points if helpful.

  • ADF 10.1.3 -  Default value for radio button

    Hi
    How to set the default value for Radio button?
    I have Yes and No fixed values for a radio button, and couldn't find any option to set the default value.
    How can I set Yes as default value?
    Appreciate your help.

    FrameworkSpl,
    What are you using for the model layer? If you are using ADF Business Components, simply set the default value for the attribute upon which you are basing the radio buttons.
    John

  • How to set a default value for a drop down list box and then apply cascading based on the default value in Infopath 2010.

    Hello Everyone
    I have two drop downs. Both are coming from look up fields from two lists. i want to set a default value(first list item) for the first drop down list box and then apply cascading based on the default value for the next drop down list box. I found one article(http://www.bizsupportonline.net/infopath2010/display-first-item-drop-down-list-box-infopath-2010.htm)
    where in i can set a default value but i can't apply cascading based on that default value. Any suggestions would be highly appreciated.
    Thanks
    Ramanjulu Naidu N

    Hey Ramanjulu,
    Take a look at the below article which I believe will answer your question.
    http://basquang.wordpress.com/2010/03/29/cascading-drop-down-list-in-sharepoint-2010-using-infopath-2010/
    Daniel Christian (MCTS)

  • SRM 4.0- How to set the default values for product type (01) only for SC

    The radio button “Service” should not be visible.
    Also for search help (e.g. search for internal products) where a search should only be possible for product type 01 (goods). The system should not display the product type and internally always search for goods only.
    How to set the default values for product type (01) only for SC
    We needs to use Search help BBPH_PRODUCT which having parameter PRODUCT_TYPE
    Here we can set defalut value 01 but it is not correct one since same search help is using several places.
    We need to limit the search help results only for SC.
    Kindly help out me ASAP.

    The easiest way to set defautl values is to edit the batch class.
    Goto the characteiristic and go to update values.
    In here you probably have something like 0 - 100 as a spec range.
    On the next line enter the default value within this range.  At the end of the line, click in the box in the column labelled "D".  This indicates the defautl value for the characteristic.
    If you need to you can do this in the material classification view as well.
    Just to be clear, these values will only show up in the batch record.  You can not have defautl values in resutls recording screens.
    FF

  • I need to pass null as a default value for a parameter in Before Trigger

    Hi All,
    I am using Before trigger function in calculation tab which has some set of parameters.So, I accept some parameters which are passed to this Before Trigger function and need these parameters default value as null.
    To be clear I want to set the Default value for a parameter in workbook to be NULL and pass the same to the calling Function.
    please help me.
    Thanks in advance

    Hi All,
    I am using Before trigger function in calculation tab which has some set of parameters.So, I accept some parameters which are passed to this Before Trigger function and need these parameters default value as null.
    To be clear I want to set the Default value for a parameter in workbook to be NULL and pass the same to the calling Function.
    please help me.
    Thanks in advance

  • How to use one variable as a default value for another variable?

    Hi Experts,
    Is it possible to use one variable as a default value for another variable?
    For example:
    Variable 1 = current calendar year month
    Variable 2 = mandatory input ready variable for calendar year month
    I want to use variable 1 as default value for variable 2, but also have the ability to change the month if required.
    Thanks!
    Kathryn

    u can use replacement path variable
    in that case u can replace the values of 1 variable with the another variable...
    but  u cannot do this setting
    u cannot make variable 2 as mandatory
    u cannot enter value for variable 2
    because by default it will take the value of variable 1
    u have to make follow settings
    variable 2
    name , technical name
    processing by = replacement path
    infoobject = ocalmonth
    next tab
    replaced by another variable
    variable name
    offset start , offset lenght
    save and hit okey

  • How to set a default value for a page item

    I am working with a facility table that has name and address information. The user can add contact name information on a separate page. Since the address for the facility and contact is usually the same, I want to add a default value for the contact address. The facility page is on 201 and the link to add a new contact row is on page 202. I showed in the default value :P201_street for the contact's address. But, when I run the page, the contact address field shows the :P201_street, not the actual facility address. What am I leaving out? Must be something obvious?!
    Thanks very much.
    Judy

    In the default value, I showed: v('P201_STREET1') with the default value type of: PL/SQL Expression and received the following oracle error ==> Item default is not a PL/SQL expression. Use &ITEM syntax. The v('ITEM') syntax is not valid for item defaults. So I changed it to: &P201_STREET1 and got another oracle error , ERR-9132 error in PLSQL expression for item default code, item=P202_STREET1.
    Any more suggestions? Thx.
    Judy

Maybe you are looking for