SAP ABAP

Viewing another user’s workflow inbox

Posted on: June 14, 2007

This is a great tool for a workflow administrator. It is a report that allows you to view what’s in another user’s inbox. It’s displayed in an ALV grid format and clicking the workitem ID takes you to the applicable workflow log.
REPORT zwf_view_inbox

MESSAGE-ID b1

NO STANDARD PAGE HEADING

LINE-SIZE 170.

************************************************************************
* Program Name : ZWF_VIEW_INBOX

* Author : H Bauer

***********************************************************************
************************************************************************
* I n c l u d e s *
************************************************************************
TYPE-POOLS: slis.
************************************************************************
* I n t e r n a l T a b l e s *
************************************************************************

DATA BEGIN OF itab_wl OCCURS 0.

INCLUDE STRUCTURE swr_wihdr.

DATA:END OF itab_wl.

DATA: BEGIN OF gt_outtab OCCURS 0.

INCLUDE STRUCTURE itab_wl.

DATA: END OF gt_outtab.

DATA: fld_catalog TYPE slis_t_fieldcat_alv, ” lvc_t_fcat,

wa_fld_catalog LIKE LINE OF fld_catalog.

DATA: gs_layout TYPE slis_layout_alv,

gt_sort TYPE slis_t_sortinfo_alv,

gs_sort TYPE slis_sortinfo_alv,

g_exit_caused_by_caller,

gs_exit_caused_by_user TYPE slis_exit_by_user,

g_repid LIKE sy-repid.

DATA: gs_print TYPE slis_print_alv.

DATA: gt_events TYPE slis_t_event,

gt_list_top_of_page TYPE slis_t_listheader,

g_status_set TYPE slis_formname VALUE ‘PF_STATUS_SET’,

g_user_command TYPE slis_formname VALUE ‘USER_COMMAND’,

g_top_of_page TYPE slis_formname VALUE ‘TOP_OF_PAGE’,

g_top_of_list TYPE slis_formname VALUE ‘TOP_OF_LIST’,

g_end_of_list TYPE slis_formname VALUE ‘END_OF_LIST’.

DATA: gs_variant LIKE disvariant,

g_save,

gv_dbcnt TYPE p,

w_callback_ucomm TYPE slis_formname.

DATA: gv_save_tabix LIKE sy-tabix.

************************************************************************

* P a r a m e t e r s & S e l e c t O p t i o n *

************************************************************************

SELECTION-SCREEN BEGIN OF BLOCK block1 WITH FRAME TITLE text-005.

PARAMETERS: pv_uname LIKE sy-uname.

SELECTION-SCREEN: END OF BLOCK block1.

SELECTION-SCREEN: BEGIN OF BLOCK block3 WITH FRAME TITLE text-010.

SELECTION-SCREEN SKIP.

SELECTION-SCREEN COMMENT /1(79) text-201.

SELECTION-SCREEN: END OF BLOCK block3.

************************************************************************
* A t S e l e c t i o n S c r e e n *
************************************************************************

AT SELECTION-SCREEN.

IF pv_uname IS INITIAL.

MESSAGE e999(b1) WITH ‘Please enter SAP Logon ID’.

ENDIF.

************************************************************************
* S t a r t o f S e l e c t i o n *
************************************************************************

START-OF-SELECTION.

g_repid = sy-repid.

PERFORM s100_layout_init USING gs_layout.

PERFORM s120_update_field_catalog.

PERFORM s140_eventtab_build USING gt_events[].

gs_variant-report = g_repid.

g_save = ‘A’.

PERFORM s200_get_wf_data.

************************************************************************

* E n d o f S e l e c t i o n *

************************************************************************

END-OF-SELECTION.

PERFORM s150_comment_build USING gt_list_top_of_page[].

w_callback_ucomm = ‘CALLBACK_UCOMM’.

CALL FUNCTION ‘REUSE_ALV_GRID_DISPLAY’

EXPORTING

i_callback_program = g_repid

i_callback_user_command = w_callback_ucomm

is_layout = gs_layout

it_fieldcat = fld_catalog

it_sort = gt_sort

i_save = g_save

is_variant = gs_variant

it_events = gt_events[]

is_print = gs_print

IMPORTING

e_exit_caused_by_caller = g_exit_caused_by_caller

es_exit_caused_by_user = gs_exit_caused_by_user

TABLES

t_outtab = itab_wl

EXCEPTIONS

program_error = 1

OTHERS = 2.

IF sy-subrc = 0.

IF g_exit_caused_by_caller = ‘X’.

ELSE.

IF gs_exit_caused_by_user-back = ‘X’. “F3

ELSE.

IF gs_exit_caused_by_user-exit = ‘X’. “F15

ELSE.

IF gs_exit_caused_by_user-cancel = ‘X’. “F12

ELSE.

ENDIF.

ENDIF.

ENDIF.

ENDIF.

ELSE.

ENDIF.

************************************************************************

* F o r m s *

***********************************************************************

*&———————————————————————*

*& Form LAYOUT_INIT

*&———————————————————————*

FORM s100_layout_init USING rs_layout TYPE slis_layout_alv.

*”Build layout for list display

rs_layout-detail_popup = ‘X’.

rs_layout-zebra = “X”.

rs_layout-cell_merge = ‘X’.

rs_layout-colwidth_optimize = ‘X’.

rs_layout-no_min_linesize = space. “‘X’.

rs_layout-min_linesize = 120.

rs_layout-totals_text = ‘Grand total’.

rs_layout-subtotals_text = ‘Sub-total’.

*

gs_print-print = space.

gs_print-prnt_title = ‘X’.

gs_print-prnt_info = ‘ ‘.

gs_print-no_print_selinfos = ‘X ‘. ” display no selection infos

gs_print-no_coverpage(1) = space..

gs_print-no_print_listinfos = ‘X’. ” display no listinfos

ENDFORM. ” LAYOUT_INIT

*———————————————————————*

* FORM UPDATE_FIELD_CATALOG *

*———————————————————————*

* …….. *

*———————————————————————*

FORM s120_update_field_catalog.

wa_fld_catalog-col_pos = 10.

wa_fld_catalog-fieldname = ‘WI_ID’.

wa_fld_catalog-tabname = ‘ITAB_WL’.

wa_fld_catalog-seltext_l = ‘Workflow ID’.

wa_fld_catalog-hotspot = ‘X’.

APPEND wa_fld_catalog TO fld_catalog.

CLEAR wa_fld_catalog.

wa_fld_catalog-col_pos = wa_fld_catalog-col_pos + 10.

wa_fld_catalog-fieldname = ‘WI_TEXT’.

wa_fld_catalog-tabname = ‘ITAB_WL’.

wa_fld_catalog-seltext_l = ‘Description’.

APPEND wa_fld_catalog TO fld_catalog.

CLEAR wa_fld_catalog.

wa_fld_catalog-col_pos = wa_fld_catalog-col_pos + 10.

wa_fld_catalog-fieldname = ‘WI_CD’.

wa_fld_catalog-tabname = ‘ITAB_WL’.

wa_fld_catalog-seltext_l = ‘Create Date’.

APPEND wa_fld_catalog TO fld_catalog.

CLEAR wa_fld_catalog.

wa_fld_catalog-col_pos = wa_fld_catalog-col_pos + 10.

wa_fld_catalog-fieldname = ‘WI_CT’.

wa_fld_catalog-tabname = ‘ITAB_WL’.

wa_fld_catalog-seltext_l = ‘Create Time’.

APPEND wa_fld_catalog TO fld_catalog.

CLEAR wa_fld_catalog.

wa_fld_catalog-col_pos = wa_fld_catalog-col_pos + 10.

wa_fld_catalog-fieldname = ‘WI_AAGENT’.

wa_fld_catalog-tabname = ‘ITAB_WL’.

wa_fld_catalog-seltext_l = ‘Agent’.

APPEND wa_fld_catalog TO fld_catalog.

CLEAR wa_fld_catalog.

wa_fld_catalog-col_pos = wa_fld_catalog-col_pos + 10.

wa_fld_catalog-fieldname = ‘WI_RH_TASK’.

wa_fld_catalog-tabname = ‘ITAB_WL’.

wa_fld_catalog-seltext_l = ‘Task’.

APPEND wa_fld_catalog TO fld_catalog.

CLEAR wa_fld_catalog.

wa_fld_catalog-col_pos = wa_fld_catalog-col_pos + 10.

wa_fld_catalog-fieldname = ‘WI_FORW_BY’.

wa_fld_catalog-tabname = ‘ITAB_WL’.

wa_fld_catalog-seltext_l = ‘From’.

APPEND wa_fld_catalog TO fld_catalog.

CLEAR wa_fld_catalog.

wa_fld_catalog-col_pos = wa_fld_catalog-col_pos + 10.

wa_fld_catalog-fieldname = ‘WI_STAT’.

wa_fld_catalog-tabname = ‘ITAB_WL’.

wa_fld_catalog-seltext_l = ‘Status’.

APPEND wa_fld_catalog TO fld_catalog.

CLEAR wa_fld_catalog.

wa_fld_catalog-col_pos = wa_fld_catalog-col_pos + 10.

wa_fld_catalog-fieldname = ‘WI_AA_NAME’.

wa_fld_catalog-tabname = ‘ITAB_WL’.

wa_fld_catalog-seltext_l = ‘Agent Name’.

APPEND wa_fld_catalog TO fld_catalog.

CLEAR wa_fld_catalog.

wa_fld_catalog-col_pos = wa_fld_catalog-col_pos + 10.

wa_fld_catalog-fieldname = ‘DEF_GUID’.

wa_fld_catalog-tabname = ‘ITAB_WL’.

wa_fld_catalog-seltext_l = ‘WF Task/GUID’.

APPEND wa_fld_catalog TO fld_catalog.

CLEAR wa_fld_catalog.

ENDFORM. ” UPDATE_FIELD_CATALOG

*&———————————————————————*

*& Form EVENTTAB_BUILD

*&———————————————————————*

FORM s140_eventtab_build USING rt_events TYPE slis_t_event.

DATA: ls_event TYPE slis_alv_event.

CALL FUNCTION ‘REUSE_ALV_EVENTS_GET’

EXPORTING

i_list_type = 0

IMPORTING

et_events = rt_events.

READ TABLE rt_events WITH KEY name = slis_ev_top_of_page

INTO ls_event.

IF sy-subrc = 0.

MOVE g_top_of_page TO ls_event-form.

APPEND ls_event TO rt_events.

ENDIF.

ENDFORM. ” EVENTTAB_BUILD

*&———————————————————————*

*& Form COMMENT_BUILD

*&———————————————————————*

FORM s150_comment_build USING lt_top_of_page TYPE

slis_t_listheader.

DATA: ls_line TYPE slis_listheader,

ls_info TYPE slis_entry,

com1(4),

com2(4),

lv_jobd(20),

date1(10),

lv_date1(10),

lv_date2(10).

WRITE sy-datum TO date1.

CLEAR ls_line.

ls_line-typ = ‘H’.

CONCATENATE ‘ZW911′ text-100 date1 INTO ls_line-info

SEPARATED BY ‘ – ‘.

APPEND ls_line TO lt_top_of_page.

ls_line-typ = ‘S’.

CONCATENATE ‘System:’ sy-sysid ‘-‘ sy-mandt

INTO ls_line-info.

APPEND ls_line TO lt_top_of_page.

CONCATENATE ‘Inbox for: ‘ pv_uname

INTO ls_line-info.

APPEND ls_line TO lt_top_of_page.

ENDFORM. ” COMMENT_BUILD

*———————————————————————*

* FORM select_gr_data *

*———————————————————————*

* …….. *

*———————————————————————*

FORM s200_get_wf_data.

DATA: lv_return LIKE sy-subrc.

CALL FUNCTION ‘SAP_WAPI_CREATE_WORKLIST’

EXPORTING

user = pv_uname

IMPORTING

return_code = lv_return

TABLES

worklist = itab_wl.

ENDFORM. “s200_get_header_data

*———————————————————————*

* FORM callback_ucomm *

*———————————————————————*

FORM callback_ucomm USING r_ucomm LIKE sy-ucomm

rs_selfield TYPE slis_selfield.

DATA: p_wid LIKE swr_struct-workitemid

.

CASE rs_selfield-fieldname.

WHEN ‘WI_ID’.

MOVE rs_selfield-value TO p_wid.

CALL FUNCTION ‘SAP_WAPI_DISPLAY_WORKITEM’

EXPORTING

workitem_id = p_wid.

ENDCASE.

*

ENDFORM. “callback_ucomm

*———————————————————————*

* FORM top_of_page *

*———————————————————————*

FORM top_of_page.

CALL FUNCTION ‘REUSE_ALV_COMMENTARY_WRITE’

EXPORTING

i_logo = ‘ENJOYSAP_LOGO’

it_list_commentary = gt_list_top_of_page.

WRITE: AT 88 ‘Page:’, sy-pagno.

ENDFORM. “top_of_page

Workflow : Other Useful Links :
Org units in workflow steps?
‘No Administrator found’ workflow error
LIV & Payment Release workflow
Workflow performance tips
How can I temporarily disable a workflow in production?
Raising ABAP OO events for workflow

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Read Whole Site there

http://abapcode.info

Topic Wise Content

blog content

June 2007
M T W T F S S
« May   Jul »
 123
45678910
11121314151617
18192021222324
252627282930  

Blog Stats

  • 395,330 hits
Follow

Get every new post delivered to your Inbox.

Join 741 other followers

%d bloggers like this: