cancel
Showing results for 
Search instead for 
Did you mean: 

BAPI to Set User Status in PM Work Order

0 Kudos

I am try to use BAPI_ISUSMORDER_USERSTATUSSET to set a User Status of MCMP in a work order.  My problem is that I don't know how to set the parameter for "Status" because it has sub categories for Internal (System Status) and External (User Status.  Here is my script and any help would be appreciated.

var order = session.findById("wnd[0]/usr/txtPersonas_1456173699701").text;

var rfc = session.createRFC("BAPI_ISUSMORDER_USERSTATUSSET","");

rfc.setParameter("NUMBER", order);

rfc.setParameter("STATUS", "MCMP");

rfc.setParameter("INACTIVE", "");

rfc.send();

Accepted Solutions (1)

Accepted Solutions (1)

former_member183045
Contributor

User Status is a structure. Thus you have to populate the parameter in setParameter withthis structure.

See an example call here:a

Hope it helps, Andreas

0 Kudos

Thank you Andreas!

I worked with my Basis team and they helped me with the solution.

Here the script for all to enjoy!

var shortorder = session.findById("wnd[0]/usr/txtPersonas_1456173699701").text;

var order = ("000000000000" + shortorder).slice(-12);

var rfc = session.createRFC("BAPI_ISUSMORDER_USERSTATUSSET");

rfc.setParameter("NUMBER", order);

var statusStructure = { EXTERN: 'MCMP' };

rfc.setParameter("STATUS",JSON.stringify(statusStructure));

rfc.setParameter("INACTIVE", "");

rfc.requestResults('["RETURN"]');

rfc.send();

var ret = rfc.getResult("RETURN");

session.utils.log(JSON.stringify(statusStructure));

session.utils.log(ret);

Answers (0)