Skip to Content
0

Cancel TSCO Status of Tasks in Notification

Apr 18, 2017 at 07:15 AM

766

avatar image

Hi,

Is there a possibility to cancel the TSCO status of Task to Release again for changes as can be required sometimes.

Or is it possible that for specific Notification Type this status is not required fro Completion of Notification as at present if any Task is outstanding then Notification cannot be completed.

Thanks

Faisal

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

5 Answers

Best Answer
K Jogeswara Rao Apr 18, 2017 at 10:41 AM
2

Faisal khan,

Here is the full code. This first sets task status TSCO to TSRL, simultaneously it sets Notification ATCO status to OSTS. (Test well and get it fine tuned further by ABAPer if required so.)

REPORT zkjr_test.
PARAMETERS: qmnum TYPE qmnum OBLIGATORY,
            posno TYPE char4 OBLIGATORY.

DATA: it_stat TYPE TABLE OF jstat,
      wa_stat TYPE jstat,
      objnr   TYPE char22,
      strl    TYPE i,
      v_stat  TYPE j_stext,
      v_objnr TYPE j_objnr.

CONCATENATE 'QA' qmnum posno INTO objnr.
CALL FUNCTION 'STATUS_TEXT_EDIT'
  EXPORTING
    objnr       = objnr
    only_active = 'X'
    spras       = sy-langu
  IMPORTING
    line        = v_stat.

IF v_stat = 'TSCO'.
  IF strlen( posno ) < '4'.
    MESSAGE: 'Check Task number.' TYPE 'I'.
    LEAVE LIST-PROCESSING.
  ENDIF.

  wa_stat-stat =  'I0156'.
  wa_stat-inact = 'X'.
  APPEND wa_stat TO it_stat.
  wa_stat-stat =  'I0155'.
  wa_stat-inact = ' '.
  APPEND wa_stat TO it_stat.

  CONCATENATE 'QA' qmnum posno INTO objnr.

  CALL FUNCTION 'STATUS_CHANGE_INTERN'
    EXPORTING
      objnr  = objnr
    TABLES
      status = it_stat.

  COMMIT WORK.

  CLEAR v_stat.
  REFRESH it_stat.

  CONCATENATE 'QM' qmnum INTO v_objnr.

  CALL FUNCTION 'STATUS_TEXT_EDIT'
    EXPORTING
      objnr       = v_objnr
      only_active = 'X'
      spras       = sy-langu
    IMPORTING
      line        = v_stat.

  IF v_stat+0(4) = 'ATCO'  OR v_stat+5(4) = 'ATCO'.
    wa_stat-stat =  'I0159'.
    wa_stat-inact = 'X'.
    APPEND wa_stat TO it_stat.
    wa_stat-stat =  'I0158'.
    wa_stat-inact = ' '.
    APPEND wa_stat TO it_stat.

    CALL FUNCTION 'STATUS_CHANGE_INTERN'
      EXPORTING
        objnr  = v_objnr
      TABLES
        status = it_stat.

  COMMIT WORK.
  ENDIF.

MESSAGE: 'Task/Notification status set successfully.' TYPE 'I'.
ELSE.
  MESSAGE: 'Please check, the Task is not in TSCO status.' TYPE 'I'.
  LEAVE LIST-PROCESSING.
ENDIF.
Share
10 |10000 characters needed characters left characters exceeded
Maria Terence Apr 18, 2017 at 07:35 AM
0

Hi Faisal,

I dont think its possible to revoke the status. Try to delete and re-create it.

Regards

Terence

Share
10 |10000 characters needed characters left characters exceeded
Faisal Khan Apr 18, 2017 at 08:11 AM
0

Hi Terence,

Will wait and see if others have the same opinion, cause deleting it will mean more data entries.

Regards

Faisal

Share
10 |10000 characters needed characters left characters exceeded
K Jogeswara Rao Apr 18, 2017 at 09:21 AM
0

Solution to your query could lie in a simple program using function module 'STATUS_CHANGE_INTERN' . See the code below .

REPORT zkjr_test.
PARAMETERS: qmnum TYPE qmnum OBLIGATORY,
            posno TYPE char4 OBLIGATORY.

DATA: it_stat TYPE TABLE OF jstat,
      wa_stat TYPE jstat,
      objnr   TYPE char22,
      strl    TYPE i.

IF strlen( posno ) < '4'.
  MESSAGE: 'Check Task number.' TYPE 'I'.
  LEAVE LIST-PROCESSING.
ENDIF.

wa_stat-stat =  'I0156'.
wa_stat-inact = 'X'.
APPEND wa_stat TO it_stat.

wa_stat-stat =  'I0155'.
wa_stat-inact = ' '.
APPEND wa_stat TO it_stat.

CONCATENATE 'QA' qmnum posno INTO objnr.

CALL FUNCTION 'STATUS_CHANGE_INTERN'
  EXPORTING
    objnr  = objnr
  TABLES
    status = it_stat.

COMMIT WORK.

If you execute this program you will see selection screen like below.

When you give Notification number, Task number (4char number in the 1st column of Tasks tab, like 0001), and then execute, the TSCO status of the Task will be converted into TSRL. I checked it.

Sounds like the job is done. But....

the Notification Status is dependent on the Task status. With the above code, the Notification status does not change (Only Task status changes).

You are aware, in case of all Tasks are in TSCO status, Notification will be having ATCO, if anyone of the Tasks is in incomplete status, then it will be in OSTS status. So the code needs to be developed to address this also. For this same function module used above can be used (to change Notification status as per logic).

Bottom line is, ABAPer can give you solution by adding few more lines of code as explained. He will need to look into TJ02T table to know the codes for statuses ATCO, OSTS.

Good luck


capture.jpg (11.3 kB)
Share
10 |10000 characters needed characters left characters exceeded
K Jogeswara Rao Apr 19, 2017 at 04:06 AM
0

Faisal khan,

Code above has been updated to display message below upon successful execution.


success.jpg (18.0 kB)
Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hi Jogeswara,

Really appreciate your concern with the code. This is what was exactly required. Will test it and get back to this post with my feedback.

Thanks again.

Faisal

1