cancel
Showing results for 
Search instead for 
Did you mean: 

FM SAP_WAPI_WORKITEMS_TO_OBJECT not get any entries

siongchao_ng
Contributor
0 Kudos

Hi all,

My FM SAP_WAPI_WORKITEMS_TO_OBJECT is not getting back any entries although there are many entries in the table SWW_WI2OBJ

The code passed in is correct all these while. Anything wrong here?

DATA: lo_event_param TYPE REF TO if_swf_ifs_parameter_container.

DATA: lt_worklist TYPE STANDARD TABLE OF swr_wihdr.

DATA: ls_sibflpord TYPE sibflporb,
ls_worklist TYPE swr_wihdr,
ls_wfcon TYPE LINE OF swconttab.

DATA: lv_wfkey TYPE char100,
lv_revalue TYPE zcm_char_value,
lv_count TYPE i.

DATA: lr_oref TYPE REF TO cx_root.

CONSTANTS:
lc_objty_tdev TYPE sibftypeid VALUE 'ZCL_TENDER_EVALUATION',
lc_clstyp_cl TYPE swf_clstyp VALUE 'CL',
lc_event_sta TYPE sibfevent VALUE 'STARTED',
lc_event_del TYPE sibfevent VALUE 'CANCELLED',
lc_sesv_0001 TYPE swr_stavar VALUE '0001',"Active
lc_value_x TYPE char01 VALUE 'X'.


CLEAR: cv_emsg.

CHECK iv_event IS NOT INITIAL.

IF wd_this->bukrs IS INITIAL OR wd_this->tdrnr IS INITIAL.
MESSAGE e045(zmm01) INTO cv_emsg. EXIT.
ENDIF.


CONCATENATE wd_this->bukrs
wd_this->tdrnr
wd_this->werks INTO ls_sibflpord-instid RESPECTING BLANKS.

ls_sibflpord-typeid = lc_objty_tdev.
ls_sibflpord-catid = lc_clstyp_cl.

CALL FUNCTION 'SAP_WAPI_WORKITEMS_TO_OBJECT'
EXPORTING
object_por = ls_sibflpord
selection_status_variant = lc_sesv_0001
output_only_top_level = lc_value_x
TABLES
worklist = lt_worklist.
IF iv_event = lc_event_sta.
IF lt_worklist[] IS NOT INITIAL.
MESSAGE e046(zmm01) INTO cv_emsg. EXIT.
ENDIF.
ELSE.
DESCRIBE TABLE lt_worklist[] LINES lv_count.
IF lv_count < 1.
MESSAGE e047(zmm01) INTO cv_emsg. EXIT.
ELSEIF lv_count > 1.
MESSAGE e048(zmm01) INTO cv_emsg. EXIT.
ENDIF.
ENDIF.

IF iv_event = lc_event_del.
READ TABLE lt_worklist[] INTO ls_worklist INDEX 1.
CALL FUNCTION 'SAP_WAPI_ADM_WORKFLOW_CANCEL'
EXPORTING
workitem_id = ls_worklist-wi_id
actual_agent = 'WF-BATCH'.
EXIT.
ENDIF.

TRY.


CALL METHOD cl_swf_evt_event=>get_event_container
EXPORTING
im_objcateg = ls_sibflpord-catid
im_objtype = ls_sibflpord-typeid
im_event = iv_event
RECEIVING
re_reference = lo_event_param.

LOOP AT it_wfcon INTO ls_wfcon.
CALL METHOD lo_event_param->set
EXPORTING
name = ls_wfcon-element
value = ls_wfcon-value.
ENDLOOP.

CALL METHOD cl_swf_evt_event=>raise
EXPORTING
im_objcateg = ls_sibflpord-catid
im_objtype = ls_sibflpord-typeid
im_event = iv_event
im_objkey = ls_sibflpord-instid
im_event_container = lo_event_param.
CATCH cx_swf_evt_invalid_objtype INTO lr_oref.
cv_emsg = lr_oref->get_text( ).
CATCH cx_swf_evt_invalid_event INTO lr_oref.
cv_emsg = lr_oref->get_text( ).
ENDTRY.

Sandra_Rossi
Active Contributor
0 Kudos

I don't know any issue with SAP_WAPI_WORKITEMS_TO_OBJECT. Check the SAP notes just in case...

A quick troubleshooting is to do an SQL trace to see when the WAPI selects data from SWW_WI2OBJ and see what's wrong in the selection criteria.

Accepted Solutions (1)

Accepted Solutions (1)

siongchao_ng
Contributor
0 Kudos

Somehow found that user created duplicate entry in tender custom table ZTD_EV001 and later deleted it. So now the custom tender table ZTD_EV001 have 2 entries now, 1 still in process and another with the status deleted.

But found that the standard workflow table SWWWIHEAD record creation date seemed mixed up. The record creation date seems to tally with the deleted ZTD_EV001 creation date instead of the still in process tender.

So I debug change the SWWWIHEAD standard table record creation date to match that with the still in process ZTD_EV001 tender creation date.

The corresponding workflow record can be retrieved now.

Answers (1)

Answers (1)

sbl
Active Contributor
0 Kudos

Hi

if the problem has been fixed can you close the request

Cheers