cancel
Showing results for 
Search instead for 
Did you mean: 

WD4A - Selection screen default values loading

Former Member
0 Kudos

Hi,

We are developing one new report using WD4A and that report has a huge logic and big selection screen with 86 fields. Along with it, we do have to simulate the Selection Screen Variant Operation(Create/Display/Change/Delete Variants).

Since the number of fields being high, we decided to use a RSPARAMS Table(Context element with 0-n cardinality) to store in the entire selection screen values.

We were able to capture the values of Selection screen into this Context variable using one generic code, without using any specific field name.

But now I am stuck with repopulating the Sel Screen fields with the Context Variables. Like I have the Sel Screen data in the Context and when I trying to set the values of each field dynamically, I get an error/dump since the HIGH/LOW field types changes dynamically based on the field type.

So I was wondering if any one have faced a similar problem ? What could be the solution ? Or atleast it would be great, if someone could provide a snippet of code that sets the default values of the 4 fields of selection screen.

Hope Am clear.

Regards

<i><b>Raja Sekhar</b></i>

Accepted Solutions (1)

Accepted Solutions (1)

raja_thangamani
Active Contributor
0 Kudos

When you used UPD_SELECTION_FIELD earlier, it didnt work for you becos, you did a mistake by using wrong reference variable.

Raja T

Former Member
0 Kudos

Raja,

You wont believe it, the following code is still not working...

* get the current selection fields and update the result area
  wd_this->l_handler->get_selection_fields( importing et_fields = lt_fields ).
  wd_this->l_handler->get_parameter_fields( importing et_fields = lt_param_fields ).

  if lines( lt_fields ) > 0 or lines( lt_param_fields ) > 0.

    loop at lt_fields assigning <field>.

******************Yet to complete this part *****************

*   get the range table of that field
      lit_range_table = wd_this->l_handler->get_range_table_of_sel_field( <field>-m_id ).

      check lit_range_table is not initial.

* clear the existing content
*      wd_this->l_handler->RESET_SELECTION_FIELD( i_id = <field>-m_id ).

* Get the pointer of the new table and form it freshly
      assign lit_range_table->* to <lt_new_range_table>.

* Get the values into our SELSCREEN Internal Table
      LOOP AT LIT_SELSCREEN_DATA INTO LWA_SELSCREEN_DATA where selname = <field>-m_id.

        insert initial line into table <lt_new_range_table> assigning <range_table_line>.

        assign component 'SIGN'   of structure <range_table_line> to <sign>.
        assign component 'OPTION' of structure <range_table_line> to <option>.
        assign component 'LOW' of structure <range_table_line> to <low>.
        assign component 'HIGH' of structure <range_table_line> to <high>.

        <sign> = LWA_SELSCREEN_DATA-SIGN.
        <option> = LWA_SELSCREEN_DATA-OPTION.
        <low> = LWA_SELSCREEN_DATA-LOW.
        <high> = LWA_SELSCREEN_DATA-HIGH.

        APPEND <range_table_line> to <lt_new_range_table>.

      ENDLOOP.
      CALL METHOD WD_THIS->L_HANDLER->UPD_SELECTION_FIELD
        EXPORTING
          I_ID      = <field>-m_id
          IT_RESULT = LIT_RANGE_TABLE.

Regards

<b>Raja Sekhar</b>

raja_thangamani
Active Contributor
0 Kudos

My code was working as long as i dont have loop on selection, as soon as I introducded the Loop, it stopped working, after further changes, i found out that

you need to uncomment below line in your code.

 wd_this->l_handler->RESET_SELECTION_FIELD( i_id = <field>-m_id ).

I am adding my code below which smiliar to yours:


*   get the range table of that field
  DATA LIT_RANGE_TABLE TYPE REF TO  DATA.

  FIELD-SYMBOLS: <LT_NEW_RANGE_TABLE> TYPE TABLE,
                 <FS_RANGE> TYPE ANY,
                 <field> TYPE any,
                 <LOW> TYPE ANY,
                 <SIGN> TYPE ANY,
                 <HIGH> TYPE ANY.
DATA: lt_fields TYPE IF_WD_SELECT_OPTIONS=>TT_SELECTION_SCREEN_ITEM,
      wa_fields LIKE LINE OF lt_fields.

wd_this->m_handler->get_selection_fields( importing et_fields = lt_fields ).

 loop at lt_fields INTO wa_fields.

CLEAR: LIT_RANGE_TABLE.

 wd_this->m_handler->RESET_SELECTION_FIELD( i_id = wa_fields-m_id ).

  LIT_RANGE_TABLE = WD_THIS->M_HANDLER->GET_RANGE_TABLE_OF_SEL_FIELD( wa_fields-m_id ).

* Get the pointer of the new table and form it freshly
  ASSIGN LIT_RANGE_TABLE->* TO <LT_NEW_RANGE_TABLE>.

  INSERT INITIAL LINE INTO TABLE <LT_NEW_RANGE_TABLE> ASSIGNING <FS_RANGE>.

  ASSIGN COMPONENT 'SIGN' OF STRUCTURE <FS_RANGE> TO <SIGN>.
  ASSIGN COMPONENT 'LOW' OF STRUCTURE <FS_RANGE> TO <LOW>.
  ASSIGN COMPONENT 'HIGH' OF STRUCTURE <FS_RANGE> TO <HIGH>.

IF wa_fields-m_id EQ 'S_CARR_ID'.

<SIGN> = 'I'.

  <LOW> = 'AA'.
  <HIGH> = 'LH'.
ELSEIF wa_fields-m_id EQ 'S_CONN_ID'.
<SIGN> = 'E'.

  <LOW> = '400'.
  <HIGH> = '412'.
ENDIF.


  INSERT INITIAL LINE INTO TABLE <LT_NEW_RANGE_TABLE> ASSIGNING <FS_RANGE>.

  ASSIGN COMPONENT 'SIGN' OF STRUCTURE <FS_RANGE> TO <SIGN>.
  ASSIGN COMPONENT 'LOW' OF STRUCTURE <FS_RANGE> TO <LOW>.
  ASSIGN COMPONENT 'HIGH' OF STRUCTURE <FS_RANGE> TO <HIGH>.

IF wa_fields-m_id EQ 'S_CARR_ID'.

<SIGN> = 'I'.

  <LOW> = 'AF'.
ELSEIF wa_fields-m_id EQ 'S_CONN_ID'.
<SIGN> = 'E'.

  <LOW> = '712'.

ENDIF.
*  APPEND <FS_RANGE> TO <LT_NEW_RANGE_TABLE>.
CALL METHOD WD_THIS->M_HANDLER->UPD_SELECTION_FIELD
  EXPORTING
    I_ID                      = wa_fields-m_id "'S_CARR_ID'
*    I_WITHIN_BLOCK            = MC_ID_MAIN_BLOCK
*    I_DESCRIPTION             =
*    I_IS_AUTO_DESCRIPTION     = ABAP_TRUE
    IT_RESULT                 =  LIT_RANGE_TABLE
*    I_OBLIGATORY              = ABAP_FALSE
*    I_COMPLEX_RESTRICTIONS    =
*    I_USE_COMPLEX_RESTRICTION = ABAP_FALSE
*    I_NO_COMPLEX_RESTRICTIONS = ABAP_FALSE
*    I_VALUE_HELP_TYPE         = IF_WD_VALUE_HELP_HANDLER=>CO_PREFIX_NONE
*    I_VALUE_HELP_ID           =
*    I_VALUE_HELP_MODE         =
*    I_HELP_REQUEST_HANDLER    =
*    I_LOWER_CASE              =
*    I_MEMORY_ID               =
*    I_NO_EXTENSION            = 'X'
*    I_NO_INTERVALS            = 'X'
*    I_AS_CHECKBOX             = ABAP_FALSE
*    I_AS_DROPDOWN             = ABAP_FALSE
*    IT_VALUE_SET              =
*    I_READ_ONLY               = ABAP_FALSE
*    I_EXPLANATION             =
*    I_TOOLTIP                 =
    .
ENDLOOP.

ENDMETHOD.

Hope this time you will solve this issue.

Raja T

raja_thangamani
Active Contributor
0 Kudos

also comment <i>APPEND <range_table_line> to <lt_new_range_table>.</i> line also. This is not required, since you already referencing the table.

Raja T

Former Member
0 Kudos

Hi Raja,

Thanks a lot.

Itz working with the loop also. We just added this statement before external loop.

wd_this->l_handler->RESET_ALL_SELECTION_FIELDS( ).

I should really appreciate your patientence to follow up my problem and closely give solutions. I gave the maximum points that I could.

Regards

<i><b>Raja Sekhar</b></i>

raja_thangamani
Active Contributor
0 Kudos

Glad to see your issue is resolved finally.

Raja T

Answers (1)

Answers (1)

raja_thangamani
Active Contributor
0 Kudos

Where do you have issue? while populating the actual selection screen field from RSPARAM table?

Pls explain bit more & your code, so that we can assist you better. I did similar kind of development. But I dont understand where you stuck up.

Raja T

Former Member
0 Kudos

Hi Raja,

Thanks for a quick response.

Actually, I was a kind of stuck with a typical issue which I am not able to express so clearly.

Well, I solved that problem myself by declaring the field symbol <low> of type any.

Now, I am wondering how I could delete the exiting values in the selection screen field. I mean I wanted to overwrite the values of existing stuff. How can I do this ? I mean I got the values using the

* get the current selection fields and update the result area
  wd_this->l_handler->get_selection_fields( importing et_fields = lt_fields ).
  wd_this->l_handler->get_parameter_fields( importing et_fields = lt_param_fields ).

  if lines( lt_fields ) > 0 or lines( lt_param_fields ) > 0.

    loop at lt_fields assigning <field>.

* Getting the details of each field
      ASSIGN <field>-mt_range_table->* to <lt_range_table>.

Now, I have the data in lt_range_table. I wanted to delete the values existing in this field symbol. How can I do this?

Regards

<i><b>Raja Sekhar</b></i>

Former Member
0 Kudos

BTW Raja,

Is my Technical design right of using the Context of RSPARAMS with 0..n cardinality to temporarily store the data ?

Also, by any chance , have you managed to work on SELECTION SCREEN VARIANTS in WD4A? Any suggestions for us ?

Your pointers will be very useful.

Regards

<i><b>Raja Sekhar</b></i>

raja_thangamani
Active Contributor
0 Kudos

if it cant be expressed clearly, then let me ask you this way.

you want to delete particular entry in table <lt_range_table> or in lt_fields?

Raja T

Former Member
0 Kudos

Hi Raja,

I think my second query was quiet clear. I mean I want to delete all the existing entries from <lt_range_table> itself. I mean I wanna refresh the selection screen field before re-populating it.

Hope am clear atleast now.

Regards

<i><b>Raja Sekhar</b></i>

Message was edited by:

Raja Sekhar

raja_thangamani
Active Contributor
0 Kudos

Raja sekhar,

Still im not sure whether I understood where you are stuck. but trying to help you, pls let me if i am wrong.

 loop at lt_fields assigning <field>.
 
* Getting the details of each field
      ASSIGN <field>-mt_range_table->* to <lt_range_table>.

* Now you want to reset the low/high values.
     loop at <lt_range_table> into <fs>.
     clear: <fs>-low, <fs>-high
    endloop.
endloop.  

This way you can reset the value. let me know if im wrong.

Raja T

raja_thangamani
Active Contributor
0 Kudos

oops Im sorry i forgot that you can refer any field directly..Here is the modified code:


 loop at lt_fields assigning <field>.
 
* Getting the details of each field
      ASSIGN <field>-mt_range_table->* to <lt_range_table>.
 
* Now you want to reset the low/high values.
     loop at <lt_range_table> into <fs>.

    CONCATENATE
      '<fs>' '-' 'LOW'
      INTO V_FNAME.

    ASSIGN (V_FNAME) TO <FS_VALUE>.
      if sy-subrc = 0.
       clear: <FS_VALUE>.
     endif.

    CONCATENATE
      '<fs>' '-' 'HIGH'
      INTO V_FNAME.

       ASSIGN (V_FNAME) TO <FS_VALUE>.
        if sy-subrc = 0.
        clear: <FS_VALUE>.
        endif.
    endloop.
endloop.  

Raja T

Message was edited by:

Raja Thangamani

Former Member
0 Kudos

Hi Raja,

Thanks a lot for the snippet.

Well, I am kind of stuck with a tricky problem.

See, my requirement is ... When user selects on some variant, I will have to collect to update the sel screen fields with the values as per the variant(I mean to delete the existing values of the screen fields and upload the new values). So as per it, I have coded as shown below.

* navigate from <CONTEXT> to <CWA_SELDATA> via lead selection
  lo_nd_cwa_seldata = wd_context->get_child_node( name = wd_this->wdctx_cwa_seldata ).

  lo_nd_cwa_seldata->GET_STATIC_ATTRIBUTES_TABLE(
    IMPORTING
      TABLE = LIT_SELSCREEN_DATA ).

* @TODO handle not set lead selection
  CHECK LO_ND_CWA_SELDATA IS NOT INITIAL.

* get the current selection fields and update the result area
  wd_this->l_handler->get_selection_fields( importing et_fields = lt_fields ).
  wd_this->l_handler->get_parameter_fields( importing et_fields = lt_param_fields ).

  if lines( lt_fields ) > 0 or lines( lt_param_fields ) > 0.

    loop at lt_fields assigning <field>.

******************Yet to complete this part *****************

*   get the range table of that field
      lit_range_table = wd_this->l_handler->get_range_table_of_sel_field( <field>-m_id ).


*   Get the type of this table dynamically using RTTI
      lr_rtti_range_table ?= cl_abap_typedescr=>describe_by_data_ref( lit_range_table ).

*   Create a new Range Table to store this information
      create data lit_new_range_table type handle lr_rtti_range_table.

*   Assign a field symbol to this existing table for clearing the existing data of the field
      assign lit_range_table->* to <lt_range_table>.
      clear <lt_range_table>. "It clears while I debug
      wd_this->l_handler->set_range_table_of_sel_field( i_id = <field>-m_id it_range_table = lit_range_table ).


* Get the pointer of the new table and form it freshly
      assign lit_new_range_table->* to <lt_new_range_table>.

* Get the values into our SELSCREEN Internal Table
      LOOP AT LIT_SELSCREEN_DATA INTO LWA_SELSCREEN_DATA where selname = <field>-m_id.

        insert initial line into table <lt_new_range_table> assigning <range_table_line>.
        assign component 'SIGN'   of structure <range_table_line> to <sign>.
        assign component 'OPTION' of structure <range_table_line> to <option>.
        assign component 'LOW' of structure <range_table_line> to <low>.
        assign component 'HIGH' of structure <range_table_line> to <high>.
        <sign> = LWA_SELSCREEN_DATA-SIGN.
        <option> = LWA_SELSCREEN_DATA-OPTION.
        <low> = LWA_SELSCREEN_DATA-LOW.
        <high> = LWA_SELSCREEN_DATA-HIGH.

      ENDLOOP.

      wd_this->l_handler->set_range_table_of_sel_field( i_id = <field>-m_id it_range_table = lit_new_range_table ).

    endloop.

During Debugging I can realize that the clear statement clears the data, but after even using SET_RANGE_TABLE_OF_SEL_FIELD, itz not actually deleting the contents of this screen field. I mean the same value still exists. And above it, the new value is not being reset.

Can you help me in these regards Raja ?

Well, Please do let me know if I am still not clear.

BTW,Thanks a lot for constant response. Appreciate your helping nature.

Regards

<i><b>Raja Sekhar</b></i>

raja_thangamani
Active Contributor
0 Kudos

Raja sekhar,

What I can see from your code, after updating the new selection field & value dont need to update the it_fields, the way you are getting with below code

wd_this->l_handler->get_selection_fields( importing et_fields = lt_fields ).

Dont you need to set the value back ?

Raja T

Former Member
0 Kudos

Hi Raja,

Do we have to update the it_fields part also? I mean, Do you have to resend the values ? even after modifying the Range Tables ?

Let us know sir.

Regards

<i><b>Raja Sekhar</b></i>

raja_thangamani
Active Contributor
0 Kudos

you can give try, to update it_fields since its not working just updating the range table.

Did you debug SET_RANGE_TABLE_OF_SEL_FIELD method why its not taking the new Range values? Is it generated method or you developed it?

Raja T

Former Member
0 Kudos

Hi Raja,

Well, I did debug it and everything looks fine. I wonder what could go wrong.

I tried using SET_RANGE_TABLE_OF_SEL_FIELD and UPD_SELECTION_FIELD methods of the selection screen interface - IF_WD_SELECT_OPTIONS.

Seriously, I am wondering if I had missed something thatz small but essential.

Should I have to do some kind of commit work after updating the selection screen for the changes to reflect ?

Hope I will be able to solve it atleast tommorrow.

Regards

<i><b>Raja Sekhar</b></i>

raja_thangamani
Active Contributor
0 Kudos

do you have any method like set_selection_fields to update the it_fields

wd_this->l_handler->set_selection_fields( exporting et_fields = lt_fields ).

Raja T

Former Member
0 Kudos

Hi Raja,

Actually I checked that class once again. But I cant find anything of that sought, I really wonder, how we could actually reset the values of the Selection screen.

I got dead stuck @ this point. Hope I will get some solution soon.

Regards

<i><b>Raja Sekhar</b></i>

raja_thangamani
Active Contributor
0 Kudos

I believe i almost found the solution. I simulated the same in my system & found the issue.

you are getting the <b>reference</b> in variable <i>lit_range_table</i> using below code

lit_range_table = wd_this->l_handler->get_range_table_of_sel_field( <field>-m_id ).

but you are modifing Range table in another variable lit_new_range_table, which <b>has no reference</b>. Thats the reason. See my below code, which works perfectly.

So i would say modify the same reference variable.


  DATA: LT_RANGE_TABLE TYPE REF TO DATA,
 READ_ONLY TYPE ABAP_BOOL.

  LT_RANGE_TABLE = WD_THIS->M_HANDLER->CREATE_RANGE_TABLE( I_TYPENAME = 'S_DATE').

*Add new field to the selection

  WD_THIS->M_HANDLER->ADD_SELECTION_FIELD( I_ID = 'S_DATE'
                                           IT_RESULT = LT_RANGE_TABLE
                                           I_READ_ONLY = READ_ONLY ).


*   get the range table of that field
  DATA LIT_RANGE_TABLE TYPE REF TO  DATA.

  FIELD-SYMBOLS: <LT_NEW_RANGE_TABLE> TYPE TABLE,
                 <FS_RANGE> TYPE ANY,
                 <LOW> TYPE ANY,
                 <HIGH> TYPE ANY.

  LIT_RANGE_TABLE = WD_THIS->M_HANDLER->GET_RANGE_TABLE_OF_SEL_FIELD( 'S_DATE' ).

* Get the pointer of the new table and form it freshly
  ASSIGN LIT_RANGE_TABLE->* TO <LT_NEW_RANGE_TABLE>.

  INSERT INITIAL LINE INTO TABLE <LT_NEW_RANGE_TABLE> ASSIGNING <FS_RANGE>.

  ASSIGN COMPONENT 'LOW' OF STRUCTURE <FS_RANGE> TO <LOW>.
  ASSIGN COMPONENT 'HIGH' OF STRUCTURE <FS_RANGE> TO <HIGH>.

  <LOW> = '20070101'.
  <HIGH> = '20070110'.
  APPEND <FS_RANGE> TO <LT_NEW_RANGE_TABLE>.

Raja T

Former Member
0 Kudos

Hi Raja,

This seems to be a wonderful pointer. But unfortunately, it's still not working even after modfying my code as you said. Well check out my coding.

  DATA lo_nd_cwa_seldata TYPE REF TO if_wd_context_node.
  DATA lo_el_cwa_seldata TYPE REF TO if_wd_context_element.
  DATA ls_cwa_seldata TYPE wd_this->element_cwa_seldata.
  DATA LWA_SELDATA TYPE RSPARAMS.

* navigate from <CONTEXT> to <CWA_SELDATA> via lead selection
  lo_nd_cwa_seldata = wd_context->get_child_node( name = wd_this->wdctx_cwa_seldata ).

  lo_nd_cwa_seldata->GET_STATIC_ATTRIBUTES_TABLE(
    IMPORTING
      TABLE = LIT_SELSCREEN_DATA ).

* @TODO handle not set lead selection
  CHECK LO_ND_CWA_SELDATA IS NOT INITIAL.

* get the current selection fields and update the result area
  wd_this->l_handler->get_selection_fields( importing et_fields = lt_fields ).
  wd_this->l_handler->get_parameter_fields( importing et_fields = lt_param_fields ).

  if lines( lt_fields ) > 0 or lines( lt_param_fields ) > 0.

    loop at lt_fields assigning <field>.

******************Yet to complete this part *****************

*   get the range table of that field
      lit_range_table = wd_this->l_handler->get_range_table_of_sel_field( <field>-m_id ).

      check lit_range_table is not initial.

* clear the existing content
      wd_this->l_handler->RESET_SELECTION_FIELD( i_id = <field>-m_id ).

* Get the pointer of the new table and form it freshly
      assign lit_range_table->* to <lt_new_range_table>.

* Get the values into our SELSCREEN Internal Table
      LOOP AT LIT_SELSCREEN_DATA INTO LWA_SELSCREEN_DATA where selname = <field>-m_id.

        insert initial line into table <lt_new_range_table> assigning <range_table_line>.

        assign component 'SIGN'   of structure <range_table_line> to <sign>.
        assign component 'OPTION' of structure <range_table_line> to <option>.
        assign component 'LOW' of structure <range_table_line> to <low>.
        assign component 'HIGH' of structure <range_table_line> to <high>.

        <sign> = LWA_SELSCREEN_DATA-SIGN.
        <option> = LWA_SELSCREEN_DATA-OPTION.
        <low> = LWA_SELSCREEN_DATA-LOW.
        <high> = LWA_SELSCREEN_DATA-HIGH.

        APPEND <range_table_line> to <lt_new_range_table>.

      ENDLOOP.

      wd_this->l_handler->set_range_table_of_sel_field( i_id = <field>-m_id it_range_table = lit_range_table ).
ENDLOOP.

I really wonder even now why this thing is not working after modifying also. Please check out my snippet once.

Regards

<i><b>Raja Sekhar</b></i>

raja_thangamani
Active Contributor
0 Kudos

The last line,

 wd_this->l_handler->set_range_table_of_sel_field( i_id = <field>-m_id it_range_table = lit_range_table ).

not required, remove that please.

Let me know how it goes..

Raja T

Former Member
0 Kudos

Hi,

I have even done that...Not result...I am really wondering whethear this could be feasible or not...Like I mean, Extracting the entire selection criteria using get_fields method, updating the Selection fields...

I think I will have to regenerate the selection screen once again...What do you say???

Raja, if you are in US, do you mind sharing your contact info...May be I can talk to you in person...or atleast can u pass your email info...I can send the screenshot info...Sorry itz against Forum rules, but am running out of time and choice...

Regards

<i><b>Raja Sekhar</b></i>

Message was edited by:

Raja Sekhar

raja_thangamani
Active Contributor
0 Kudos

What code do you have in WDINIT?

I am trying to do as same as your code in my system. Let you know as soon as i have something..

Raja T

Message was edited by:

Raja Thangamani

Former Member
0 Kudos

Done...

Would be waiting to hear from you soon.

Thanks once again.

Regards

<i><b>Raja Sekhar</b></i>

raja_thangamani
Active Contributor
0 Kudos

What code you have written in WDDOINIT?

Raja T

Former Member
0 Kudos

Hi,

Please find my code below.

method WDDOINIT .

***********************************************************************
* Set the Mode
***********************************************************************

  DATA lo_nd_cwa_selscreen TYPE REF TO if_wd_context_node.
  DATA lo_el_cwa_selscreen TYPE REF TO if_wd_context_element.
  DATA ls_cwa_selscreen TYPE wd_this->element_cwa_selscreen.
  DATA lv_mode_selcrit LIKE ls_cwa_selscreen-mode_selcrit.

*   navigate from <CONTEXT> to <CWA_SELSCREEN> via lead selection
  lo_nd_cwa_selscreen = wd_context->get_child_node( name = wd_this->wdctx_cwa_selscreen ).

*   get element via lead selection
  lo_el_cwa_selscreen = lo_nd_cwa_selscreen->get_element(  ).

*   Set the mode as Q ( Q - Quick and E - Entire )
  lv_mode_selcrit = 'Q'.

*   set single attribute
  lo_el_cwa_selscreen->set_attribute(
    EXPORTING
      name =  `MODE_SELCRIT`
      value = lv_mode_selcrit ).

  DATA : lr_value            type ref to data.

  data : lr_componentcontroller type ref to ig_componentcontroller,
         l_ref_cmp_usage type ref to if_wd_component_usage.

* Design the Selection Screen based on the Mode

  l_ref_cmp_usage = wd_this->wd_cpuse_select_options( ).
  if l_ref_cmp_usage->has_active_component( ) is initial.
    l_ref_cmp_usage->create_component( ).
  endif.

  wd_this->l_wd_select_options = wd_this->wd_cpifc_select_options( ).

  wd_this->l_handler = wd_this->l_wd_select_options->init_selection_screen( ).

* Hides the default buttons
  wd_this->l_handler->SET_GLOBAL_OPTIONS(
    I_DISPLAY_BTN_CANCEL = ABAP_FALSE
    I_DISPLAY_BTN_CHECK = ABAP_FALSE
    I_DISPLAY_BTN_RESET = ABAP_FALSE
    I_DISPLAY_BTN_EXECUTE = ABAP_TRUE ).

* Always the Quick selection screen comes by default
* Add a block
  wd_this->l_handler->ADD_BLOCK(
    i_id = 'BLOCK1'
    i_title = 'Equipment selection' ).

* Add the Serial number Select options.
  lr_value = wd_this->l_handler->create_range_table( i_typename = 'GERNR' ).
  wd_this->l_handler->add_selection_field(
    i_id = 'SERNR'
    I_WITHIN_BLOCK = 'BLOCK1'
    it_result = lr_value
    i_read_only = abap_false ).

* Add the functional Location Select Option
  lr_value = wd_this->l_handler->create_range_table( i_typename = 'IFLOS-TPLNR' ).
  wd_this->l_handler->add_selection_field(
    i_id = 'STRNO'
    I_WITHIN_BLOCK = 'BLOCK1'
    it_result = lr_value
    i_read_only = abap_false
    i_value_help_id   = 'IFLM'
    i_value_help_type = if_wd_value_help_handler=>co_prefix_searchhelp ).

* Add the Equipment Select Option
  lr_value = wd_this->l_handler->create_range_table( i_typename = 'EQUNR' ).
  wd_this->l_handler->add_selection_field(
    i_id = 'EQUNR'
    I_WITHIN_BLOCK = 'BLOCK1'
    it_result = lr_value
    i_read_only = abap_false ).
*    i_value_help_id   = 'IFLM'
*    i_value_help_type = if_wd_value_help_handler=>co_prefix_searchhelp ).

* Add the Custom Select Option
  lr_value = wd_this->l_handler->create_range_table( i_typename = 'KUND1' ).
  wd_this->l_handler->add_selection_field(
    i_id = 'KUND1'
    I_WITHIN_BLOCK = 'BLOCK1'
    it_result = lr_value
    i_read_only = abap_false
    i_value_help_id   = 'DEBI'
    i_value_help_type = if_wd_value_help_handler=>co_prefix_searchhelp ).



endmethod.

Regards

<i><b>Raja Sekhar</b></i>

raja_thangamani
Active Contributor
0 Kudos

Here is the deal Raja sekhar,

Finally it worked for me...UPD_SELECTION_FIELD

It shd work for you too.. Try & let me know.


 DATA lo_nd_cwa_seldata TYPE REF TO if_wd_context_node.
  DATA lo_el_cwa_seldata TYPE REF TO if_wd_context_element.
  DATA ls_cwa_seldata TYPE wd_this->element_cwa_seldata.
  DATA LWA_SELDATA TYPE RSPARAMS.
 
* navigate from <CONTEXT> to <CWA_SELDATA> via lead selection
  lo_nd_cwa_seldata = wd_context->get_child_node( name = wd_this->wdctx_cwa_seldata ).
 
  lo_nd_cwa_seldata->GET_STATIC_ATTRIBUTES_TABLE(
    IMPORTING
      TABLE = LIT_SELSCREEN_DATA ).
 
* @TODO handle not set lead selection
  CHECK LO_ND_CWA_SELDATA IS NOT INITIAL.
 
* get the current selection fields and update the result area
  wd_this->l_handler->get_selection_fields( importing et_fields = lt_fields ).
  wd_this->l_handler->get_parameter_fields( importing et_fields = lt_param_fields ).
 
  if lines( lt_fields ) > 0 or lines( lt_param_fields ) > 0.
 
    loop at lt_fields assigning <field>.
 
******************Yet to complete this part *****************
 
*   get the range table of that field
      lit_range_table = wd_this->l_handler->get_range_table_of_sel_field( <field>-m_id ).
 
      check lit_range_table is not initial.
 
* clear the existing content
      wd_this->l_handler->RESET_SELECTION_FIELD( i_id = <field>-m_id ).
 
* Get the pointer of the new table and form it freshly
      assign lit_range_table->* to <lt_new_range_table>.
 
* Get the values into our SELSCREEN Internal Table
      LOOP AT LIT_SELSCREEN_DATA INTO LWA_SELSCREEN_DATA where selname = <field>-m_id.
 
        insert initial line into table <lt_new_range_table> assigning <range_table_line>.
 
        assign component 'SIGN'   of structure <range_table_line> to <sign>.
        assign component 'OPTION' of structure <range_table_line> to <option>.
        assign component 'LOW' of structure <range_table_line> to <low>.
        assign component 'HIGH' of structure <range_table_line> to <high>.
 
        <sign> = LWA_SELSCREEN_DATA-SIGN.
        <option> = LWA_SELSCREEN_DATA-OPTION.
        <low> = LWA_SELSCREEN_DATA-LOW.
        <high> = LWA_SELSCREEN_DATA-HIGH.
 
        APPEND <range_table_line> to <lt_new_range_table>.
 
      ENDLOOP.
 
CALL METHOD WD_THIS->L_HANDLER->UPD_SELECTION_FIELD
  EXPORTING
    I_ID                      = <field>-m_id

    IT_RESULT                 =  LIT_RANGE_TABLE
    .

ENDLOOP.

Raja T

Former Member
0 Kudos

Hi Raja,

Right Now I am working on select-options Variants in webdynpro abap.

In Select-options component i also have few paramter fileds, For select-options fileds successfully I am able to set the data using the SET_RANGE_TABLE_OF_SEL_FILED( ).

but when it comes to Parameter fileds i am using the method, SET_VALUE_OF_PARAMETER_FIELD( ).

I am unable to set the values for parameter fileds.

below is my error:

Subnode WDR_SELECT_OPTIONS#COMPONENTCONTROLLER.CONTEXT.BEGDA does not exist.

Regards,

Xavier.P

Former Member
0 Kudos

Hi Xavier

for setting a default value in a parameter-field I wrote this code:

**********************************************************

DATA: lr_value TYPE REF TO data.

DATA: m_handler TYPE REF TO if_wd_select_options.

FIELD-SYMBOLS: <fs_bukrs> TYPE bukrs.

CONSTANTS: co_bukrs TYPE bukrs VALUE '0330'.

CREATE DATA lr_value TYPE bukrs.

ASSIGN lr_value->* TO <fs_bukrs>.

<fs_bukrs> = co_bukrs.

wd_this->m_handler->add_parameter_field(

i_id = 'BUKRS_PRM'

i_value = lr_value ).

hope it helps, regards David