cancel
Showing results for 
Search instead for 
Did you mean: 

How to bind data dynamically in drop down list via internal table?

Former Member
0 Kudos

Hi all,

I have created a field in the layout with type DROPDOWN which is a field of internal table.

I want to show that whatever data is populated in that field of intenal table,it should be shown in the form of drop down list.

Please help how to proceed in it.

Thanks in advance,

Rosalin

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Rosalin,

Search the forum before posting. Check whether the following blog helps you out.

[http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/6793] [original link is broken] [original link is broken] [original link is broken];

Thanks & Regards,

Sanoosh

Former Member
0 Kudos

Hi Sanoosh,

Thanks for the reply.

I am making offline form in Sfp transaction.I am not using webdynpro.

Kindly suggest if you know any other alternative for the above query.

Thanks,

Rosalin

Former Member
0 Kudos

Hi Rosalin,

Is it something like an offline scenario and you need to fetch values from SAP while user is filling the form?

You can get this done in two ways.

1. Fetch all the values and keep it in a hidden table within the form while downloading the form

2. Use web services to fetch values at runtime

Thanks & regards,

Sanoosh

Former Member
0 Kudos

Hi Sanoosh,

Can you please elaborate the first option provided as we cannot go for the second option because it will ask for the user id and password which I believe is not possible in offline scenario.

Kindly give us a detailed description.

Thanks,

Rosalin

Former Member
0 Kudos

Hi Rosalin,

Loop the hidden table, get the values and populate drop down in each iteration.

DropDownList1.addItem("Text","Value");

You can use one more solution for this scenario. If it is a matter of 2,3 dropdowns, put three dropDowns in the form layout and give seperate static data binding to them. At run time make the dropDowns hide/visible as per the requirement.

Hope this helps.

Thanks & Regards,

Sanoosh

Former Member
0 Kudos

Hi ,

Thanks for the reply.

I have created an internal table & have populated the values in it.

But please clarify how to loop the hidden table & get the values and populate drop down in each iteration,

Should I do that in code initialization or in script editor.

And also clarify how to bind the dropdown list dynamically.

Thanks

Rosalin

Edited by: Rosalin Sahu on Mar 16, 2011 5:56 AM

Former Member
0 Kudos

Hi,

I have the table with binding and hidden in the form.

Hi below is the code I do it in form ready event of the dropdown.


var reqCount = this.parent.Request_Text_Table.nodes.length;
for(var i = 0; i < reqCount-1 ; i++){
    this.addItem(xfa.resolvenode("this.parent.Request_Text_Table.Data["+i+"].key").rawValue, this.parent.Request_Text_Table.Data["+i+"].Desc").rawValue);
}

hope the approach helps you,

Cheers,

Sai

Former Member
0 Kudos

Hi,

Use following script to loop table, get the values and add to dropdown list.

var hidTab = xfa.resolveNodes("mainForm.subForm.table[*].DATA[*]");
var hidTab_len = hidTab.length;
for (var i=0; i<hidTab_len; i++)
{
     var text  = hidTab.item(i).Field1.rawValue;
     var value = hidTab.item(i).Field2.rawValue;
     DropDownList1.addItem("text","value");
}

Thanks & Regards,

Sanoosh

Answers (2)

Answers (2)

Former Member
0 Kudos

HI Sanoosh,

I have used the binding to the internal table values for displaying the drop-down list values and I could see them in the PDF form when i execute the form through a print program but when I integrated the form in WebdynproABAP , all the internal tables usually you declare under 'Global data' were not visible in context in Webdynpro ABAP, Could you let me know how I could get these values for drop-down lists and for online interactive form , my interface type is ABAP dictionary based , is it correct or need to be changed for dipslaying the values in dropdown list box as per SAP standards ???

Thanks,

SP

Former Member
0 Kudos

Hi Roslin,

Goto SFP tcode.

1.Create Interface

In gobal Definitions->Types->Define Structure.

In gobal Definitions->gobaldata->Define Variable

Initialization->Define Outparameters

Select * into table IT_table from (Custom or standard table).

2. Create forms

Goto layout->Drag and drop the Drop-Down list

And the Bind the value IT_table