Skip to Content
author's profile photo Former Member
Former Member

Element 'BUS2009' does not have a valid object reference ()

Hello,

I created a workflow which contains the standard task TS00007986(Requisition Release - method SINGLERELEASE). I call this workflow in an Abap program and after i run the function SAP_WAPI_CREATE_EVENT, i see in the MESSAGE_LINES table, the message "Element 'BUS2009' does not have a valid object reference ()".

Here is the code.

data: ls_objkey type SWR_STRUCT-OBJECT_KEY,

lt_mesage type table of SWR_MESSAG,

gt_container type table of swr_cont,

gs_container type swr_cont,

gt_ret type SWOTRETURN.

gs_container-element = 'ReleaseCode'.

gs_container-value = '01'.

append gs_container to gt_container.

gs_container-element = 'BUS2009'.

gs_container-value = '001000036900001'.

append gs_container to gt_container.

CALL FUNCTION 'SAP_WAPI_START_WORKFLOW'

EXPORTING

task = 'WS90100034'

DO_COMMIT = 'X'

TABLES

INPUT_CONTAINER = gt_container

MESSAGE_LINES = lt_mesage.

001000036 is the purchase requisition number.

00001 is the item number from the requisition.

If i run the workflow separately(from transaction SWDD), it works fine. But when i run this code in Abap i get this error.

Thank you,

Efren

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    Posted on May 25, 2011 at 10:32 AM

    Please try to make use of the below code snippet

    Check my posts in this [thread|SAP_WAPI_START_WORKFLOW help;

    INCLUDE cntn01_swc.
     
    DATA:
          lt_cont TYPE TABLE OF swcont,
          lt_agent TYPE TABLE OF swhactor,
          lv_bor   TYPE swc0_object.
     
    swc0_create_container lt_cont.
     swc0_create_object lo_bor 'BUS2009' <BOR KEY>
    
    swc0_set_element lt_cont '_Wi_Object_ID' lv_bor.
    CALL FUNCTION 'SWW_WI_START_SIMPLE'
      EXPORTING
        task                         = 'WS<Template ID>'
      TABLES
        agents                       = lt_agent
        wi_container                 = lt_cont
      EXCEPTIONS
        id_not_created               = 1
        read_failed                  = 2
        immediate_start_not_possible = 3
        execution_failed             = 4
        invalid_status               = 5
        OTHERS                       = 6.
    IF sy-subrc  0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    

    Regards

    Pavan

    Edited by: Pavan Bhamidipati on May 25, 2011 4:02 PM

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Pavan, thanks a lot!

      Here is the code if anyone wants to see it.

      INCLUDE cntn01_swc.

      DATA:

      lt_cont TYPE TABLE OF swcont,

      lt_agent TYPE TABLE OF swhactor,

      lv_bor TYPE swc0_object.

      swc0_create_container lt_cont.

      swc0_create_object lv_bor 'BUS2009' '001000036900001'.

      swc0_set_element lt_cont 'BUS2009' lv_bor.

      swc0_set_element lt_cont 'ReleaseCode' '01'.

      CALL FUNCTION 'SWW_WI_START_SIMPLE'

      EXPORTING

      task = 'WS90100034'

      TABLES

      agents = lt_agent

      wi_container = lt_cont.

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.