Registration

Dear SAP Community Member,
In order to fully benefit from what the SAP Community has to offer, please register at:
http://scn.sap.com
Thank you,
The SAP Community team.
Skip to end of metadata
Go to start of metadata

*Below is the code snippet for creating a worklist of all the action items and information items usr02

* it also populates the summary in empdata which is of type zuser_uwl which has two elements user_id type syuname and zcount type zcount(int1)

* It uses standard RFC 'SWN_UWL_GET_WORKLIST' to create the worklist

FUNCTION ZEXAMPLE_WORKLIST_VIS.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     REFERENCE(IT_USERS) TYPE  ZUSER_TT which is a table type of line type ZUSER_STY which has only one element bname type xubname
*"  EXPORTING
*"     VALUE(WORKLIST) TYPE  UWLITEMLIST
*"  TABLES
*"      MESSAGE_LINES STRUCTURE  SWR_MESSAG OPTIONAL
*"      MESSAGE_STRUCT STRUCTURE  SWR_MSTRUC OPTIONAL
*"      EMPDATA STRUCTURE  ZUSER_UWL OPTIONAL
*"----------------------------------------------------------------------

  tables zuser_uwl.

  DATA: lt_user TYPE zuser_tt,
        ls_user TYPE zuser_sty.

  DATA: lt_worklist TYPE uwlitemlist,
        lt_messages TYPE TABLE OF swr_messag,
        lt_mess_struct TYPE TABLE OF swr_mstruc.

  DATA: l_finished TYPE i.

  DATA: COUNT TYPE i.

  DATA: n TYPE i.

  DATA: WA_ZUSER_UWL TYPE ZUSER_UWL.

  DATA: WA_WORKLIST TYPE UWLITEM.

  COUNT = 0.

  IF it_users IS INITIAL.
    SELECT bname FROM usr02 INTO TABLE lt_user.
  ELSE.
    lt_user = it_users.
    SORT lt_user.
    DELETE ADJACENT DUPLICATES FROM lt_user.
  ENDIF.

  n = 1.
  LOOP AT lt_user INTO ls_user .

  if n = 20.
exit.
endif.

    CLEAR lt_worklist.
    CLEAR lt_messages.
    CLEAR lt_mess_struct.

    CALL FUNCTION 'SWN_UWL_GET_WORKLIST'
     EXPORTING
       user                      = ls_user-bname
*     LANGUAGE                  = SY-LANGU
*     TRANSLATE_WI_TEXT         = ' '
*     IM_TASK_FILTER            =
*     IM_STATUS_FILTER          =
*     IM_ITEM_TYPE_FILTER       =
 IMPORTING
*     RETURN_CODE               =
   worklist                  = lt_worklist
*     DEADLINE_ITEMS            =
 TABLES
   message_lines             = lt_messages
   message_struct            = lt_mess_struct.

        APPEND LINES OF lt_worklist TO worklist.
        APPEND LINES OF lt_messages TO message_lines.
        APPEND LINES OF lt_mess_struct TO message_struct.

 n = n + 1.
  ENDLOOP.

   SORT worklist.

delete from zuser_uwl.
  loop at worklist INTO WA_WORKLIST.
  COUNT = COUNT + 1.
  at end of USER_ID.
  WA_ZUSER_UWL-USER_ID = WA_WORKLIST-USER_ID.
   WA_ZUSER_UWL-ZCOUNT = COUNT.
   modify zuser_uwl from WA_ZUSER_UWL.
   COUNT = 0.
  ENDAT.
  endloop.
select * from zuser_uwl into table empdata.

ENDFUNCTION.

  • No labels