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.
cancel
Showing results for 
Search instead for 
Did you mean: 

IW32 user status update

former_member294530
Participant
0 Kudos

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

1 ACCEPTED SOLUTION

jogeswararao_kavala
Active Contributor
0 Kudos

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

  • All required inputs to be taken from the previous reply.
  • Hope this is your expected solution.
  • Please note that this thread went so long because you have not been clear since the initial query.
  • Let not things be repeated which have been already explained in detail in the previous reply.
  • Also expect quick feedback from you. It is seen that you respond very late to received replies.


BTW,The right Subject line for your query should be

"Order user-status update during IW52 Save"



Good luck

KJogeswaraRao

7 REPLIES 7

Shubham1
Employee
Employee
0 Kudos

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

jogeswararao_kavala
Active Contributor
0 Kudos
  • When particular Task is open in Notification (perhaps you meant if any one task is open in Notification), this means system status of the Notification OSTS or if you meant individual task status then it is TSOS.
  • You can read this status through fm STATUS_READ (input objnr)
  • Now about how to update the user status. Use fm STATUS_CHANGE_EXTERN.
  • You need code the above in exit IWO10009 to achieve the above for the linked Notification.
  • In the exit CAUFVD structure has the Notification field QMNUM using which you'd code the above.
  • After this when the Order is saved the user status is updated.

0 Kudos

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

0 Kudos

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)..

  • Suppose your user-status has present status ABCD and you want to convert to another user-status say OSTS.
  • Suppose your status profile is PM_ORD
  • Now you need to know the the ESTAT value of the OSTS status to use in the above fm.
  • This you'll get from table TJ30T by inputting  'PM_ORD'  in STSMA field  and 'OSTS' in the TXT04 field.
  • Suppose you got the ESTAT value as 'E0004'.

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:

  • The above code should be applicable only when the linked Notification System status reads OSTS (means Outstanding Task).
  • Now I need the ISTAT value of System status OSTS  (to be used in the fm STATUS_READ)  which I got from table TJ02T which is I0158 (This value is same for you and me).

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:

  • Hope I need not specially alert you that your have to replace value E0004 with your corresponding value which you'll get from table TJ30T suing your own STSMA value in place of PM_ORD explained in this post.
  • Also the asttx value will be updated in the structure CAUFVD as mentioned above.

Regards

KJogeswaraRao

0 Kudos

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.

Former Member
0 Kudos

Hi,

Please find the relevant BADI/User exit and use the FM : STATUS_CHANGE_EXTERN to change the user status.

Regards,

Naveen Kumar.

jogeswararao_kavala
Active Contributor
0 Kudos

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

  • All required inputs to be taken from the previous reply.
  • Hope this is your expected solution.
  • Please note that this thread went so long because you have not been clear since the initial query.
  • Let not things be repeated which have been already explained in detail in the previous reply.
  • Also expect quick feedback from you. It is seen that you respond very late to received replies.


BTW,The right Subject line for your query should be

"Order user-status update during IW52 Save"



Good luck

KJogeswaraRao