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

create tasks automatically when save notification

Former Member
0 Likes
1,750

Hi,

I am trying to create tasks automatically when saving a

new notification (IW21).

Mayby someone here has any idea??

I tried through user exit QQMA0014 to insert new rows

to the tasks table - but I didn't succeeded.

Thanks you all.

Promise to award points.

Ruthie.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,091

Dear PRAKASH,

I tried using EXIT_SAPLIQS0_008 - INCLUDE ZXQQMU27 - but when I save the new created notification I get an error message in the return table of the first Bapi - 'BAPI_SERVNOT_ADD_DATA'-

"Notification 000010001850 does not exist"

Thanks for your help.

Ruthie.

6 REPLIES 6
Read only

Former Member
0 Likes
1,091

Once I add the same requirement but to add a activity to the notification during creation or changing.

I think u can use the <b>EXIT_SAPLIQS0_008</b>

INCLUDE ZXQQMU27 .

Whenever u r entering the notification or leaving the notification after saving it will come to this exit. So the code should be proceed only when it comes for SAVE.

Here if u check the below code i might used GET PARAMETER ID 'ZQS' FIELD ws_notif_save1 which i will pass 'X' in the save exit. Also u can't use import/emport because all the memory values are getting cleared after the notification is created.

GET PARAMETER ID 'ZQN' FIELD ws_qnum. Also u have to SET the notificaiton number to some variable and get it.

IF i_viqmel-qmart = 'ZA'.

IF sy-tcode = c_iw51 or c_iw52.

PERFORM notification_activity_save.

ENDIF.

ENDIF.

&----


*& Form notification_activity_save

&----


  • Notification Activity Save.

----


FORM notification_activity_save .

DATA: notif_activity TYPE bapi2080_notactvi OCCURS 0 WITH HEADER LINE,

notif_activity_x TYPE bapi2080_notactvi_x

OCCURS 0 WITH HEADER LINE,

return TYPE bapiret2 OCCURS 0 WITH HEADER LINE,

return1 TYPE bapiret2 OCCURS 0 WITH HEADER LINE,

return2 TYPE bapiret2 OCCURS 0 WITH HEADER LINE,

return3 TYPE bapiret2 OCCURS 0 WITH HEADER LINE,

syststat TYPE bapi2080_notsti OCCURS 0 WITH HEADER LINE,

ws_notif_save1 TYPE c,

ws_qnum TYPE qmel-qmnum.

GET PARAMETER ID 'ZQS' FIELD ws_notif_save1.

IF ws_notif_save1 EQ c_x.

GET PARAMETER ID 'ZQN' FIELD ws_qnum.

WAIT UP TO 5 SECONDS.

notif_activity-refobjectkey = ws_qnum.

IF sy-tcode EQ c_iw51.

notif_activity-act_key = '0001'.

notif_activity-act_sort_no = '0001'.

notif_activity-act_codegrp = 'Z001'.

notif_activity-act_code = 'REQ'.

ELSEIF sy-tcode EQ c_iw52.

notif_activity-act_key = '0002'.

notif_activity-act_sort_no = '0002'.

notif_activity-act_codegrp = 'Z001'.

notif_activity-act_code = 'CREQ'.

ENDIF.

notif_activity-start_date = sy-datum.

notif_activity-start_time = sy-uzeit.

notif_activity-end_date = sy-datum.

notif_activity-end_time = sy-uzeit.

APPEND notif_activity.

CALL FUNCTION 'BAPI_SERVNOT_ADD_DATA'

EXPORTING

number = ws_qnum

TABLES

notifactv = notif_activity

return = return.

CALL FUNCTION 'BAPI_SERVNOT_SAVE'

EXPORTING

number = ws_qnum

TABLES

return = return1.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = '5'

IMPORTING

return = return2.

syststat-langu = sy-langu.

syststat-languiso = sy-langu.

syststat-refdate = sy-datum.

syststat-reftime = sy-uzeit.

APPEND syststat.

CALL FUNCTION 'BAPI_SERVNOT_CLOSE'

EXPORTING

number = ws_qnum

syststat = syststat

TABLES

return = return3.

CLEAR: ws_qnum, ws_notif_save1.

SET PARAMETER ID 'ZQN' FIELD ws_qnum.

SET PARAMETER ID 'ZQS' FIELD ws_notif_save1.

IF sy-tcode EQ c_iw51.

LEAVE TO TRANSACTION c_iw51.

ELSEIF sy-tcode EQ c_iw52.

LEAVE TO TRANSACTION c_iw52.

ENDIF.

ENDIF.

ENDFORM. " notification_activity_save

Hope it is helpful.

Regards,

Prakash.

Read only

Former Member
0 Likes
1,091

Hi,

Right now I unable to access SAP. Please check in the menu bar if there exist SAVE+Determine Task button, if it is there click on that and it will save the notification and will create all necessary task.

I hv done this one in IW51 but not for IW21.

Pl ck and let me know if it there.

If it help pl reward.

Cheers

Read only

Former Member
0 Likes
1,092

Dear PRAKASH,

I tried using EXIT_SAPLIQS0_008 - INCLUDE ZXQQMU27 - but when I save the new created notification I get an error message in the return table of the first Bapi - 'BAPI_SERVNOT_ADD_DATA'-

"Notification 000010001850 does not exist"

Thanks for your help.

Ruthie.

Read only

0 Likes
1,091

Use the wait statement.

WAIT UP TO 5 SECONDS.

So that after the notification is created it will be updated in the table. Or follow the below logic

DO.

WAIT UP TO 1 SECONDS.

n = n + 2.

SELECT SINGLE QMNUM INTO lws_qmnum FROM qmel

WHERE qmnum = <Cretaed notification number>.

IF sy-subrc = 0.

EXIT.

ENDIF.

IF n = 600.

EXIT.

ENDIF.

ENDDO.

So it will be inside the DO ENDDO upto it find that qnum in the DB. When the n = 600 it will come out of the enddo.

Regards,

Prakash.

Read only

Former Member
0 Likes
1,091

Dear Sunanda,

I didn't follow your answer.

I try to achieve that every time a new notification is created, tasks are going to be created automatically

according to the event selected.

I try to achieve it through enhancements.

I didn't find the button SAVE+Determine Task.

Thanks for your help.

Ruthie.

Read only

Former Member
0 Likes
1,091

Thanks so much Prakash.

Problem is solved.

Ruthie.