cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to trigger the workflow for tcode XD01 using BOR when customer is created

former_member183134
Participant
0 Kudos

Hi Experts,

My requirement is I need to trigger the workflow when ever customer is created in XD01.

I have already go through many post which have the answer  but still iam not getting by following that.

Please give me clearly step by step procedure how to do because I am just a beginner for the Workflow.

I have done the follow things.. but still I am not able to achieve.


Step1 : Created a custom subtype (Z_KNA1) for KNA1 and created Zevent in the Z_KNA1.

Step2: Delegate Z_KNA1 TO KNA1.

Step3: In tcode SWEC created an entry like below.

         DEBI--KNA1--ZEvent.

step4: In tcode SWETYPV created an entry like below.

        BOR--KNA1--Zevent --WFno-- typelinkage checked.

step5: In WF basicdata maintained the BOR and Zevent which i created in the start event with binding and everything.

When I created the Custer data in XD01 it is throwing Error. (if step3 maitained as above) No Entry I can find in SWEL.

Screenshot for tcode SM13 of the Error.

When I created the customer data in XD01 it is saving if step3 maintained as below Entry I can see in SWEL  but workflow is not triggering.

step3: DEBI-CLBUS1007-Zevent.

Accepted Solutions (1)

Accepted Solutions (1)

former_member183134
Participant
0 Kudos

Hi Rick,

I have triggered my workflow using user exit EXIT_SAPMF02D_001. Now I am facing issue with my Task used in workflow.

Task is not working in the workflow. When i saw the WF logs in SWIA my workflow is stopped in the task step.

Step1 : Mail notification.( Working-received mail to inbox)

Step2: Identification of approver. (this task is not at all working/triggering).

Former Member
0 Kudos

It might happen that the background method generated a dump etc. Please check ST22.

Also share the screen shot of log for further analysis.

former_member185167
Active Contributor
0 Kudos

So all of the previous problems were resolved? That's good, but please say exactly how they were resolved, it may be useful to somebody else in future. Then, please close this thread by marking the useful and correct answers.

For a new problem, please open a new thread. Much more chance of an answer then.

former_member183134
Participant
0 Kudos

Hi Rick,

Issue 1:

Requirement is need to trigger a workflow when ever customer is created/updated.

I am unable to trigger workflow using object type KNA1. Even though I have done the following things.

Step1 : Created a custom subtype (Z_KNA1) for KNA1 and created Zevent in the Z_KNA1.

Step2: Delegate Z_KNA1 TO KNA1.

Step3: In tcode SWEC created an entry like below.

         DEBI--KNA1--ZEvent.

step4: In tcode SWETYPV created an entry like below.

        BOR--KNA1--Zevent --WFno-- typelinkage checked.

Issue 1  is solved.

I have now called my workflow from the exit EXIT_SAPMF02D_001 using CALL FUNCTION 'SWE_EVENT_CREATE' passing object type and zevent.

Issue 2:

My Workflow is triggered properly and  the issue with Task in which I am using my Zmethod.

Note: This Task I am executing in the background.

My workflow is getting stopped when ever it is reached the Task.

In ST22 I found the log entry for WF-BATCH 'DYNPRO_SEND_IN_BACKGROUND' .

Issue 2 is solved:

This issue is due to the mistake which i was done during delegation of the Zobject to standard object.

While delegating I have checked the box 'GUI SPECIFIC' and that is the reason the task in not executing in the background. Now I have unchecked the box everything is working fine.   I am sure this post will help more people in the future.

cheers

former_member185167
Active Contributor
0 Kudos

Great! I wish everybody would do the same and always post the solutions. It's very very helpful.

By the way, you should always use SAP_WAPI function modules where possible.

Try using SAP_WAPI_CREATE_EVENT instead of SWE_EVENT_CREATE.

former_member183134
Participant
0 Kudos

Hi Rick,

Sure I will do. You just make as correct answer for my last reply which has the Entire scenario. So that everyone will be aware the answer in this post.

Thank you

former_member185167
Active Contributor
0 Kudos

Hello,

It is up to you to mark the Helpful and Correct answers.

I wish everyone would do that too...

regards

Rick

former_member183134
Participant
0 Kudos

Hi All,

IN This EXIT_SAPMF02D_001 we will get customer number only while changing the customer via XD02.. We wont get customer number while creating via XD01.


SOLUTION:


So you go with the below BADI. This will have customer number while creating/changing customer via XD01/XD02.

I Used this BADI CUSTOMER_ADD_DATA and implemented  My code in SAVE_DATA method.

Now everything is working fine and the ISSUE IS SOLVED.

Below is the code.

Method IF_EX_CUSTOMER_ADD_DATA~SAVE_DATA.

   DATA: key type sweinstcou-objkey,

              lv_returncode type sy-subrc.

Key = I_KUNNR.

IF SY-tcode ='XD01'.

CALL FUNCTION 'SAP_WAPI_CREATE_EVENT'

   EXPORTING

     object_type             = 'KNA1'

     object_key              = key

     EVENT                   = 'ZCUSTOMER_CREATE'

    COMMIT_WORK             = 'X'

    EVENT_LANGUAGE          = SY-LANGU

    LANGUAGE                = SY-LANGU

    USER                    = SY-UNAME

**   IFS_XML_CONTAINER       =

  IMPORTING

    RETURN_CODE             = lv_returncode.

*   EVENT_ID                =

** TABLES

**   INPUT_CONTAINER         =

**   MESSAGE_LINES           =

**   MESSAGE_STRUCT          =

           .

ELSEIF SY-tcode = 'XD02'.

   CALL FUNCTION 'SAP_WAPI_CREATE_EVENT'

     EXPORTING

       object_type             = 'KNA1'

       object_key              = key

       EVENT                   = 'ZCUSTOMER_CHANGE'

      COMMIT_WORK             = 'X'

      EVENT_LANGUAGE          = SY-LANGU

      LANGUAGE                = SY-LANGU

      USER                    = SY-UNAME

*     IFS_XML_CONTAINER       =

    IMPORTING

      RETURN_CODE             = lv_returncode.

*     EVENT_ID                =

*   TABLES

*     INPUT_CONTAINER         =

*     MESSAGE_LINES           =

*     MESSAGE_STRUCT          =

             .

endif.

endmethod.

So when ever Customer CREATE/CHANGE  via XD01/XD02  the above badi will trigger my ZEVENTS which is the TRIGGERING EVENTS of my WORKFLOW.    

Hope this post will help for future ABAPers and Workflow Consultants who has the similiar requirement!!!

cheers,

Anand

former_member183134
Participant
0 Kudos

Finally conclusion of this post!!!

1) If you want to trigger WF while customer creation use this BADI CUSTOMER_ADD_DATA and implemented the code in SAVE_DATA method.

Note: We wont get Customer no (Kunnr) in the Exit (EXIT_SAPMF02D_001) at the time of creation customer so using BADI.

2) If you want to trigger WF while changing the customer data (sensitive field) use the EXIT EXIT_SAPMF02D_001 because here you will get the changed data(senstive field)

so that you can validate the changed data field based on the past data of changed field from DB table.

If you found any changes after comparison you can trigger WF else no need to trigger.

Note: In BADI CUSTOMER_ADD_DATA you will not be getting the changed field value so using the EXIT.

Answers (3)

Answers (3)

former_member185167
Active Contributor
0 Kudos

Hello,

Could you show a screenshot of what you see in Triggering Events in PFTC_DIS for your workflow?

regards

Rick

former_member183134
Participant
0 Kudos

Hi Rick,

My Workflow itself not triggering . please go through my post.. I have explained step by step clearly what i did in the system. and also added the screenshot of the error.

former_member185167
Active Contributor
0 Kudos

Hello,

There could be a difference between what you say you did and what you actually did.

If you don't want to post a screenshot, then good luck with that.

regards

Rick

tomas_talpa
Active Contributor
0 Kudos

Hello Anand,

CLBUS1007 is some obsolete placeholder object, the BOR BUS1007 has been replaced with KNA1 long time ago (see note  719936 - Linked documents can no longer be found after upgrade); found more details in thread , basically you should get rid of CLBUS1007 in SWEL (replace is KNA1). If you will still have issue, posting the details of SWEL would be helpful.

Kind Regards

TomT

former_member183134
Participant
0 Kudos

Hi Tomas,

Please see my steps in the above post and tell me where it went wrong..

I have used KNA1 only

tomas_talpa
Active Contributor
0 Kudos

Wait a moment, Anand -- didn't you said that you have created record DEBI-CLBUS1007-Zevent in SWEC ("it is saving if step3 maintained as below Entry[...]step3: DEBI-CLBUS1007-Zevent")? Can you show your SWEC settings & SWEL record (where you see the even but workflow in not triggered)?

BTW, you can also check the manual event creation via tx SWUE "Trigger an event"; that will show whether the issue is with WF or with even creation from change document.

former_member183134
Participant
0 Kudos

Hi Tomas,

I have executed using SWUE. workflow is triggering. but when I created customer using XD01 while saving.. it is throwing error. below is the screen shot.

SWUE screeshot which is working right now.

SWEC settings screenshot

former_member185167
Active Contributor
0 Kudos

Look for the workflow log in SWI1 and find out there what went wrong.

former_member183134
Participant
0 Kudos

Hi Rick,

My workflow is triggering and working fine when called using SWUE Tcode... but issue is while creating customer data in XD01. while saving customer data getting an update terminated error as below.

Sm13 screenshot description against this error.

tomas_talpa
Active Contributor
0 Kudos

Hm, what will happen if you will maintain your z-BOR in SWEC instead of standard one? Also, are there any dumps in ST22? Additionally, you can check the update task (before saving, start debugger via "/H", set "Update debugging" under menu "Settings -> Display Change Debugger settings".

anjan_paul
Active Contributor
0 Kudos

Hi,

  Also please check and share also  that entries are created in CDPOS and CDHDR  ..

former_member185167
Active Contributor
0 Kudos

Hello,

You said:

"When I created the Custer data in XD01 it is throwing Error. (if step3 maitained as above) No Entry I can find in SWEL."


Step 3 is SWEC.  With SWEC there should be an event so are you sure it's not in SWEL? You don't have a filter on or is SWEL maybe turned off? Check SWELS.


If there really is no event then there's also no workflow, so the error can't be workflow related.


regards

Rick

PS As you probably know, ZBORs should never be referred  anywhere except in delegation. Always refer to the BOR.

Former Member
0 Kudos

did you define or please check number ranges .

we had same error when we were posting Invoices through workflw