SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Viewing particular users Inbox



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> SAP Business Workflow
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1636

PostPosted: Mon Sep 10, 2007 7:49 pm    Post subject: Viewing particular users Inbox Reply with quote

Code:
REPORT z_view_workflow_inbox.

DATA  itab_list LIKE swkwlhead OCCURS 0 WITH HEADER LINE.
DATA: field_name(30),                "Check for line selection on field
      t_wi_id like SWWWIHEAD-WI_ID,
      t_uname like sy-uname.

* 'Select User ID and execute to view inbox'
SELECTION-SCREEN COMMENT 5(50) text-001 MODIF ID sc1.

* 'User ID Selection'
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-002.
PARAMETERS:
  p_uname LIKE USR02-BNAME DEFAULT sy-uname OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b1.

* Sort Criteria
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-003.
PARAMETERS:
  p_sort1 RADIOBUTTON GROUP sor1,
  p_sort2 RADIOBUTTON GROUP sor1,
  p_sort3 RADIOBUTTON GROUP sor1,
  p_sort4 RADIOBUTTON GROUP sor1,
  p_sort5 RADIOBUTTON GROUP sor1,
  p_sort6 RADIOBUTTON GROUP sor1.
SELECTION-SCREEN END OF BLOCK b2.

*----------------------------------------------------------------------*
* Initialization
*----------------------------------------------------------------------*
INITIALIZATION.
  PERFORM update_sel_screen_attributes.

TOP-OF-PAGE.
  FORMAT COLOR COL_HEADING.
  WRITE 'Woritem ID'.
  WRITE AT 15 'Description'.
  WRITE AT 135 'Date'.
  WRITE AT 146 'Time'.
  WRITE AT 155 'Parent ID'.
  WRITE AT 168 'Task'.
  WRITE AT 183 'Status'.
  FORMAT COLOR OFF.

*----------------------------------------------------------------------*
* Start of Selection
*----------------------------------------------------------------------*
START-OF-SELECTION.
  REFRESH itab_list.

  t_uname = p_uname.
  CALL FUNCTION 'SWK_LOCAL_INBOX_GET'
       EXPORTING
            user_id    = t_uname
            user_langu = 'E'
       TABLES
            wi_list    = itab_list.

  READ TABLE itab_list INDEX 1.
  IF sy-subrc = 0.
    IF p_sort1 = 'X'.
      SORT itab_list BY wi_id.
    ELSEIF p_sort2 = 'X'.
      SORT itab_list BY wi_text.
    ELSEIF p_sort3 = 'X'.
      SORT itab_list BY wi_cd wi_ct.
    ELSEIF p_sort4 = 'X'.
      SORT itab_list BY wi_chckwi.
    ELSEIF p_sort5 = 'X'.
      SORT itab_list BY wi_rh_task.
    ELSEIF p_sort6 = 'X'.
      SORT itab_list BY wi_stat.
    ENDIF.
  ENDIF.

  LOOP AT itab_list.
    WRITE: / itab_list-wi_id,
             itab_list-wi_text,
             itab_list-wi_cd,
             itab_list-wi_ct,
             itab_list-wi_chckwi,
             itab_list-wi_rh_task,
             itab_list-wi_stat.
    HIDE itab_list-wi_id.
    HIDE itab_list-wi_rh_task.
  ENDLOOP.
  IF sy-subrc <> 0.
    MESSAGE i999(b1) WITH 'No Workflow items found in the inbox of '
                          p_uname.
  ELSE.
    WRITE: / '***', sy-tfill, 'entries ***'.
  ENDIF.

END-OF-SELECTION.

AT LINE-SELECTION.
* Return the field that the user clicked on
  GET CURSOR FIELD field_name.
  CASE field_name.
    WHEN 'ITAB_LIST-WI_ID'.
      IF itab_list-wi_id IS INITIAL.
        MESSAGE i999(b1)
          WITH 'Please double click a line on the report!'.
      ELSE.
        t_wi_id = itab_list-wi_id.
        CALL FUNCTION 'SWL_WI_DISPLAY'
             EXPORTING
                  wi_id            = t_wi_id
                  extended_display ='X'
             EXCEPTIONS
                  read_failed = 1
                  OTHERS      = 2.
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
      ENDIF.
    WHEN 'ITAB_LIST-WI_RH_TASK'.
      IF itab_list-wi_rh_task IS INITIAL.
        MESSAGE i999(b1)
         WITH 'Please double click a line on the report!'.
      ELSE.
        CALL FUNCTION 'SWL_WI_DISPLAY_TASK'
             EXPORTING
                  wi_id = itab_list-wi_id.
        CLEAR itab_list-wi_rh_task.
      ENDIF.
    WHEN OTHERS.
      MESSAGE i999(b1) WITH 'Field not selectable!'.
  ENDCASE.
  CLEAR: itab_list-wi_id, itab_list-wi_rh_task.

*&---------------------------------------------------------------------*
*&      Form  update_sel_screen_attributes
*&---------------------------------------------------------------------*
FORM update_sel_screen_attributes.
  LOOP AT SCREEN.
    IF screen-group1 = 'SC1'.
      screen-intensified = '1'.
      MODIFY SCREEN.
    ENDIF.
  ENDLOOP.
ENDFORM.                    " update_sel_screen_attributes
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> SAP Business Workflow All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.