cancel
Showing results for 
Search instead for 
Did you mean: 

BSP : Populate database table field into dropdown box

Former Member
0 Kudos

Hi Friends,

I developed one BSP Page in that How to populate the drop down box with the database table data field ?

For ex : I have to fetch the project id from PRPS table and put this data in internal table and this data how can i populate into drop down box ?

Can you please suggest me how to proceed ?

(ie The user is asking to provide the list of project id's so that i can select one project out of that)

*points will be award

Regards,

Govind

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi govinda komarina

Steps to be followed:

1) Define internal table of type DATABASE table from

which you want to pick records.

2) on Event "onInitialization".Fill internal table with

records from database table.

3) in Layout where you have BSP tag for Dropdown.

-


<b>OnInitialization:</b>

Select EBELN from EKKO 
             into corresponding fields of table ITAB.

<b>layout:</b>

<htmlb:dropdownListBox id   = "DropDown1"
          nameOfKeyColumn   = "EBELN"
          nameOfValueColumn = "EBELN"
          table             = "<%=ITAB>" />

-


For further help, Checkout BSP Application: SBSPEXT_HTMLB

This application has demo examples for all TAGS, Dropdownlistbox, Table view etc.

Cheers,

Vijay Raheja

Former Member
0 Kudos

Hi Vijay,

As per ur points i tried as per the below but still iam not getting .Frist of all i explain what i did

1.oninitializatin (I metined below)

data : itab type table of EKKO .

select EBELN from EKKO into

corresponding fields of table itab.

2.In Layout (I mentioned as below and tried in 2 ways)

1. <htmlb:dropdownListBox id = "DropDown1"

nameOfKeyColumn = "mpowerprojid"

nameOfValueColumn = "mpowerprojid"

table = "<%=ITAB%>" </htmlb:dropdownListBox>

(or)

2. <htmlb:dropdownListBox id = "<%=ITAB-mpowerprojid%>"

nameOfKeyColumn = "mpowerprojid"

nameOfValueColumn = "mpowerprojid">

</htmlb:dropdownListBox>

3 . In page attributes (i mentioned below)

itab type EKKO

Can you pls suggest me what mistake iam doing as per the above ?

Thanks & Regards,

govind

Former Member
0 Kudos

Hi govinda komarina

Just make little Changes

1) <b>Type Definitions</b>

TYPES: TT_EKKO TYPE TABLE OF EKKO.

2) <b>In page attributes</b>

ITAB type TT_EKKO

3) <b>on Initialization</b>

select EBELN from EKKO into
corresponding fields of table itab.

4) <b>In Layout</b>

<htmlb:dropdownListBox id = "DropDown1"
nameOfKeyColumn = "<b>EBELN</b>"
nameOfValueColumn = "<b>EBELN</b>"
table = "<%=ITAB%>" 
</htmlb:dropdownListBox>

Just check out again, i corrected some minor mistakes.

Let me know, if you are still stuck somewhere.

Cheers,

Vijay Raheja

Former Member
0 Kudos

Hi Vijay,

I changed as per ur suggestion and syntactically correct but after running the bsp page its not showing any thing and saying that in browser

"The page cannot be displyed" . If I use the some other content its coming in the browser but whatever u gave the layout code is not coming any output.

Can you please suggest me whats the problem still?

Thanks & Regards,

Govind

Former Member
0 Kudos

Hi govinda komarina

Its working perfectly at my end, I am pasting whole code for this functionality.Just Check again.

I created a page : PAGE1.htm

-


<b>Layout:</b>


<%@page language="abap"%>
<%@extension name="htmlb" prefix="htmlb"%>

<htmlb:content design="design2003">
  <htmlb:page title = "Test BSP Page ">
    <htmlb:form>

      <htmlb:dropdownListBox    id          = "DROPDOWN1"
                            nameOfKeyColumn = "EBELN"
                          nameOfValueColumn = "EBELN"
                                table       = "<%=ITAB%>" /> 

    </htmlb:form>
  </htmlb:page>
</htmlb:content>

-


<b>OnInitialization</b>

select EBELN from EKKO into
corresponding fields of table ITAB.

-


<b>Page Attributes</b>

ITAB Type TT_EKKO

-


<b>Type Definitions:</b>

TYPES: TT_EKKO TYPE TABLE OF EKKO.

-


Cheers,

Vijay Raheja

Former Member
0 Kudos

Hi Vijay,

Thanks a lot . I solved my problem and awarded the points also .

Regards,

Govind

Former Member
0 Kudos

Hi Vijay,

After I populated database table field data into dropdownbox and need to select one value from drop down box and click the submit button (i had put submit button besides dropdown box) .

How I capture this dropdown box selected value from the other bsp page? can u pls give the steps like how i put the submit button htmlb in layout and capturing ?(I know the submit button in html)

Thanks & Regards,

Govind

Former Member
0 Kudos

Hi govinda komarina

Hey i made some changes in code that i gave you earlier, This will provide you functionality for selecting dropdown value.Just Check.

-


<b>Layout:</b>

<%@page language="abap"%>
<%@extension name="htmlb" prefix="htmlb"%>

<htmlb:content design="design2003">
  <htmlb:page title = "Test BSP Page ">
    <htmlb:form>

      <htmlb:dropdownListBox    id          = "DROPDOWN1"
                            nameOfKeyColumn = "EBELN"
                          nameOfValueColumn = "EBELN"
                                table       = "<%=ITAB%>"
                                selection   = "<%=VAR_EBELN%>"
                                onSelect    = "Click"/>

    </htmlb:form>
  </htmlb:page>
</htmlb:content>

-


<b>OnInitialization</b>

select EBELN from EKKO into

corresponding fields of table ITAB.

-


<b>OnRequest</b>

  DATA: event TYPE REF TO cl_htmlb_event.
  event = cl_htmlb_manager=>get_event( runtime->server->request ).

  IF event->name = 'dropdownListBox' AND event->event_type = 'select'.
    DATA: select TYPE REF TO cl_htmlb_event_selection.
    select ?= event.

    VAR_EBELN = select->selection.
  
  ENDIF.
 

-


<b>Page Attributes</b>

ITAB      Type TT_EKKO
VAR_EBELN TYPE EBELN

-


<b>Type Definitions:</b>

TYPES: TT_EKKO TYPE TABLE OF EKKO.

-


Revert back, If Stuck somewhere...

Cheers,

Vijay Raheja

Former Member
0 Kudos

Hi Vijay,

I tried as per the below code you sent and added as per the reply of my other thread like in

<b>onInputprocessing</b> case event_id.

When Button Is Clicked:

navigation->set_parameter( var_ebeln ).

navigation->goto_page('page2.htm').

endcase.

After adding this giving syntax error I think we added Button on Layout and can u pls let me know how htmlb button will put on layout ? and i added your below reply code also like layout,oninitialization,onrequest,page attributes, typedefintions

Can you pls suggest me how to proceed as per your below answer you just guide me ?

(I am just explaining the my requirement for more clarity suppose the user selects one value in dropdown box and click on the submit button then this selected value needs to capture from second page)

Thanks & Regards,

Govind

Former Member
0 Kudos

Hi Vijay,

I tried again but still I am not getting it . In layout extra i put button bcz after user selects the dropdown box and click on button it will goto the next page instead of selecting the dropdown box directly and triggering, thats why as per ur code i didn't apply onrequest event code .

As per ur suggestion i tried as per below but once i selected the dropdown box and clikc the button its not going to the other page, can u pls correct me whats wrong in this below code?

<b>Layout</b>

<%@page language="abap"%>

<%@extension name="htmlb" prefix="htmlb"%>

<htmlb:content design="design2003">

<htmlb:page title = "Test BSP Page ">

<htmlb:form>

<htmlb:dropdownListBox id = "DROPDOWN1"

nameOfKeyColumn = "mpowerprojid"

nameOfValueColumn = "mpowerprojid"

table = "<%=ITAB%>"

selection = "<%=VAR_EBELN%>"/>

<htmlb:button id="Button" text ="Click" onClick="Button"/>

</htmlb:form>

</htmlb:page>

</htmlb:content>

-


<b>OnInitialization</b>

select EBELN from EKKO into

corresponding fields of table ITAB.

-


<b>Oninput processing</b>

case event_id.

When 'Button'.

navigation->set_parameter( name = 'EBLEN' value = VAR_EBLEN ).

navigation->goto_page('page2.htm').

endcase.

-


<b>Page Attributes</b>

ITAB Type TT_EKKO

VAR_EBELN TYPE EBELN

<b>Types definition</b>

types : itab1 type table of EKKO.

<b>OnRequest</b> I skipped this onrequest bcz i put the button besided dropdown box, once i selected the value in dropdownbox and click the button then it should go to next page. As per my requirement this event is not required right?

Message was edited by: govinda komarina

Answers (3)

Answers (3)

Former Member
0 Kudos

HI

GOOD

GO THRUOGH THESE LINKS,I HOPE THESE WILL GIVE YOU SOME IDEA TO SOLVE YOUR PROBLEM

/people/vijai.mohan/blog/2006/04/27/system-configuration-for-bsp-iviews-in-ep

http://www.thespot4sap.com/articles/SAP_WAS_Creating_BSP_Apps.asp

THANKS

MRUTYUN

Former Member
0 Kudos

Hi,

Go through the sample application <b>SBSPEXT_HTMLB</b> in that check <b>DropdownListBox.bsp</b>.

Regards,

Azaz Ali.

Former Member
0 Kudos

hi,

when you are using MVC, make a table as attribute in your

model class and pass it on to the view you want to use.

In DO_REQUEST:

DATA: o_view TYPE REF TO if_bsp_page,

o_model TYPE REF TO z_model_class,

o_myapplication TYPE REF TO z_application_class.

o_myapplication ?= application. o_model ?= o_myapplication->get_model( ).

o_view->set_attribute( name = model value = o_model ).

in your view:

<htmlb:dropdownListBox id = "dropdownid"

table = "<%= o_model->lt_options %>"

selection = "<%= o_model->selected value %>"

nameOfKeyColumn = "KEY_COLUMN"

nameOfValueColumn = "VALUE_COLUMN" />

given you already filled lt_options in your model class,

selected value can be the defaulted value of you key_column.

grtz

Koen