cancel
Showing results for 
Search instead for 
Did you mean: 

How to retreive and display return value from BAPI

Former Member
0 Kudos

Hello,

I am using SUP to create a sales order application. In my MBO I have a create operation which calls a BAPI to create a sales order. How can I retrieve the return value (saled doc number) and display it on a screen and display it as an Alert of BB application.

Regards

Nidhideep Bhandari

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi ,

i also have same requirement , i have used CBAPI to create Maintenance Order ( this is HWC application ) and i need to display newly created "ORDER NUMBER " on another screen with a message . . ORDER NUMBER is system generated number .

Thanks

Regards,

Thushara

Former Member
0 Kudos

Hello,

We were able to solve this issue using some custom logic.

Let the operation BAPI update a custom table in SAP with the error messages.

Create a BAPI to read from this custom table is SAP.

Create an MBO based on this new BAPI.

Sync from front end after the operation is completed.

The local MBO table should have the data in it with the error messages.

Hope this helps! Cheers!

Sandeep

tahir_z
Contributor
0 Kudos

Hello,

Have you solved the issue cause I have same question too, I can't get an output value while creating an operation.

Regards

rahul_mb
Active Participant
0 Kudos

Hi,

You will get the return value only after the next sync operation. So after doing sync with the backend, the sales order number will be populated. But this cannot be shown as an alert at the moment you create the sales order in device.

Thanks and Regards,

Rahul Muraleedharan.

tahir_z
Contributor
0 Kudos

Hi rahulmb ,

Thnx for replying, my point is when i create a "create operation" with BAPI's i choose inputs beside them i choose an output as well but i can't see the ouput parameter on creation structure . for example : if i create a new record on the device if the same record is already in backend then my output returns "it already contains etc.." what i mean is i cant see the output parameter either in eclipse workspace or in java class.

regards

rahul_mb
Active Participant
0 Kudos

Hi,

When you add the CREATE operation to the MBO, you have to choose the input and ouput parameters. The parameters which are selected as the input parameter will only be available in the creation structure. The output structure will not be available there. So you may have to create another screen which displays the ouput, in your example whether the record already exist or not.

Regards,

Rahul Muraleedharan.

tahir_z
Contributor
0 Kudos

Raulmb,

I have created a MBO which containts only output and created a "create operation" structure then created two different screens for corresponding MBO and structure, but when i run the operation the output didn't change ! so there has to be a relation between them because. Hope im clear

Regards

rahul_mb
Active Participant
0 Kudos

Hi,

Sorry, I didnt get the exact scenario. can you please give a bit more explanation.

As per my understanding you have created an MBO as output parameter of a BAPI/RFC. Then you have created a CREATE operation for the MBO. Have you checked the input or the output parameter of the Modify BAPI/RFC?

Regards,

Rahul Muraleedharan.

tahir_z
Contributor
0 Kudos

rahulmb ,

first of all my rfc has an output if user saves a request which already in backend then rfc returns a message by that output, so as you said even i choose output parameter while creating an operaiton structure im not able to see that, right ?. So i created a MBO for output and a operation structure. I run the applicaiton and making a operation but the output doesn't change, even i entering same records. The output has to show an error message but nothing shows. In my opinion,im not sure but the output has to have a relation to the moment of the operaiton i mean it has to relate to corresponding operation by making any relation.

Regards

Former Member
0 Kudos

Hi Ozmrdn,

Have you fixed the issue ?

I wanted to know, how can we input the values via the application to the bapi/rfc method.., As far as I know., In native code, we need to create an instance of that particular MBO class and then access the operation responsible for sending the parameters to the BAPI which then updates the backend. Is that how it is done ?

Former Member
0 Kudos

Rahul

My experience with RFCs as an operation is that it is best used as update operation only . i.e RFC with no output parameters

If you have input and output parameters for and RFC it is best to create a new separate MBO.

Thanks

Pradeep

Edited by: Pradeep Gudipati on May 12, 2011 12:33 PM

Former Member
0 Kudos

Does anyone knows how to do it? I have the same question too, doing a MPO using BAPI_CUSTOMER_CREATEFROMDATA, I can't retrieve the CustomerID that has been created.

Anyone has any example? ou tutorial that can show to us?

Please and thanks.

Former Member
0 Kudos

Hi,

I am facing the same problem..Any solution for this?

Thanks,

Satish

former_member206574
Active Participant
0 Kudos

Hi,

Here you have to create two mbo's one for create operation and for retrieving the new sales order no from the table where it was created.

U have two bapis for this, and have to synchronize both the mbos simultaneously by creating syncronization group for two MBO's.

Regards,

Venu

david_brandow
Contributor
0 Kudos

If you have an operation that has return parameters, such as a create, you currently have to do this by creating a MBO and using that operation as the load operation for that MBO and map the return parameters to MBO attributes. When you invoke an object query on the MBO, it'll invoke the load operation, which will do the create, and you can then inspect the MBO instance's attribute values to determine what the return parameter values were.

Former Member
0 Kudos

HI David

We got your point of making Create Operation as an MBO, not as operation and then getting the output as attribute. As of my knowledge, i will make same number of personalization keys (= number of inputs to create operation) and provide them values while making UI.

But what are you suggesting, is related to some object query. Can you please brief on "Object Query" solution ?

Thanks in Advance.

Pankaj

Former Member
0 Kudos

Hi David Brandow,

I have tried your solution where I just created a MBO for my 'operation' and I'm using sync parameters to execute the RFC.

The problem I'm facing is, for example, if I create a record it gets saved in the MBO table and the record successfully gets created in SAP as well after a sync. But when I create another record and sync, the previously saved record in MBO table also gets executed so I'm getting duplicate entries in SAP.

Have you or anyone faced this problem?

Any response is appreciated. Please let me know if I'm not clear, I realized its a complicated scenario.

Thanks,

Sandeep