2010 Dec 14 6:57 AM
Dear,
I want to execute the the sales order change Bapi z program on save of sales order. for this i created the event and i am triggering by sheduling the job in save exit of sales order, but on execution of the va01/va02 system creating the background jobs continously instead of single job i mean system creating around 4 to 5 same jobs in every seconds.Kindly check below my code and help me.
DATA ls_zsd00_cpop_save TYPE zsd00_cpop_save .
ls_ZSD00_CPOP_SAVE-vbeln = vbak-vbeln .
*********************************************
DATA: number TYPE tbtcjob-jobcount,
name TYPE tbtcjob-jobname VALUE 'ZCPOP_JOB1',
print_parameters TYPE pri_params.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = name
IMPORTING
jobcount = number
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4.
IF sy-subrc = 0.
SUBMIT ZSD00_CPOP_SO_CHANGE_ON_SAVE
VIA JOB name NUMBER number
AND RETURN.
IF sy-subrc = 0.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = number
jobname = name
EVENT_ID = 'ZCPOP_EVENT'
EXCEPTIONS
cant_start_immediate = 1
invalid_startdate = 2
jobname_missing = 3
job_close_failed = 4
job_nosteps = 5
job_notex = 6
lock_failed = 7
OTHERS = 8.
IF sy-subrc <> 0.
ENDIF.
ENDIF.
ENDIF.
regards,
manoj
2010 Dec 14 7:13 AM
First of all, Why you want to call Sales order Change BAPI soon after creating it ? Are you changing the same Order ?
2010 Dec 14 9:54 AM
Dear,
I want to change the item category of all the sales order line items based on some bussiness logic which will be decided
by the user on custom popup_to_cofirm window . if user selects YES, than i need to change the item category of all the sale order line items to the item cateory YNAA. To achieve this functionallity there is no exit on save to change the item category,l even if change the item category in prepare_to_save exit or to_vbep system not updating corresponding shedule line values correctly. So, i want to tigger the back job on save to chagne the sales order item category when user wants. so, i want to schedule the job based on the event.Kindly suggest.
Regards,
Manoj
2010 Dec 14 4:20 PM
To achieve this functionallity there is no exit on save to change the item category,l even if change the item category in prepare_to_save exit or to_vbep system not updating corresponding shedule line values correctly
I hope you have checked the exits available in include MV45AFZZ . Are you passing the update flag (XVBAP-UPDKZ) correctly while updating the line item internal table (XVBAP)?
2010 Dec 15 4:58 AM
Dear Tushar Shukla ,
Thanks for reply, yes i am updating updkz properly, if user changes/add the line item than control going to to_vbep and it is working fine. My case is that, in VAO2 if user adds new line items without changing existing line items control doesnlt go to to_vbap for existing line items. i want to change the item caterogies of existing line items also on save for which control not going to to_Vbep to change item category.
Thanking you,
Regards,
Manoj
Edited by: manoj kv on Dec 16, 2010 3:13 AM
2010 Dec 14 7:27 AM
Hi...
Why u r scheduling job in background..??
You have created event, so create one function module which call BAPI to change SO and link it with that event through transaction code SWE2.
Hope it will help you.
Thanks & Regards,
Poonam.
2010 Dec 14 10:04 AM
Dear Poonam,
i am new to this events concept, can u pls tell me what the object type, object caterogry,event,recevier type, type linkage,enable event queue.
thanks in advance.
regards,
Manoj
2010 Dec 14 12:31 PM
Hi,
Object Category - BOR Object Type (always BOR Object Type only)
Object Type - Ur event's bussiness object type (i.e. for eg. for PO bussiness object type - BUS2012)
Event - It's event name which present in that bussiness object type (For e.g. Create/Change/Delete)
Receiver Type - Give anything (for e.g. - ur SO_CHANGE)
then in Linkage Setting(Event Receiver),
Receiver Call - Function module
Receiver Function Module - Ur FM name (for e.g. - ZSO_CHANGE)
Then directely tick the Linkage activated check box and other settings keep like that only.
Note :- Ur function module should be Remote Unabled.
Hope it will help you.
Thanks & Regards,
Poonam.