Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Create combo box

michael_teran
Participant
0 Likes
2,032

How can I create a combo box into the selection screen of a program, like the combo box where someone excecute the transactions????

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,471

You can create in the Screen Layout from SE51. Create a input field. Double click on it to go to its attributes window. You see the name 'Dropdown' on it. Select list box there. Rest of it we need to code in the program.

7 REPLIES 7
Read only

Former Member
0 Likes
1,472

You can create in the Screen Layout from SE51. Create a input field. Double click on it to go to its attributes window. You see the name 'Dropdown' on it. Select list box there. Rest of it we need to code in the program.

Read only

0 Likes
1,471

Ok. But I want to create that on the selection screen. How can I do that?????????

Read only

0 Likes
1,471

Then you can declare in the selection screen parameter:

parameters: p_param1 type <data type>

as listbox visible length <len>.

Read only

0 Likes
1,471

search with key word VRM_SET_VALUES in the forum for more sample codes and how to use.

Read only

Former Member
0 Likes
1,471

Reference Here!!!!!!

TYPE-POOLS : VRM.

DATA : TEL_VALUE TYPE VRM_VALUES WITH HEADER LINE.

REFRESH : TEL_VALUE.

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

  • DATA BINDING 부분

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

" SELECT BUKRS BUKRS INTO (TEL_VALUE-KEY, TEL_VALUE-TEXT)"

FROM BKPF.

APPEND TEL_VALUE.

ENDSELECT.

*----


*LISTBOX FUNCTION

*----


CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

ID = 'TXTTEL1'

VALUES = TEL_VALUE[]

  • EXCEPTIONS

  • ID_ILLEGAL_NAME = 1

  • OTHERS = 2

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

*

Read only

Former Member
0 Likes
1,471

A combo box is a control that maintains a list of objects but displays one at a time to the user. A regular combo box is equipped with a rectangular text area and a down-pointing arrow. To use the combo box, the user clicks the arrow, which displays its list of items. Then the user clicks one item from the list and the list retracts like a plastic. The item the user would have selected would display in the text box side of the control. To perform a different selection, the user uses the same process. Practically, there are different variations of the combo box control depending on the programmer's goal.

To create a combo box in MS .Net application, you can use the ComboBox class.

Creating a combo box might not be the most difficult thing to do but when the user has performed a different selection, you will usually need to know what item the user selected. A combo box maintains its list of items by their text or their indexes. You can use the same ability to retrieve either the text or the index of the item that was selected.

Start Microsoft Visual Studio .NET

On the Start Page, click New Project (alternatively, on the main menu, you can click File -> New -> Project...)

On the New Project dialog box, in the Project Types tree list, click Visual C++ Projects

In the Templates list, click Managed C++ Empty Project

In the Name edit box, replace the <Enter name> content with ComboBox Example

In the Location combo box, accept the suggestion or type your own. If you don't have any, type C:\Programs\MSVC.NET

Click OK

On the main menu, click Project -> Add New Item...

In the Add New Item dialog box, in the Templates list, click C++ File

In the Name box, replace <Enter name> with Main and click OK

Replace the contents of the empty file with the following:

#using <mscorlib.dll>

#using <System.dll>

#using <System.Drawing.dll>

#using <System.Windows.Forms.dll>

using namespace System;

using namespace System::Drawing;

using namespace System::Windows::Forms;

__gc class SimpleForm : public Form

;

SimpleForm::SimpleForm()

{

// The caption of the form

this->Text = S"Combo Box Example";

// Use the instance of the combo box to initialize the class

cboCountries = new ComboBox;

// Specify where to position the combo box

cboCountries->Location = Point(16, 16);

// Add each item to the combo box

cboCountries->Items->Add(S"Gabon");

cboCountries->Items->Add(S"Senegal");

cboCountries->Items->Add(S"Botswana");

cboCountries->Items->Add(S"Zambia");

cboCountries->Items->Add(S"Lesotho");

// Specify which item to display when the combo box comes up

cboCountries->Text = S"Senegal";

// After creating the control, add it to the

// group of controls of the form

this->Controls->Add(cboCountries);

}

int __stdcall WinMain()

{

SimpleForm *SF = new SimpleForm();

Application::Run(SF);

return 0;

}

Test the application and return to MSVC

To retrieve the text of the item that was selected and display it in a label, change the source file as follows:

#using <mscorlib.dll>

#using <System.dll>

#using <System.Drawing.dll>

#using <System.Windows.Forms.dll>

using namespace System;

using namespace System::Drawing;

using namespace System::Windows::Forms;

__gc class SimpleForm : public Form

;

SimpleForm::SimpleForm()

{

// The caption of the form

this->Text = S"Combo Box Example";

// Use the instance of the combo box to initialize the class

cboCountries = new ComboBox;

// Specify where to position the combo box

cboCountries->Location = Point(16, 16);

// Add each item to the combo box

cboCountries->Items->Add(S"Gabon");

cboCountries->Items->Add(S"Senegal");

cboCountries->Items->Add(S"Botswana");

cboCountries->Items->Add(S"Zambia");

cboCountries->Items->Add(S"Lesotho");

// Specify which item to display when the combo box comes up

cboCountries->Text = S"Senegal";

cboCountries->add_SelectedIndexChanged(new EventHandler(this, SelectionChanged));

// After creating the control, add it to the

// group of controls of the form

this->Controls->Add(cboCountries);

lblItemSelected = new Label;

lblItemSelected->Location = Point(16, 48);

lblItemSelected->AutoSize = true;

lblItemSelected->Text = S"Senegal";

this->Controls->Add(lblItemSelected);

}

void SimpleForm::SelectionChanged(Object *Sender, EventArgs *Args)

{

lblItemSelected->Text = cboCountries->Text;

}

int __stdcall WinMain()

{

SimpleForm *SF = new SimpleForm();

Application::Run(SF);

return 0;

}

Test the application

Read only

0 Likes
1,471

Hi!

I'm new in SAP Portal, I want to create a combo box to add links in it, and I would like how to do it since the creation of the object till add values within of it

Thanks