cancel
Showing results for 
Search instead for 
Did you mean: 

Drop down list box selected value at the top

Former Member
0 Kudos
77

Hi all,

I am using a drop down list box with 2 possible values in a page fragment. My issue is that when the user selects the 2nd value in the drop down the event is triggered but the dropdown shows the 1st value in the top. I would like to show the value picked by the user in the top of the list. Please let me know if we can achive this functionality.

Thanks in advance.

Below is the code i am using.

<htmlb:dropdownListBox id                = "LIST"
                       nameOfKeyColumn   = "NAME"
                       nameOfValueColumn = "VALUE"
                       width             = "300"
                       selection         = "<%= doc_type %>"
                       onSelect          = "DDLB1Event" >
  <htmlb:listBoxItem key   = "IC"
                     value = "<%= otr(YP_HRPA/DOC_TYPE1) %>" />
  <htmlb:listBoxItem key   = "PM"
                     value = "<%= otr(YP_HRPA/DOC_TYPE2) %>" />
</htmlb:dropdownListBox>
<%

 CALL METHOD REQUEST->GET_FORM_FIELD
          EXPORTING
            NAME  = 'LIST'
          RECEIVING
            VALUE = doc_type.

Accepted Solutions (1)

Accepted Solutions (1)

raja_thangamani
Active Contributor
0 Kudos

Yes we can achieve this. But you need to use internal table in dropdownlist as show below:

<b>Onintialization</b>

   
         entry-name = 'IC'.   entry-value = 'IC Text'. 
         APPEND entry TO itab.
         entry-name = 'PM'.  entry-value = 'PM Text'.
         APPEND entry TO itab.

<b>Layout</b>


      <htmlb:dropdownListBox id                = "LIST"
                              nameOfKeyColumn   = "NAME"
                               nameOfValueColumn = "VALUE"
                               width             = "300"
                               selection         = "<%= doc_type %>"
                               onSelect          = "DDLB1Event"
                               table             = "<%= itab %>" />

<b>Page attribute:</b>

entry	TYPE	IHTTPNVP
itab	TYPE	TIHTTPNVP

<b>OnINputprocessing:</b>

CALL METHOD REQUEST->GET_FORM_FIELD
          EXPORTING
            NAME  = 'LIST'
          RECEIVING
            VALUE = doc_type.

delete itab where name = doc_type.  " This will remove selected entry from Itab.

if doc_type = 'IC' 
         entry-name = 'IC'.   entry-value = 'IC Text'. 

else.
         entry-name = 'PM'.  entry-value = 'PM Text'.

endif.

insert entry to itab index 1.

<i>* Reward each useful answer</i>

Raja T

Former Member
0 Kudos

Thank you Raja for the help full suggestions.

I am having the code for the drop down in a page gragment layout and i added the itab and entry in the page attributes of the page with flow logic thats calling the page fragmnet. But when i try to use the itab in page fragment i get an error saying that the itab doesnot exist. Cant we use the variables and page attributes of a page with flow logic in a page fragment?

raja_thangamani
Active Contributor
0 Kudos

The scope of the page attribute is only within the page...So you cant use page attributes in page fragement.

<b>*Reward each useful answer</b>

Raja T

Former Member
0 Kudos

Thanks Raja.

Since i need this functionality in a page fragment which doesnt have the event handler, can i put the code given by you above in a page fragment all at one place?

raja_thangamani
Active Contributor
0 Kudos

No you cant put the entire code in same place.I believe all evening will be handle in the Page level. So it wont work as per your functionality. why dont you add this code in page itself..

<b>*Note: Reward each useful answer</b>

Raja T

Answers (1)

Answers (1)

raja_thangamani
Active Contributor
0 Kudos

If your issue is resolved, Reward each useful answer and close the thread pls...

Raja T

Former Member
0 Kudos

Thanks raja!

I added all the code in the page fragment and its working fine. I caoudnot use the page with flow logic as it was a standard sap delivered BSP and i am just tweaking it a little bit.

thanks,

saumya

Message was edited by:

manasa

Former Member
0 Kudos

raja,

I think i awarded points. Please check if you got it.