cancel
Showing results for 
Search instead for 
Did you mean: 

cannot modify data with a BAPI CHANGE

Former Member
0 Kudos

Hi,

I try to change the student address with the bapi : bapi_student_address_change. When I run the application, there is no error, but no data is changed !

Here is my code :

-


public void ExecuteAddressChange( )

{

//@@begin ExecuteAddressChange()

Bapi_Student_Address_Change_Input inputAddressChange =

new Bapi_Student_Address_Change_Input();

wdContext.nodeStudent_Address_Change().bind(inputAddressChange);

Bapi_Transaction_Commit_Input inputCommit =

new Bapi_Transaction_Commit_Input() ;

wdContext.nodeStudentAddressCommit().bind(inputCommit) ;

String address = wdContext.currentAddressdataElement().getStreet();

String postalCode =

wdContext.currentAddressdataElement().getPostl_Cod1();

String houseNo = wdContext.currentAddressdataElement().getHouse_No();

String City = wdContext.currentAddressdataElement().getCity();

String telephone = wdContext.currentStudent_Address_GetdetailElement().getNoTelephone() ;

String mobile = wdContext.currentStudent_Address_GetdetailElement().getNoMobile();

String objectID = wdContext.currentStudent_Address_GetdetailElement().getObjectid();

com.sap.cm.studentchange.model4.Bapibus1006_Address model =

new com.sap.cm.studentchange.model4.Bapibus1006_Address();

model.setStreet(address);

model.setPcode1_Ext(postalCode);

model.setHouse_No(houseNo);

model.setCity(City);

wdContext.nodeAddressdata2().bind(model) ;

Bapibus1006_Address_X modelX = new Bapibus1006_Address_X();

modelX.setStreet(true);

modelX.setPcode1_Ext(true);

modelX.setHouse_No(true);

modelX.setCity(true);

wdContext.nodeAddressdata_X().bind(modelX) ;

try {

wdContext

.currentStudent_Address_ChangeElement()

.modelObject()

.execute();

wdContext

.currentStudentAddressCommitElement()

.modelObject()

.execute() ;

} catch (Exception ex) {

// If an exception is thrown, then the stack trace will be printed

ex.printStackTrace();

}

//@@end

-


Can you help me ?

Thanks,

Mathieu

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

After model.setCity(City) try this,

inputAddressChange.add<>(model);

Same for another structure

inputAddressChange.add<>(modelX);

Regards,

Saravanan K

Former Member
0 Kudos

Hi Saravan,

Thank you for your help. I have only the method : inputAddressChange.addAddressusage().

I haven't method add for my object model !

Have you got an idea ?

Thanks.

Regards,

Mathieu

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Check the lines

com.sap.cm.studentchange.model4.Bapibus1006_Address addmodel =

new com.sap.cm.studentchange.model4.Bapibus1006_Address();

addmodel .setStreet(address);

addmodel .setPcode1_Ext(postalCode);

addmodel .setHouse_No(houseNo);

addmodel .setCity(City);

inputAddressChange.add<Find the method>(addmodel);

I don't understand the second structure...Kindly clarify

Regards,

Saravanan K

Former Member
0 Kudos

Hi Saravanan,

I will check the line, but there is no add method for the parameter type : com.sap.cm.studentchange.model4.Bapibus1006_Address

I have already develop a java client interface to change user data and I use both structures ADRESS (with values) and ADDRESSX (with flags that corresponding value updated).

Regards,

Mathieu