on 12-28-2005 6:47 PM
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
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>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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
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());
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.
> 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?
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
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.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.