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

Calling Family Object Using SAP_WAPI_CREATE_EVENT

Hi Experts,

I'm using FM SAP_WAPI_CREATE_EVENT to call BOR Family....

I try to set the KeyFields and Attributes in that Family BOR. I've already passed the attributes and the key fields in the variable object_key and swr_cont. But when I trace it, all the attributes still <not set> or <no instance>.

Did I make something wrong?

Here is my code:

INCLUDE <cntn01>.
  DATA: wf_key LIKE swr_struct-object_key,
        wf_event TYPE swr_struct-event,
        wf_object TYPE swr_struct-object_typ.

  DATA: lv_return TYPE sy-subrc,
        lv_event_id TYPE swr_struct-event_id,
        lv_task TYPE swwwihead-wi_rh_task.

  DATA: wf_cont TYPE STANDARD TABLE OF swr_cont WITH HEADER LINE,
        wf_msgline TYPE STANDARD TABLE OF swr_messag WITH HEADER LINE,
        wf_msgstruct TYPE STANDARD TABLE OF swr_mstruc WITH HEADER LINE.

  DATA: lv_key TYPE pakey.


  lv_key-pernr = inf0021-pernr.
  lv_key-subty = inf0021-subty.
  lv_key-objps = inf0021-objps.
  lv_key-sprps = inf0021-sprps.
  lv_key-endda = inf0021-endda.
  lv_key-begda = inf0021-begda.
  lv_key-seqnr = inf0021-seqnr.

  wf_object = 'ZFAMILYAPP'.
  wf_key = lv_key.
  wf_event = 'CREATED'.

  swc_create_container wf_cont.
  CLEAR wf_cont.
  wf_cont-element = 'EMPLOYEENUMBER'.
  wf_cont-value = inf0021-pernr.
  APPEND wf_cont.

  CLEAR wf_cont.
  wf_cont-element = 'LASTNAME'.
  wf_cont-value = inf0021-fanam.
  APPEND wf_cont.

  CLEAR wf_cont.
  wf_cont-element = 'DATEOFBIRTH'.
  wf_cont-value = inf0021-fgbdt.
  APPEND wf_cont.

  CALL FUNCTION 'SAP_WAPI_CREATE_EVENT'
    EXPORTING
      object_type     = wf_object
      object_key      = wf_key
      event           = wf_event
      commit_work     = 'X'
      event_language  = sy-langu
      language        = sy-langu
      user            = sy-uname
    IMPORTING
      return_code     = lv_return
      event_id        = lv_event_id
    TABLES
      input_container = wf_cont
      message_lines   = wf_msgline
      message_struct  = wf_msgstruct.

Thx u for the replies. I will appreciate every helpful replies

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Posted on Nov 21, 2011 at 05:59 AM

    Hi,

    Are you able to see any entry in SWEL transaction. After rasiing the event check this.. If you are able to find any entry thne this could be a binding issue. from event container to workflow container.

    If the event it self is not getting triggered then check if any messages are retruned back in message_lines parameter.

    Just to make a note that Business obect is geenrated and active.

    Regards

    Pavan

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Nov 21, 2011 at 06:04 AM

    Hi

    If the event is raised successfully then you should be able to see an entry in SWEL transaction. If an entry is found with respect to raising event then there could be a binding issue.

    If event raising is unsuccessful then check the parameter message_lines if any messages are returned back to the calling program.

    Regards

    Pavan

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Nov 21, 2011 at 06:42 AM

    Hello,

    "I try to set the KeyFields and Attributes in that Family BOR."

    I'm not sure you understand the purpose of SAP_WAPI_CREATE_EVENT. It does what it says - creates an event. Usually you just have to provide the BOR, the key and the event. It's not for setting object attributes!

    What exactly are you trying to do?

    regards

    Rick Bakker

    hanabi technology

    PS Use SWELS to check that the event trace (SWEL) is turned on

    Add a comment
    10|10000 characters needed characters exceeded

    • Hello,

      "Actually what I want is generating an approval workflow when user create a new Family member."

      Have they already created this Family member? Is that where you're getting the date of birth from?

      If so, there is no need to pass the attributes to the workflow. Just pass the BOR type and the key and all the attributes will be available within the workflow.

      Try it in SWO1 - just fill in the key and the attributes will appear.

      regards

      Rick Bakker

      hanabi technology

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.