cancel
Showing results for 
Search instead for 
Did you mean: 

I am unble set values to rfc function module.....

Former Member
0 Kudos

Hi

My Context is like this................

Request........

.....|---Parameters

..........|---PiAddress

................|---city..

................|--- etc....

..........|---CustomerNo

..........|---piDistrb

..........|---piDivision

..........|---SalesOrg

I have written following code in CustomerController


 public void wdDoInit()
  {
 Request_Z_BAPI_CUSTOMER_CHANGE_WS_customerChangeFromData customer = new Request_Z_BAPI_CUSTOMER_CHANGE_WS_customerChangeFromData();
 	ComplexType_CustomerChangeFromData complexType = new ComplexType_CustomerChangeFromData();
    ComplexType_Bapikna101 bapi = new ComplexType_Bapikna101();
	bapi.setCity("RIYAD");
	bapi.setCountraiso("SA");
	bapi.setCountrniso("SA");
	bapi.setCountry("SA");
	bapi.setFaxNumber("12345678");
	bapi.setFirstName("Test1");
	bapi.setInternet("ravis@quinnox.com");
	bapi.setLanguIso("EN");
	bapi.setName("Test2");
	bapi.setName3("Test3");
	bapi.setName4("Test4");
	bapi.setPostlCode("12345");
	bapi.setTelephone("12345678");
	bapi.setTelephone2("12345678");
	
	complexType.setCustomerNo("0000040009");
	complexType.setPiDistrChan("01");
	complexType.setPiDivision("01");
	complexType.setPiSalesorg("QNIN");
	
	complexType.setPiAddress(bapi);
	customer.setParameters(complexType);
	
    customer._setUser("abap");
    customer._setPassword("quinnox");
	wdContext.nodeRequest_Z_Bapi_Customer_Change().bind(customer);
	IPublicCustomerAddressCustom.IParametersElement element = wdContext.createParametersElement(complexType);
	wdContext.nodeParameters().addElement(element);
	IPublicCustomerAddressCustom.IPiAddressElement adElement = wdContext.createPiAddressElement(bapi);
	wdContext.nodeParameters().nodePiAddress().addElement(adElement);
}	

and i am executing the function like this

 public void executeCustomerAddress( )
  {
    //@@begin executeCustomerAddress()
    try{
		
		wdContext.currentRequest_Z_Bapi_Customer_ChangeElement().modelObject().execute();
		wdContext.nodeResult().invalidate();
    	wdContext.nodeResponse().invalidate();
    	
    }catch(Exception e){
    	wdComponentAPI.getMessageManager().reportSuccess(" Error in Controller "+e);
    }
    //@@end
  }

I think my problem is context is allowing but rfc is not getting any value thats why its not giving any desired results...that may be the reason i am still getting the following error

Error in Controller java.rmi.RemoteException: Service call exception; nested exception is: com.sap.engine.services.webservices.jaxrpc.exceptions.XmlMarshalException: XML Serialization Error. Property [PiAddress] of class [com.sap.customer.address.model.proxies.types.p1.CustomerChangeFromData] must exist and can not be null. This is required by schema description.

Now how to set these values to rfc. How to resolve this problem.... Can any one give me any suggessions.

I am able to set values to CUSTOMERNO,SALESORG,PIDIVISION and PIDISTR.. I am unable to set piAddress values to rfc

I am executing the function like this

wdContext.currentRequest_Z_Bapi_Customer_ChangeElement().modelObject().execute();

wdContext.nodeResult().invalidate();

wdContext.nodeResponse().invalidate();

It will be very helpful to me...

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

hi ravi,

i think the problem is with these two statements.

<b> complexType.setPiAddress(bapi);

customer.setParameters(complexType);</b>

Can you breifly explain what you are trying to do here?

Also,Check out this threads

Regards,

Gopi

Former Member
0 Kudos

Hi

Actually i made one Function Module <b>(BAPI_CUSTOMER_CHANGEFROMDATA)</b> as webservice

I have created one model using the wsdl file. I got the following structure in my application

ChangeAddressModel

...|-----Request_Z_Bapi_Customer_Change_WS_CustomerChange

..........|-----parameters(ComplexType_CustomerChangeFromData)

..................|-----ComplexType_CustomerChangeFromData

.........................|------piAddress(ComplexType_Bapikna101)

.........................|........|-----ComplexType_Bapikna101

.........................|................|-- city

.........................|................|-- country

.........................|................|-- faxNumber

.........................|................|-- .......etc

.........................|----- customerNo

.........................|----- piDistrChan

.........................|----- piDivision

.........................|----- piSaleOrg

I have written the following code in my CustomController

Request_Z_BAPI_CUSTOMER_CHANGE_WS_customerChangeFromData customer = new Request_Z_BAPI_CUSTOMER_CHANGE_WS_customerChangeFromData();
	ComplexType_CustomerChangeFromData dataStructure = new ComplexType_CustomerChangeFromData();
	
	ComplexType_Bapikna101 bapi = new ComplexType_Bapikna101();
	customer._setUser("abap");
	customer._setPassword("quinnox");
	
	customer.setParameters(dataStructure);
	
	wdContext.nodeRequest_Z_Bapi_Customer_Change().bind(customer);

I have executed like this


public void executeChangeAddress( )
  {
    //@@begin executeChangeAddress()
    try{
		
    	wdContext.currentRequest_Z_Bapi_Customer_ChangeElement().modelObject().execute();
    	wdContext.nodeResponse().invalidate();
    }catch(Exception e){
    	wdComponentAPI.getMessageManager().reportException("Error :"+e,true);
    }
    //@@end
  }

But i am getting the following error........

when i am executing this application i am getting the following error

<b>com.sap.engine.services.webservices.jaxrpc.exceptions.XmlMarshalException: XML Serialization Error. Property <u><i>[PiAddress</i></u>] of class [com.sap.changeaddress.model.proxies.types.p1.CustomerChangeFromData] must exist and can not be null. This is required by schema description.</b>

<i><b>In the above case i am unable to set data into PIAddress</b></i>

After that i have changed my code like this


	Request_Z_BAPI_CUSTOMER_CHANGE_WS_customerChangeFromData customer = new Request_Z_BAPI_CUSTOMER_CHANGE_WS_customerChangeFromData();
	
	
	ComplexType_CustomerChangeFromData complexType = new ComplexType_CustomerChangeFromData();
	wdContext.nodeParameters().bind(complexType);
	
	ComplexType_Bapikna101 bapi = new ComplexType_Bapikna101();
	wdContext.nodePiAddress().bind(bapi);
	Response_Z_BAPI_CUSTOMER_CHANGE_WS_customerChangeFromData response = new Response_Z_BAPI_CUSTOMER_CHANGE_WS_customerChangeFromData();
	Bapikna101 bapi1 = new Bapikna101(); 
	bapi1.setCity("RIYAD");
	bapi1.setCountraiso("SA");
	bapi1.setCountrniso("SA");
	bapi1.setCountry("SA");
	bapi1.setCountryiso("SA");
	bapi1.setFaxNumber("12345678");
	bapi1.setFirstName("First Name");
	bapi1.setInternet("ravi@shankar.com");
	bapi1.setDateBirth("02.02.06");
	bapi1.setLanguIso("EN");
	bapi1.setName("Name");
	bapi1.setName3("Name 3");
	bapi1.setName4("Name 4");
	bapi1.setRegion("GB");
	bapi1.setFormOfAd("Address");
	bapi1.setStreet("Street");
	bapi1.setPostlCode("12345");
	bapi1.setLangu("X");
	bapi1.setTelephone("12345678");
	bapi1.setTelephone2("12345678");
	bapi1.setCurrency("INR");
	bapi1.setCurrencyIso("INR");
	bapi1.setOnlyChangeComaddress("X");
	complexType.setCustomerNo("0000040009");
	complexType.setPiDistrChan("01");
	complexType.setPiDivision("01");
	complexType.setPiSalesorg("QNIN");
	customer._setUser("abap");
    customer._setPassword("quinnox");
	CustomerChangeFromData data = new CustomerChangeFromData();
	data.setPiAddress(bapi1);
	complexType.setPiAddress(bapi);
	customer.setParameters(complexType);
	complexType.setPiAddress(bapi);
	customer.setParameters(complexType);
	complexType.setOriginalBean(data);

In the above case i am able to set data but i am getting the following error

<b>javax.xml.rpc.soap.SOAPFaultException: Deserialisation failed</b>

how to resolve this problem please tell me

Best Regards

Ravi Shankar B

Former Member
0 Kudos

Hi Ravi:

have you figured out the problem in the meantime?

I ran across a similar issue and it was indeed a "deserialisation" problem In my case I had passed a date as "yyyymmdd" when the schema had asked for a string adhering to the pattern "yyyy-mm-dd".

First step in troubleshooting should be to compare the schema against the values you're providing.

Cheerio, Harry.

former_member720137
Active Participant
0 Kudos

Hi

Read this thread.. It will solve ur problem.. even i was facing this problem earlier..

Thanks

Message was edited by:

Puneet Walia