cancel
Showing results for 
Search instead for 
Did you mean: 

IF_WAPI_WORKITEM_CONTEXT~GET_WORKITEM_ID

former_member184495
Active Contributor
0 Kudos

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

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member184495
Active Contributor
0 Kudos

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

bpawanchand
Active Contributor

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

Thanks,Pavan

former_member184495
Active Contributor
0 Kudos

Hi PB,

using get_header() I finally got the workitem id.

Thanks,

Aditya V

former_member184495
Active Contributor
0 Kudos

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

bpawanchand
Active Contributor
0 Kudos

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

former_member184495
Active Contributor
0 Kudos

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

bpawanchand
Active Contributor
0 Kudos
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

former_member184495
Active Contributor
0 Kudos

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,

bpawanchand
Active Contributor
0 Kudos

Hi,

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

Thanks, Pavan

former_member184495
Active Contributor
0 Kudos

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