cancel
Showing results for 
Search instead for 
Did you mean: 

Strange issue with Z BAPI

Former Member
0 Kudos

Hi Experts,

I have used some logic to enter record in R/3 table using SAP supplied BAPI. The record is getting inserted. Using the same logic when I am trying to insert the data using ZBAPI, my data is not reaching R/3. What may be the possible reason.

Code for SAP Supplied BAPI - It works fine.

Bapi_Catimesheetmgr_Insert_Input Input = new Bapi_Catimesheetmgr_Insert_Input();

wdContext.nodeBapi_Catimesheetmgr_Insert_Input().bind(Input);

wdContext.currentBapi_Catimesheetmgr_Insert_InputElement().setProfile("somevalue");

Date workdate = new Date(System.currentTimeMillis());

workdate = wdContext.currentContextElement().getDate();

Bapicats1 xyz = new Bapicats1();

xyz.setCatshours(new BigDecimal ("1"));

xyz.setWbs_Element("somevalue");

xyz.setEmployeenumber("somevalue");

xyz.setWorkdate(workdate);

Input.addCatsrecords_In(xyz);

wdThis.wdGetPoCCustController().executeBapi_Catimesheetmgr_Insert_Input();

wdThis.wdGetPoCCustController().executeBapi_Transaction_Commit_Input();

Code for Z BAPI (It does not work)

Zbapi_Catimesheet_Update_Input Input = new Zbapi_Catimesheet_Update_Input();

wdContext.nodeZbapi_Catimesheet_Update_Input().bind(Input);

Date workdate = new Date(System.currentTimeMillis());

workdate = wdContext.currentContextElement().getWdate();

wdContext.currentZbapi_Catimesheet_Update_InputElement().setPersonalnumber("somevalue");

wdContext.currentZbapi_Catimesheet_Update_InputElement().setProfile("somevalue");

wdContext.currentZbapi_Catimesheet_Update_InputElement().setWork_Date(workdate);

Zbapicatsd1 AA = new Zbapicatsd1();

AA.setWbs_Element("somevalue");

AA.setDay1("1");

AA.setDay2("1");

AA.setDay3("1");

AA.setDay4("1");

AA.setDay5("1");

AA.setDay6("1");

AA.setDay7("1");

AA.setPerson_No("somevalue");

Input.addWorklist_Act(AA);

wdThis.wdGetSsCustController().executeZbapi_Catimesheet_Update_Input()

wdThis.wdGetSsCustController().executeBapi_Transaction_Commit_Input();

Can you please let me know what is going wrong with the Z BAPI code. Please note that using R/3 front end (SAP GUI), I am able to insert data for Z BAPI.

Regards,

Brian

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Experts,

Further to the following question, please note that table Zbapicatsd1 is a very big table and the total number of columns is around 300 (Approx). Out of this, there are 9 mandatory fields. I have set the value of these fields using following code:

AA.setWbs_Element("somevalue");

AA.setDay1("1");

AA.setDay2("1");

AA.setDay3("1");

AA.setDay4("1");

AA.setDay5("1");

AA.setDay6("1");

AA.setDay7("1");

AA.setPerson_No("somevalue");

Is there is any memory issue with Web Dynpro here? Can you please advise.

Regards,

Brian

Former Member
0 Kudos

hi

Check if your ZBAPI calls commit to save all that is coming from WebDynpro.

I faced a similar problem sometime back with the creation of PR in R/3. I had to force a commit in the ZRFC to save the data instantly. May be it helps.

regards

LNV

Former Member
0 Kudos

Hi VLN,

In this context, I will speak to ABAPer. However, I have one concern here. Using Z BAPI, I am able to save record using R/3 front end. Does this mean that every thing is fine with Z BAPI?

If it is the case then there may be some other reason for non-insertion of record. It is possible that I may have done mistake some where else. Or the table parameter of Z BAPI is creating problem. Ae metioned above the table has around 300 fields. There might be some memory issue.

Regards,

Brian

Former Member
0 Kudos

Brian,

Are you getting any errors while inserting the records from the WD.

Try and print the val;ues of the return message that the ZBAPI will have after execution.

Thanks and Regards

Pradeep

Former Member
0 Kudos

Hi Pradeep,

Z BAPI is still in development phase. Exception is not handled in the Z BAPI at this point of time.

Regards,

Brian

former_member751941
Active Contributor
0 Kudos

Hi Brian,

After executing BAPI.Use this code for commit the changes in R3.

wdContext.currentBapi_Transaction_Commit_InputElement().modelObject().execute();

wdContext.nodeTransactionCommitOutput().invalidate();

Regards,

Mithu

Former Member
0 Kudos

Hi Mithu,

Thanks. I have done this as well.

The codes are:

In View

try {

wdThis.wdGetSsCustController().executeZbapi_Catimesheet_Update_Input();

wdThis.wdGetSsCustController().executeBapi_Transaction_Commit_Input();

} catch (Exception e) {

wdComponentAPI.getMessageManager().reportException(e.getMessage(),false);

}

In Controller

wdContext.currentBapi_Transaction_Commit_InputElement().modelObject().execute();

wdContext.nodeOutput1().invalidate();

Regards,

Brian