cancel
Showing results for 
Search instead for 
Did you mean: 

SUP Call RFC in SAP - MBO Operation

Former Member
0 Kudos

Hello community,

I'am having a problem with a MBO operation.

This operation creates a new sales order in SAP ERP with an implemented RFC function module. Within this function module, the BAPI "BAPI_SALESORDER_CREATEFROMDAT2" is called to create the sales order.

The input data come from a workflow application, which makes an online request to this MBO/operation.

The creation of new sales orders with the workflow application is always succesful, but I integrated an authority check. Therefore I want the receive the output of the operation, which includes the sales order number, the reason why the creation was unsuccesful or a message that the user haven't got the corresponding authority.

How can receive/read the output data? I need this output to show a message to the user.

I'am using SUP 2.1.

Thanks for your help

Accepted Solutions (1)

Accepted Solutions (1)

SyambabuAllu
Contributor
0 Kudos

Dear Patrik,

Here need to develop the custom ABAP code for get the output of sales order document number called as DCN code in SAP side.

One more thing DCN for CDB update have to go through this link

http://scn.sap.com/docs/DOC-28897

Thanks,

Syam.

Former Member
0 Kudos

Dear Syam,

thanks for your response. Isn't there any other way to realize this?

The only thing I want, is to show a JavaScript alert, which show the sales order number or an error message.

Thanks.

Patrik

Former Member
0 Kudos

Hi Patrik,

While creating the MBO for order creation, you would have had multiple output tables in your BAPI (For ex, RETURN,OUTPUT etc). You mush have selected these two at least. I assume that RETURN contains the status of the order creation (SUCCESS,FAILED,WARNING) and the OUTPUT contains the order number if the order creation is successful.

In your case, after the BAPI is executed, you have to check the records present in these two MBOs (RETURN, OUTPUT).

In Custom.js file, in customAfterSubmit() method, use getCurrentMessageValueCollection() to get the message value pairs that would have been populated after the RFC execution.

And get the data for the key "RETURN" and check the status.

Based on the status, either you can display the error msg or order number in the alert.

For more info about MessageValueCollection, read Customizing mobile workflow application section in infocenter.sybase.com.

With regards,

Raja

Former Member
0 Kudos

Hi Raja,

thanks for your response. This was my first idea which I tried, but I can't get it to work.

The RFC (its a custom RFC based which calls a BAPI) has two input tables and one output table (return). The input table will be send to Unwired Server but it seems that the return table won't be send back. There is no key within the workflow app and I can't create one which refers to the this output table.

Is it possible, that I declare the output table also as input table in the MBO operation? My idea is, that an empty return list will be send to the MBO, which will be filled by the RFC function module. In this case I could create a key on the input/output return table and can read the data with getCurrentMessageCollection.

Thanks for your help.

Former Member
0 Kudos

Did you try creating the MBO for OUTPUT table as well when you create the operation?

If you could, that will solve the problem.

Former Member
0 Kudos

Hi Syam,

after some unsuccessful attempts to get the output without DCN, I decided to go this was.

The document you refered to was very helpful. I implemented the required ABAP code to send a message to the SUP server. The DCN will be send successful but the message won't be shown in the hybrid web container app on my iPad.

I think the problem is the format of the JSON String which includes the necessary parameters.

Here is a sample JSON DCN string:

{"id":"0000000001","op":"upsert","subject":"new message (id: 1)","to":"supAdmin","from":"SAP_DCN","read":false,"priority":true,"body":"text"}

I created a HTTP-Destination in SM59 based on your description.

In the ABAP code I add the parameters cmd ("wf"), domain ("default") and package ("name of the package") and set the JSON string as request data.

In the workflow app I created a server-initiated starting point which extracts the id in the subject of the message and makes an online request to the corresponding MBO (object query which parameter id).

Did I miss some parameters or why isn't it working?

Thanks once again for your help

Former Member
0 Kudos

I don't know why, but now it is working.

Thanks for your help.

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Patrick.

I am trying to create a purchase order using BAPI_PO_CREATE1. As the inputs are structure type I created structure type personalization keys and they were mapped. Bu the workflow errors as can not read the metadata dor DOC_TYPE. I suspect it is related to structure type mapping. I tried without structure also but did not work. Any comment. You mentioned you created sales order successfully and I wonder how? Thanx.

Former Member
0 Kudos

Hi Masoud,

to create sales orders I created a Z-function module, were I only use the min. required data to create a sales order with the BAPI "BAPI_SALESORDER_CREATEFROMDAT2" succesfully. Therefore I defined Z-structures that I used to map to corresponding keys in the workflow app.

The mapping to the data which the BAPI needs, was implemened in the function module.

In the MBO definition, I used this Z-function module within an operation (CREATE). In the workflow application, I mapped the required input data with corresponding keys in the application. I didn't use any personalization keys, I don't know if there's a problem with that.

Regards

Patrik

Former Member
0 Kudos

Thanx Patrick. I wonder if there is a sample function modules for me to look at (similar to your sales order creation) so I could become more familiar with RFC process and create my own.

Former Member
0 Kudos

hi Patric

i am new in sup, i want to call BAPI_SALESORDER_GETLIST and othe function module through workflow methode. can u plz tell me the correct procedure.

MBO are created but i am unable to cache both return and outout. i am unable to show output on my screen.

regards

sourav singh

SyambabuAllu
Contributor
0 Kudos

Hi Sourav,

What you want exactly can explain your requirement clearly here, i think u need to download the Sales order list data using workflow mechanism..is it Ur requirement?

Thanks,

Syam.

Former Member
0 Kudos

Hi Syambabu

thanks for ur concern but i fix my problem nw i am working on bapi_salesorder_createfromdat1 as a operation on bapi_salesorder_getlist. but am getting error and i am also confuse in MBO;s miltiple mbo are creted in the monble bussines obkect directory, Can u plz guide me and send me the correct procedure.

Thanks

Regards

Sourav Singh

SyambabuAllu
Contributor
0 Kudos

Dear Patrik,

Nice,

Thanks,

Syam.