cancel
Showing results for 
Search instead for 
Did you mean: 

Filling Structure of import parameter in webdynpro.

Former Member
0 Kudos

Hi Developers,

There are 3 attributes and one structure in import parameters for one function module.

I used the following code to place the values into parameters for 3 attributes.but iam not able to place the values for structure.

Let us say in import below are the 3 attributes

city,state, country and in structure named "address" we have name,d.no,adress,pincode.

the name of the Bapi was "BAPI_SAMPLE_Input"

BAPI_SAMPLE_Input inp=new BAPI_SAMPLE_Input();

inp.setcity("culcutta");

inp.setstate(""West Bengal");

inp.setcountry("INDIA");

This values are populating when function module was executed, how to set the values for structure parameter?

Please Advice.

Thanks

Sekhar.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi

the name of the Bapi was "BAPI_SAMPLE_Input"

BAPI_SAMPLE_Input inp=new BAPI_SAMPLE_Input();

inp.setcity("culcutta");

inp.setstate(""West Bengal");

inp.setcountry("INDIA");

for adding values to the parameter in the structure ,

suppose Address is the name of the Structure and name pind code , city and street are parameters.

when you use ARFC model each strcuture has a Model Class created .

BAPI_SAMPLE_Input inp=new BAPI_SAMPLE_Input(); // RFC

ZAddress addr = new ZAddress();

addr.setName(name);

addr.setpincode(pincode);

add or bind your ZAddress to the RFC . some thing as inp.add(addr);

wdcontext.nodeRFCName.bind(inp);

Former Member
0 Kudos

Hi Murali,

Thanks for the reply.

I have done this

wdcontext.nodeBAPI_SAMPLE_Input.bind(inp);

But still iam not able to send the values for the stucture to the Function Module.

and also for adding, in the code i put inp. , it should display the help reference code right, but cannot see add there.

Please advice.

Hi Developers,

Any suggestions, this issue still not yet resolved.

Thanks

Sekhar.

Edited by: sekhar c on Apr 3, 2009 12:50 PM

Former Member
0 Kudos

Sekhar,

Here's the sample code for your case

nodeBAPI_SAMPLE_Input inp = new nodeBAPI_SAMPLE_Input();

//If you have a structure as import parameter say ZAddr then

ZAddr addr = new ZAddr();

addr.setX("");

addr.setY("");

//Here's the step that you missed.

inp.setZAddr(addr);

wdcontext.nodeBAPI_SAMPLE_Input.bind(inp);

Hope t his helps.

Regards,

Prasanna

Former Member
0 Kudos

Hi Prasanna,

Its working.

Thank you .

Former Member
0 Kudos

Hi,

In the same way how to populate the values for the Check Box.

Let us take an example:

I have created a node called "sport" under that created a Attribute called "Sports" in the view called Profile View.

and written the following code in

WDDoINIT()

{

IsportNode nodesport = wdContext.nodeTransactionaccesstype();

IPrivateprofileView.IsportElement elementsport;

String[] sportsarray = { "cricket","Basketball","Tennis"};

for (int i = 0; i < accesstypes.length; i++) {

elementsport = nodesport.createsportElement();

}

nodesport.addElement(elementsport);

elementsport.setsports(sportsarray<i>);

}

in Onaction submit button of profile view

onactionsubmit()

{

Isport nodesport = wdContext.nodesport();

IPrivateProfileView.IsportElement elementsport;

String[] sportsarray =

{

"cricket",

"Basketball",

"Tennis"

};

for (int i = 0; i < sport.length; i++) {

elementsport = nodesport.currentsportElement();

elementsport.setsports(sportsarray<i>);

nodesport.setSelected(elementsport.index(), false);

}

}

I have to send this value to the import parameters of Function Module "BAPI_SAMPLE_Input", in the import, the attributes in the backend are "cricket" and "basketball" and "tennis".

In the controler method :

BAPI_SAMPLE_Input inp=new BAPI_SAMPLE_Input();

IPublicprofileform.IsportsElement sportelement=wdContext.currentsportsElement();

if(sportelement.getsports().equalsIgnoreCase("cricket"))

{

addr.setcricket(true);

}

if(transElement.getAccesstype().equalsIgnoreCase("Basketball"))

{

addr.setbasketball(true);

}

if(transElement.getAccesstype().equalsIgnoreCase("Tennis"))

{

addr.settennis(true);

}

inp.setZAddr(addr);

Iam unable to send the selected sport to the above Function module import parameter.

Please Advice.

Sekhar

Answers (0)