Skip to Content
0

IF_WAPI_WORKITEM_CONTEXT~GET_WORKITEM_ID

Apr 18, 2017 at 01:35 PM

94

avatar image

Hi,

am working on requirement where I have to update few things in SAP, when a mail is sent from Outlook to a SAP email-id (Inbound).

I happened to get a blog on 'Offline Approval' which does somewhat similar thing.

But in this blog to read workitem id 'after creation' for a decision step which is handled thru a Program exit where there is a code as below:

CALL METHOD wi_context->get_workitem_id RECEIVING re_workitem = l_wi_id.

But when I use this, I get an exception where I do not see the workitem id being captured in 'l_wi_id'.

Error that I get CX_SY_REF_IS_INITIAL for CX_SY_NO_HANDLER.

My question is what must have gone wrong in this code or is there any other way to get workitem id.

Thanks

Aditya V

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Pavan Bhamidipati Apr 18, 2017 at 01:48 PM
0

Hi,

Please check the below wiki. Probably you should try with get header.

Thanks, Pavan

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hi PB,

no luck, its not capturing the WI-ID after creation of workitem for that user-decision step.

I dont know if am missing something!!!

Thanks,

Aditya

0
Aditya Varrier Apr 25, 2017 at 09:17 AM
0

hi

anyone tried to capture 'workitem id' of a workflow step thru a program-exit?

I tried using 'get_workitem_id' method but it isnt capturing any workitem. any inputs highly appreciated.

Thanks,

Aditya V

Show 4 Share
10 |10000 characters needed characters left characters exceeded

Hi AV,

I hope you already did the below checks

  1. if the program exit is included in the workflow definition of the decision step.
  2. The WI_CONTEXT is referring to type IF_WAPI_WORKITEM_CONTEXT.
  3. Is there any start condition, Can you check what is the status of the work item when it is created, is in Ready or Reserved.
  4. Try to type cast the instance of the if_wapi_workitem_context to CL_SWF_RUN_WORKITEM_CONTEXT and try to CALL METHOD wi_context->if_wapi_workitem_context~get_workitem_id
  5. The other options would be check if you are able to get the instance of the workitem id directly by using the importing attribute IM_WORKITEM_CONTEXT rather moving it into a local or global attribute.

Thanks, Pavan

0

Hi PB,

Point-1, yes included in WF definition.

Point-2, yes wi_context referring to type IF_WAPI_WORKITEM_CONTEXT.

Point-3, status is in READY

Point-4, tried the CL_SWF too, no luck.

Point-5, can you elaborate please, do you mean I should use this attribute inside the method 'after_wi_creation' that am using?

Thanks,

Aditya V

0
can you elaborate please, do you mean I should use this attribute inside the method 'after_wi_creation' that am using?

The code whatever that you have implemented in the after_wi_creation can you just write directly inside EVENT_RASIED method.

Thanks, Pavan

0

hi PB,

yes, I had tried that too, no luck.

Issue is that those methods arent fetching me workitem-id, if I hardcode workitem-id, that exit works as I need.

Thanks,

0
Aditya Varrier Apr 27, 2017 at 07:35 AM
0

Hi,

is there a way that I could debug the exit-code, like whenever I run the WF, it should go to the code.

I know if I run WF, it addresses WF-BATCH which is a SYSTEM user and break-point that I set is from DIALOG user.

Thanks,

Aditya V

Show 2 Share
10 |10000 characters needed characters left characters exceeded

A infinite loop , after that you can debug the session from sm50.

Thanks,Pavan

1

Hi PB,

using get_header() I finally got the workitem id.

Thanks,

Aditya V

0