on 06-21-2006 9:15 AM
Hi,
Where can i find the code of the binding of input fields?
I want to execute a bapi, but when i make a method executeBapiX with the parameter in it. the java code gives an error. Now my question is, how can i import a parameter into a BAPI without the I use a inputfield.
Regards
Sven
Hi,
I dint get ur problem clearly.
If u want to bind the input field,Bind a context Attribute and get the value from it and set to the bapi.
Do not bind the model attribute directly.
Here are the steps it will be useful to u for execution of bapi.
Steps:
1. First create an instance for bapi and bind the instance to the bapi node.
Z<bapi name> zb=new Z<bapi name>();
wdContext.nodeZ<bapi name>. bind(zb);
2. Then if u have the import parameter u have to set them by using
The instance of the above bapi.
Zb.set<import parameters>;
3. If the bapi has a table parameters then the structure for the table parameters will also be imported
In the model class.
4. Set the table parameters by creating the instance for that structure and using this instance set it.
Z<Struct>itm tab=new Z<Struct>();
Tab.set<table parameters>
5. Then add the structure instance to the bapi instance.
Zb.add(Tab);
6. Then Execute the bapi after setting the import parameters.
7. If there is any export parameters, then get the values after execution.
Best Regards,
Vijayakhanna Raman
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
If u want the user to set the import parameter then an ui Element is needed .
Without an UI where u wil bind the imput parameter.
And moreever u cant bind the input parameter directly to
input field u need an context att for it.
And ur senario is not achievable.
What java error ur getting?
Regards,
Vijayakhanna Raman.
well, there is nothing happening. what i want is that:
I have a bapi which has an input parameter. The bapi needs to be launched at starting up the WD. I copied the code downstairs. somewghere in this code i need to fill in the inputparameter pernr (personnelno) so it activates the bapi
at the view i used the following code
public void wdDoInit()
{
//@@begin wdDoInit()
wdThis.wdGetProcesStartController().executeY_Tf_Employeedata_Input();
//@@end
}
In the controller:
Y_Tf_Employeedata_Input input4 = new Y_Tf_Employeedata_Input();
wdContext.nodeY_Tf_Employeedata_Input().bind(input4);
public void executeY_Tf_Employeedata_Input( )
{
//@@begin executeY_Tf_Employeedata_Input()
try
{
wdContext.currentY_Tf_Employeedata_InputElement().modelObject().execute();
wdContext.nodeOutput3().invalidate();
}
catch (Exception ex)
{
ex.printStackTrace();
}
//@@end
}
hi,
Write like this.
public void wdDoInit()
{
//@@begin wdDoInit()
Y_Tf_Employeedata_Input input4 = new Y_Tf_Employeedata_Input();
wdContext.nodeY_Tf_Employeedata_Input().bind(input4);
input4.setpersonnelno("String xx");
wdThis.wdGetProcesStartController().executeY_Tf_Employeedata_Input();
//@@end
}
Take the first two lines in the controller.
Hope this helps.
Regards,
Vijayakhanna Raman
NO have an error message
com.sap.aii.proxy.framework.core.DataAccessException: Type conversion error, field PERNR, complex type class com.shell.shellpeople.wd.teamflow.model7.Y_Tf_Employeedata_Input
at com.sap.aii.proxy.framework.core.JcoBaseTypeData.propagateJcoException(JcoBaseTypeData.java:130)
at com.sap.aii.proxy.framework.core.JcoBaseTypeData.setElementValue(JcoBaseTypeData.java:751)
at com.sap.tc.webdynpro.modelimpl.dynamicrfc.DynamicRFCModelClass.setAttributeValueAsString(DynamicRFCModelClass.java:679)
at com.shell.shellpeople.wd.teamflow.model7.Y_Tf_Employeedata_Input.setPernr(Y_Tf_Employeedata_Input.java:192)
at com.shell.shellpeople.wd.teamflow.ProcesStart.wdDoInit(ProcesStart.java:115)
at com.shell.shellpeople.wd.teamflow.wdp.InternalProcesStart.wdDoInit(InternalProcesStart.java:332)
at com.sap.tc.webdynpro.progmodel.generation.DelegatingCustomController.doInit(DelegatingCustomController.java:73)
at com.sap.tc.webdynpro.progmodel.controller.Controller.initController(Controller.java:215)
at com.sap.tc.webdynpro.progmodel.controller.Controller.init(Controller.java:200)
at com.sap.tc.webdynpro.progmodel.controller.Component.getCustomControllerInternal(Component.java:436)
at com.sap.tc.webdynpro.progmodel.controller.Component.getMappableContext(Component.java:374)
at com.sap.tc.webdynpro.progmodel.controller.Component.getMappableContext(Component.java:403)
at com.sap.tc.webdynpro.progmodel.context.MappingInfo.getDataNode(MappingInfo.java:79)
at com.sap.tc.webdynpro.progmodel.context.MappingInfo.initMapping(MappingInfo.java:121)
at com.sap.tc.webdynpro.progmodel.context.MappingInfo.init(MappingInfo.java:117)
at com.sap.tc.webdynpro.progmodel.context.MappedNodeInfo.doInit(MappedNodeInfo.java:207)
at com.sap.tc.webdynpro.progmodel.context.NodeInfo.init(NodeInfo.java:654)
at com.sap.tc.webdynpro.progmodel.context.NodeInfo.init(NodeInfo.java:657)
at com.sap.tc.webdynpro.progmodel.context.Context.init(Context.java:40)
at com.sap.tc.webdynpro.progmodel.controller.Controller.init(Controller.java:199)
at com.sap.tc.webdynpro.progmodel.view.ViewManager.getView(ViewManager.java:540)
at com.sap.tc.webdynpro.progmodel.view.ViewManager.bindRoot(ViewManager.java:422)
at com.sap.tc.webdynpro.progmodel.view.ViewManager.init(ViewManager.java:130)
at com.sap.tc.webdynpro.progmodel.view.InterfaceView.initController(InterfaceView.java:41)
at com.sap.tc.webdynpro.progmodel.controller.Controller.init(Controller.java:200)
at com.sap.tc.webdynpro.clientserver.cal.ClientComponent.displayToplevelComponent(ClientComponent.java:135)
at com.sap.tc.webdynpro.clientserver.cal.ClientApplication.init(ClientApplication.java:392)
at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.execute(WebDynproMainTask.java:608)
at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:59)
at com.sap.tc.webdynpro.clientserver.cal.ClientManager.doProcessing(ClientManager.java:248)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doWebDynproProcessing(DispatcherServlet.java:154)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:116)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doGet(DispatcherServlet.java:48)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:390)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:264)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:347)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:325)
at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:887)
at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:241)
at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)
at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
at java.security.AccessController.doPrivileged(Native Method)
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:95)
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:160)
Hi S.
which type (in ABAP) is this bapi parameter personnelno?
regards
Bogdan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
I think that this errormessage:
com.sap.aii.proxy.framework.core.DataAccessException: Type conversion error, field PERNR, complex type class
suggest that the convertion from string to personalnumer is not possible.
Could you check please, if exist a special class for parameter personalnumber in your project node: Web Dynpro->Models-><your model name>->Model classes
and when this class exist then use this type in context property which you bind to input parameter.
Regards
Bogdan
The input parameter should come from Y_Tf_Employeelist_Input and on lead select he needs to get the parameter Pernr and use this parameter to execute the bapi Y_Tf_Employeedata. both Bapi's have in the properties Persno(type) and Pernr (name). For both bapies I used the same code
public void wdDoInit()
{
//@@begin wdDoInit()
Y_Tf_Employeedata_Input input4 = new Y_Tf_Employeedata_Input();
wdContext.nodeY_Tf_Employeedata_Input().bind(input4);
input4.setPernr("String xx");
//@@end
}
public void executeY_Tf_Employeedata_Input( )
{
//@@begin executeY_Tf_Employeedata_Input()
try
{
wdContext.currentY_Tf_Employeedata_InputElement().modelObject().execute();
wdContext.nodeOutput3().invalidate();
}
catch (Exception ex)
{
ex.printStackTrace();
}
//@@end
}
code of the BAPI
// -
// This file has been generated partially by the Web Dynpro Code Generator.
// MODIFY CODE ONLY IN SECTIONS ENCLOSED BY @@begin AND @@end.
// ALL OTHER CHANGES WILL BE LOST IF THE FILE IS REGENERATED.
// -
package com.shell.shellpeople.wd.teamflow.model7;
//
// IMPORTANT NOTE:
// ALL IMPORT STATEMENTS MUST BE PLACED IN THE FOLLOWING SECTION ENCLOSED
// BY @@begin imports AND @@end. FURTHERMORE, THIS SECTION MUST ALWAYS CONTAIN
// AT LEAST ONE IMPORT STATEMENT (E.G. THAT FOR java.lang.String).
// OTHERWISE, USING THE ECLIPSE FUNCTION "Organize Imports" FOLLOWED BY
// A WEB DYNPRO CODE GENERATION (E.G. PROJECT BUILD) WILL RESULT IN THE LOSS
// OF IMPORT STATEMENTS.
//
//@@begin imports
import java.lang.String;
//@@end
//@@begin documentation
/**
Title: Web Dynpro Version 6.30
Description: "Y_Tf_Employeedata_Input" RFC Adapter ModelClass implementation
Copyright: Copyright (c) 2001 - 2002. All rights reserved.
Company: SAP AG
@author File created by Web Dynpro code generator
*/
//@@end
public class Y_Tf_Employeedata_Input extends com.sap.tc.webdynpro.modelimpl.dynamicrfc.DynamicRFCModelClassExecutable implements java.io.Serializable
{
/** Logging location. */
private static final com.sap.tc.logging.Location logger = com.sap.tc.logging.Location.getLocation(Y_Tf_Employeedata_Input.class);
static {
//@@begin id
String id = "$Id$";
//@@end
com.sap.tc.logging.Location.getLocation("ID.com.sap.tc.webdynpro").infoT(id);
}
private static final long serialVersionUID = 858420244L ;
private static final com.sap.aii.proxy.framework.core.GenerationInfo staticGenerationInfo = new com.sap.aii.proxy.framework.core.GenerationInfo("2.0", 1057090423493L) ;
private static final Class associatedModelClazz = com.shell.shellpeople.wd.teamflow.model7.YTF_EMPLOYEEDATA.class;
private static final com.sap.tc.webdynpro.progmodel.model.api.WDModelScopeType DEFAULT_SCOPE =
com.shell.shellpeople.wd.teamflow.model7.Y_TF_EMPLOYEEDATA.DEFAULT_MODELSCOPE;
/** Simple Constructor */
public Y_Tf_Employeedata_Input () {
super( descriptor( com.sap.tc.webdynpro.modelimpl.dynamicrfc.RFCMetadataRepository.getSingleton(com.shell.shellpeople.wd.teamflow.model7.Y_TF_EMPLOYEEDATA.DEFAULT_RFCMETADATA_SYSTEMNAME),
com.shell.shellpeople.wd.teamflow.model7.Y_TF_EMPLOYEEDATA.wdGetStaticMetadataCache().getBaseTypeDescriptorMap(),
Y_Tf_Employeedata_Input.class,
"Y_TF_EMPLOYEEDATA",
PROXYTYPE_INPUT,
"Y_Tf_Employeedata_Input",
"com.shell.shellpeople.wd.teamflow.model7" ),
staticGenerationInfo);
}
/** Constructor for specific scope
use this Constructor, if this instance should belong to a model instance
of a different scope than the default model scope.
The default model scope can be found in com.shell.shellpeople.wd.teamflow.model7.Y_TF_EMPLOYEEDATA.DEFAULT_MODELSCOPE
@param scope the WDModelScopeType representing in which scope this instance is to be maintained
*/
public Y_Tf_Employeedata_Input (com.sap.tc.webdynpro.progmodel.model.api.WDModelScopeType scope) {
this();
maintainInScope(scope);
}
/** Constructor for specific modelInstanceId
use this Constructor, if this instance should belong to a different model instance
than the default model instance.
The default modelInstance has no id (null).
@param modelInstanceId a String representing the model instance this modelClass instance should belong to
*/
public Y_Tf_Employeedata_Input (String modelInstanceId) {
this();
maintainInInstanceId(modelInstanceId);
}
/** Constructor for specific scope and modelInstanceId
use this Constructor, of this instance should belong to a differnt scope
and a different model instance than the default model scope and model instance.
The default model scope can be found in com.shell.shellpeople.wd.teamflow.model7.Y_TF_EMPLOYEEDATA.DEFAULT_MODELSCOPE
The default modelInstance has no id (null).
@param scope the WDModelScopeType representing in which scope this instance is to be maintained
@param modelInstanceId a String representing the model instance this modelClass instance should belong to
*/
public Y_Tf_Employeedata_Input (com.sap.tc.webdynpro.progmodel.model.api.WDModelScopeType scope, String modelInstanceId) {
this();
maintainInScopeAndInstanceId(scope, modelInstanceId);
}
/** Constructor for specific model Instance
use this Constructor, if this instance should belong to a specific instance
of the model com.shell.shellpeople.wd.teamflow.model7.Y_TF_EMPLOYEEDATA
passed as a parameter to this constructor.
@param modelInstance the DynamicRFCModel referring to the modelInstance
*/
public Y_Tf_Employeedata_Input ( com.shell.shellpeople.wd.teamflow.model7.Y_TF_EMPLOYEEDATA modelInstance) {
this();
maintainInModel(modelInstance);
}
/**
Returns the modelInstance associated with this ModelClass
*/
public Y_TF_EMPLOYEEDATA modelInstance() {
return (Y_TF_EMPLOYEEDATA)associatedModel();
}
/**
Returns the result from the last RFC call
*/
public com.shell.shellpeople.wd.teamflow.model7.Y_Tf_Employeedata_Output getOutput() {
return (com.shell.shellpeople.wd.teamflow.model7.Y_Tf_Employeedata_Output)_outputAdapter();
}
/**
Hook method that executes the RFC call to the backend by calling the
corresponding send method in the model class.</p>
*
The result can be retrieved using the method "getOutput()", giving access to the
default 1:1 relation role "Output" which all executable ModelClasses do implement.</p>
*/
protected final void doExecute()
throws com.sap.aii.proxy.framework.core.SystemFaultException,
com.sap.aii.proxy.framework.core.ApplicationFaultException,
com.sap.tc.webdynpro.modelimpl.dynamicrfc.WDDynamicRFC_Fault_Exception,
com.sap.tc.webdynpro.modelimpl.dynamicrfc.WDDynamicRFCExecuteException {
outputAdapter( modelInstance().yTf_Employeedata(this));
}
protected com.sap.tc.webdynpro.modelimpl.dynamicrfc.DynamicRFCModel.MetadataCache wdGetMetadataCache() {
return com.shell.shellpeople.wd.teamflow.model7.Y_TF_EMPLOYEEDATA.wdGetStaticMetadataCache();
}
protected Class _associatedModelClazz() {
return _associatedModelClazz;
}
protected com.sap.tc.webdynpro.progmodel.model.api.WDModelScopeType _defaultScope(){
return DEFAULT_SCOPE;
}
/****************************************************************************
1:n Relation -> Countries
***************************************************************************/
/** getter for 1:n Relation Role -> Countries
@return java.util.List containing elements of 1:n Relation Role Countries */
public java.util.List getCountries() {
return (java.util.List)getRelatedModelObjects("Countries");
}
/** setter for 1:n Relation Role -> Countries
@param newList java.util.List replaces previous List of elements of 1:n Relation Role Countries */
public void setCountries(com.sap.aii.proxy.framework.core.AbstractList list) {
setRelatedModelObjects("Countries", list);
}
/** adds an element to the 1:n Relation Role -> Countries
@param o object to be added to List of elements of 1:n Relation Role Countries
@return true if element was added */
public boolean addCountries(com.shell.shellpeople.wd.teamflow.model7.T005T o) {
return addRelatedModelObject("Countries", o);
}
/** removes the given element from the 1:n Relation Role -> Countries
@param o object to be removed from List of elements of 1:n Relation Role Countries
@return true if element existed and was removed */
public boolean removeCountries(com.shell.shellpeople.wd.teamflow.model7.T005T o) {
return removeRelatedModelObject("Countries", o);
}
/* ***************************************************************************
ModelAttribute -> Pernr
**************************************************************************/
/** getter for ModelAttribute -> Pernr
@return value of ModelAttribute Pernr */
public java.lang.String getPernr() {
return super.getAttributeValueAsString("Pernr");
}
/** setter for ModelAttribute -> Pernr
@param value new value for ModelAttribute Pernr */
public void setPernr(java.lang.String value) {
super.setAttributeValueAsString("Pernr", value);
}
/*
The following code section can be used for any Java code that is
not to be visible to other controllers/views or that contains constructs
currently not supported directly by Web Dynpro (such as inner classes or
member variables etc.). </p>
*
Note: The content of this section is in no way managed/controlled
by the Web Dynpro Designtime or the Web Dynpro Runtime.
*/
//@@begin others
//@@end
}
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.