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

Need to execute some code once order created

Former Member
0 Likes
1,016

Hi,

I have requirment like once the order in IW31(BO: BUS2007 ) is created i need to execute some custom code. please let me know the steps to do that.

This process should complete without user interaction.

Thanks,

Sudheer. A

5 REPLIES 5
Read only

Former Member
0 Likes
753

Hi Sudheer,

You will have to identify the user exit/BADI which is hit after SAVE event of IW31.

Build the necessary logic in the user exit/BADI & check.

Best regards,

Prashant

Read only

0 Likes
753

Hi:

You can trigger a workflow after the creation of order & run a code through a Function Module, Report, Transaction etc.

Hope, it may be helpful.

Thanks,

Murali.

Read only

Former Member
0 Likes
753

Hi Sudheer,

maybe you can have a look at user exit EXIT_SAPLCOIH_009.

This is the exit where you can do some latest checks before saving the document in IW31.

You can also write your own function module (e.g. Z_DO_THIS_AFTER_IW31) with the code to be executed and trigger this later. So that the code is not executed in the user exit, but a bit later after the real IW31 document is saved.

Do that by using CALL FUNCTION 'Z_DO_THIS_AFTER_IW31' IN UPDATE TASK.

Here is the F1 help text on the 'IN UPDATE TAST' addition.

Please let me know if this solved the problem..

Grtz Marcel.


CALL FUNCTION - IN UPDATE TASK 


Syntax 
CALL FUNCTION update_function IN UPDATE TASK 
                             [EXPORTING p1 = a1 p2 = a2 ...] 
                             [TABLES t1 = itab1 t2 = itab2 ...]. 



Extras: 
1. ... EXPORTING p1 = a1 p2 = a2 ... 

2. ... TABLES t1 = itab1 t2 = itab2 ... 



Effect 
This statement registers the update function module specified in update_function. update_function must be a character-type field, which during execution of the statement contains the name of an update function module in uppercase letters. 

An update function module is a function module, for which in the Function Builder the property update module is marked. The registration of an update function module is an essential part of the update task. 

The function module is not executed immediately, but is scheduled for execution in a special work process (update work process). For this purpose, the name of the function module including the passed actual parameters is stored as a log record in the database table VBLOG. If the statement is executed during the update task, the addition IN UPDATE TASK is ignored. 

If the statement 

SET UPDATE TASK LOCAL is executed before registration of an update function module in the current SAP LUW, registration takes place in the ABAP memory rather than on the database, and for the current work process. 
The actual execution is triggered by the statement COMMIT WORK. The formal parameters of the function module receive the values of the actual parameters from table VBLOG. A function module that is registered several times will also be excuted several times with the respective parameter values. 

If a COMMIT WORK statement is not executed after registration of a function module during execution of the current program, the function module is not executed and is deleted from table VBLOG at the end of the program. 

Read only

0 Likes
753

Hi All,

Thanks for your replies. The requirement is I have to update component long text when order was save. I have written code in the method BEFORE_UPDATE of the BADI WORKORDER_UPDATE. using SAVE_TEXT i am creating long text. but the thing is Long text can only appear if the field LTXSP of RESB updated as 'EN' . I do not find any exit or BADI to update RESB entry.

Beacuse of this reason I want to do this updation after saving the order.

Please suggest me according to this requirment.

Thanks,

Sudheer. A

Read only

Former Member
0 Likes
753

Exactly SAP Business Workflow!!

Assuming you are aware of the details about Workflow,

1) Create a workflow.

2) Identify which event (of BUS2007) is triggered upon creation. 3) Make that event as the start event of the workflow (specify this in the Workflow header).

4) Create a workitem, having a task that calls the function module/transaction containing YOUR CODE. You may have to create a task in transaction PFTC.

5) Make the workitem a background job, thereby taking away the need for user interaction.

I think this should do the trick.

Also check for the workflow configuration done in your system to ensure proper working of the workflow.