05-10-2016 4:40 AM
Hi All,
when particular Task is open in the notification in IW51/52.,how to update the user status in IW31/32 on Service Order . Please Suggest.
Thanks in Advance
Best Regards
Srilikhitha
05-15-2016 4:14 PM
srilikhitha
Use this code in include ZXQQMU20 ( F/Exit EXIT_SAPMIWO0_020 of user-exit QQMA0014 )
IF sy-tcode = 'IW52'.
DATA:i_stat LIKE jstat OCCURS 0 WITH HEADER LINE,
l_objnr TYPE j_objnr.
SELECT SINGLE objnr FROM aufk INTO l_objnr WHERE aufnr = i_viqmel-aufnr.
CALL FUNCTION 'STATUS_READ'
EXPORTING
objnr = i_viqmel-objnr
only_active = 'X'
TABLES
status = i_stat.
LOOP AT i_stat.
IF i_stat-stat = 'I0158'.
CALL FUNCTION 'STATUS_CHANGE_EXTERN'
EXPORTING
objnr = l_objnr
user_status = 'E0004'
set_inact = ' '.
ENDIF.
ENDLOOP.
ENDIF.
NOTE
BTW,The right Subject line for your query should be
"Order user-status update during IW52 Save"
Good luck
KJogeswaraRao
05-10-2016 4:45 AM
User Exit to Change User Status - IW32TCode | SCN
Hello
There are multiple threads available in the forum wherein solutions / user exits details are provided.
One such useful thread link is pasted above.
Kindly refer it & henceforth please do exhaustive search in forum before posting any queries.
Cheers!!!
Shubham
05-10-2016 4:51 AM
05-15-2016 1:02 PM
Hi Jogeswara Rao,
Thank you so much for the information. But it did not resolve the problem. Based on the particular task open in the IW52 (Notification),I need to update the user status (caufvd structure - asttx field).
Please suggest where to write the code and the FM or Bapi's to update the user status( caufvd structure - asttx field).
Thanks In Advance
Srilikhitha
05-15-2016 1:58 PM
srilikhitha,
See the following code/s which I tested successfully using fms STATUS_READ and STATUS_CHANGE_EXTERN in include ZXWOCU07 (F/exit EXIT_SAPLCOIH_009 of user-exit IWO10009)..
Now the code for changing the User-status to OSTS while saving the Order will be:
CALL FUNCTION 'STATUS_CHANGE_EXTERN'
EXPORTING
objnr = caufvd_imp-objnr
user_status = 'E0004'
set_inact = ' '.
After this whenever you Save the Order you'd find that the user status is changed to OSTS. At the same time you'd find the asttx value has also changed to OSTS.
Now the thing remains is:
This is the full and final code to be used in the same place (include ZXWOCU07 of function EXIT_SAPLCOIH_009) explained above.
DATA:i_stat LIKE jstat OCCURS 0 WITH HEADER LINE,
l_objnr TYPE j_objnr.
SELECT SINGLE objnr FROM viqmel INTO l_objnr WHERE qmnum = caufvd_imp-qmnum.
CALL FUNCTION 'STATUS_READ'
EXPORTING
objnr = l_objnr
only_active = 'X'
TABLES
status = i_stat.
LOOP AT i_stat.
IF i_stat-stat = 'I0158'.
CALL FUNCTION 'STATUS_CHANGE_EXTERN'
EXPORTING
objnr = caufvd_imp-objnr
user_status = 'E0004'
set_inact = ' '.
ENDIF.
ENDLOOP.
Hope you'll be able to understand and make use of this solution worked-out for you. Please revert in case of any doubts.
Note:
Regards
KJogeswaraRao
05-15-2016 4:03 PM
Hi Jogeswara Rao,
Thanks for the information again. I want to write code in IW52 related enhancements only.if notification gets saved in the iw52 ,the user status(caufvd-asttx) need to get updated in iw32.
Kindly please suggest and do the needful.
Thanks again in advance.
Srilikhitha.
05-10-2016 7:03 AM
Hi,
Please find the relevant BADI/User exit and use the FM : STATUS_CHANGE_EXTERN to change the user status.
Regards,
Naveen Kumar.
05-15-2016 4:14 PM
srilikhitha
Use this code in include ZXQQMU20 ( F/Exit EXIT_SAPMIWO0_020 of user-exit QQMA0014 )
IF sy-tcode = 'IW52'.
DATA:i_stat LIKE jstat OCCURS 0 WITH HEADER LINE,
l_objnr TYPE j_objnr.
SELECT SINGLE objnr FROM aufk INTO l_objnr WHERE aufnr = i_viqmel-aufnr.
CALL FUNCTION 'STATUS_READ'
EXPORTING
objnr = i_viqmel-objnr
only_active = 'X'
TABLES
status = i_stat.
LOOP AT i_stat.
IF i_stat-stat = 'I0158'.
CALL FUNCTION 'STATUS_CHANGE_EXTERN'
EXPORTING
objnr = l_objnr
user_status = 'E0004'
set_inact = ' '.
ENDIF.
ENDLOOP.
ENDIF.
NOTE
BTW,The right Subject line for your query should be
"Order user-status update during IW52 Save"
Good luck
KJogeswaraRao