Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
Showing results for 
Search instead for 
Did you mean: 

Block and unblock customer via workflow

Former Member
0 Kudos

Hi Experts,

I want to know using workflow, how can I block a customer the moment it is created or changed via transaction XD01 and XD02. I am in version 4.5B SAP.

I created an object ZKNA1 and delegated it to KNA1. There I wrote 2 methods block/unblock, where I wrote update commands on KNA1 on fields AUFSD, SPERR and CASSD. Now XD01 and XD02 does not have any system triggered events, so I created an event ONSAVE in ZKNA1 and triggered it in the exit EXIT_SAPMF02D_001 using FM SWE_EVENT_CREATE. This is triggering my workflow, but the following problems occur.

In XD01 transaction, the customer number KNA1-KUNNR is not yet created at the user exit EXIT_SAPMF02D_001 (before save), hence kunnr field is blank. There is only one user exit in XD01/02. Hence my workflow does not get the customer number in CREATE (XD01) mode.

In XD02 transaction, the customer number is passed, but the update command does not work in the background, if I set the Activity in workflow as background. I have to keep the work item as background, because I cannot ask the user to execute the workitem in foreground and hence force the user to block customer by executing the workitem and hence effect the blocking.

Please enlighten me in this case. If the post was not very explanatory, then please ask me what more feedback is required.

Answers will be rewarded.



Former Member

Former Member

0 Kudos

When the user runs XD01, in the user exit the customer number is absent because the number is not yet generated in the system, what do I pass in the workflow then at that time.

0 Kudos

Hi Mrutyunjaya

I solved this in a different way, created Z-transactions, passed the functionality of XD01 and XD02 to ZXD01 and ZXD02. Then changed XD01 and XD02 and called my program, which will call ZXD01 and ZXD02 (which behaves just like XD01 and XD02), allowed cust change/create, then blocked it via XD05, then called workflow to send the approval request to approver, its working fine now. XD05 changes the 3 fields in KNA1 table that I mentioned before.

Thanks for the document though.

Regards Anirban