cancel
Showing results for 
Search instead for 
Did you mean: 

Import and export in Region BAPI

Former Member
0 Kudos

Hi,

I am trying to ecute Region Bapi, it has import parameter as Country code once user selected this i have to pass this to bapi to dispaly region code and region Name

say US is country code this is import parameter this i have to pass it to bapi and excute to get region code and region name (state) .

How to pass import paramter to bapi

Regards,

Murali

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Define a method to execute a bapi to get the regions. Pass country as input parameter to this method. Don't call this method from <i>wdDoInit()</i>

Define a dropdown list to display the countries. "onSelect" even handler will call the method to fetch the regions based on the country. You can execute bapi to get the countries from the <i>wdDoInit()</i>

Former Member
0 Kudos

Hi,

Country bapi is working

public void setCountryName( )

{

//@@begin setCountryName()

List countryName = inputCountry.getOutput().getT_T005T();

int countrySize = countryName.size();

IWDAttributeInfo attributeInfo =

wdContext.getNodeInfo().getAttribute("Country");

ISimpleTypeModifiable objType = attributeInfo.getModifiableSimpleType();

IModifiableSimpleValueSet valueSet =

objType.getSVServices().getModifiableSimpleValueSet();

for (int i = 0; i < countrySize; i++) {

T005T country = (T005T) countryName.get(i);

valueSet.put(country.getLand1(), country.getLandx());

}

//@@end

}

now i have to pass country code to region Bapi may be i have to get the lead selection and assign this to attribute and pass it to region bapi

is my perception is correct

if some one helps with code it helps me !!1

Regardsm

Murali

Former Member
0 Kudos

Once country is selected, your context attribute "Country" stores the selection. Now you pass that value to region bapi.

executeGetRegions(wdContext.currentContextElement().getCountry())

supposing <i>executeGetRegions(String)</i> method is already defined.

Former Member
0 Kudos

yes I agree Once country is selected, context attribute "Country" stores the selection.

wdContext.currentContextElement().getCountry()

now how do you pass this to bapi

public void excuteRegionBapi( )

{

//@@begin excuteRegionBapi()

MessageManager msgMgr =

(MessageManager) wdThis

.wdGetAPI()

.getComponent()

.getMessageManager();

try {

wdContext

.currentZ_Bapi_Ca_Regio_InputElement()

.modelObject()

.execute();

//wdContext.nodeOutput().invalidate();

} catch (Exception ex) {

ex.printStackTrace();

msgMgr.reportException("Error while executing Region Bapi", true);

}

//@@end

}

regards,

Murali

Former Member
0 Kudos

Select your view in NWDS in Web Dynpro prospective.

Select the tab "Methods" and select the method "excuteRegionBapi( )"

Click "New" button to add parameters. Add one parameter of type "string" to pass the country.

Add following line to the event handler "OnSelect" of first list

wdThis.executeRegionBapi(wdContext.currentContextElement().getCountry());

Former Member
0 Kudos

Hi Kranthi,

Still there is an error while excuting Region bapi, the thing is it;s not getting the country input

i have to pass country input to land1 attribute of the Bapi.

any suggestions

Former Member
0 Kudos

Can u pls give some more details on how you are getting the country, how/where executeRegionBapi is called?

Did you see any error in NWDS "Tasks"?

Former Member
0 Kudos

i am displaying country code and country name in a input field it's working fine.(code is below)

public void setCountryName( )

{

//@@begin setCountryName()

List countryName = inputCountry.getOutput().getT_T005T();

int countrySize = countryName.size();

IWDAttributeInfo attributeInfo =

wdContext.getNodeInfo().getAttribute("Country");

ISimpleTypeModifiable objType = attributeInfo.getModifiableSimpleType();

IModifiableSimpleValueSet valueSet =

objType.getSVServices().getModifiableSimpleValueSet();

for (int i = 0; i < countrySize; i++) {

T005T country = (T005T) countryName.get(i);

valueSet.put(country.getLand1(), country.getLandx());

}

now in order to excute Region bapi

i have to pass country code to import parameter of the Region bapi

any how i can get country code

wdContext.currentContext.getCountry();

but even though if i set country code to import parameter of Region bapi

Z_Bapi_Ca_Regio_Input inputRegio = new Z_Bapi_Ca_Regio_Input inputRegio()

inputRegio.setLand1(wdContext.currentContext.getCountry());

Still my bapi is not getting excuted

I think country code is not mapped to import parameter of region bapi (any suggestions). if it mappes i think i can get export parameter from region bapi and display region code and region name another drop down.

Former Member
0 Kudos

> but even though if i set country code to import

> parameter of Region bapi

> Z_Bapi_Ca_Regio_Input inputRegio = new

> Z_Bapi_Ca_Regio_Input inputRegio()

> inputRegio.setLand1(wdContext.currentContext.getCountr

> y());

Where do you place this code in your program?

Are sure that it is called only after selecting the country?

Former Member
0 Kudos

I have placed this code in event selectExcuteRegionBapi

(infact country input filed Evnet handler is selectExcuteRegionBapi)

public void onActionselectExcuteRegionBapi(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onActionselectExcuteRegionBapi(ServerEvent)

inputRegion = new Z_Bapi_Ca_Regio_Input();

wdContext.nodeZ_Bapi_Ca_Regio_Input().bind(inputRegion);

inputRegion.setL_Land1(wdContext.currentContextElement().getCountry());

wdThis.wdGetVendorSetupCustomControllerController().excuteRegionBapi();

wdThis.wdGetVendorSetupCustomControllerController().setRegionvalues();

//@@end

}

and i am excuting region bapi in custome controller

Former Member
0 Kudos

Same thread is continued in another.

https://forums.sdn.sap.com/emailsend.jspa?forumID=52&threadID=94641&messageID=1041227

Pls use one thread for same problem.

Former Member
0 Kudos

please answer in the latest thread where Armin also helping..

Former Member
0 Kudos

Do u know the SDN-way of saying "Thanks" to helpful posts?

Former Member
0 Kudos

my problem is not yet solved, if it get solved you will get Max Points,

don't worry about points points are there any way

(in order to solve this i posted two threads, its urgent)