cancel
Showing results for 
Search instead for 
Did you mean: 

Create reference to object in event

Former Member
0 Kudos

Hi.

I'm trying to create an object of type A and the create another object of type B and bind this to the A's container. Is this possible?


data: object        type swc_object,
      objtype       like swetypecou-objtype value 'ZCO_ORDCHG',
*      object_order  type swc_object,
*      objtype_order like swetypecou-objtype value 'ZBUS2032',
      event         like swetypecou-event, 
      objkey        like sweinstcou-objkey.
    event = 'INPUTFINISHED'.
    OBJKEY = DOCNUM.
    SWC_CREATE_OBJECT OBJECT OBJTYPE OBJKEY. "ZCO_ORDCHG
    SWC_SET_ELEMENT EVENT_CONTAINER 'Order' SALES_DOCUMENT.
    SWC_CONTAINER_TO_PERSISTENT EVENT_CONTAINER.
    SWC_RAISE_EVENT OBJECT EVENT EVENT_CONTAINER.

The Element I'm trying to set - Order is of object typ ZBUS2032.

This obviously is not really working.

What am I doing wrong?

I have tested to create an object of typ ZBUS2032 and bind this to the Container but this didn't work either.

Your comments are more than greatly appreciated.

Best regards,

Mattias

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member186746
Active Contributor
0 Kudos

If you're using BO's outside a Wf environment, you should use the macro swc_refresh_object self. to make the changes to the BO.

What is the functional requirement for this?

Kind regards, Rob Dielemans

Former Member
0 Kudos

Functional requirements:

1. Process code triggers WF with IDoc of type ZCO_ORDCHG.

2. User Processes IDoc from folder in WF "Cust Order Change - Received".

3. The IDoc should end up in another folder "Cust Order Change - Posted" if it is a success.

4. It should be possible to View or Modify a changed order. [therefore I need to attach object of type ZBUS2032 to the event container]

??

Thank you v e r y much for your quick reply. Can you give me some directions of what to do?

Best regards,

Mattias

former_member186746
Active Contributor
0 Kudos

Hi,

It's not possible to add the BO ZBUS2032 as an attribute of the BO of the event?

regards, Rob Dielemans

Former Member
0 Kudos

Thank you once again Rob.

If I do like that, this does not work... what am I doing wrong. Have tried a few different approaches but this doesn't seem to work:


GET_PROPERTY ORDER CHANGING CONTAINER.
  DATA: ORDER      TYPE SWC_OBJECT,                              
        objkey     like sweinstcou-objkey,                       
        objtype    like swetypecou-objtype value 'ZBUS2032'.     
  DATA: V_SO       LIKE VBAK-VBELN.                      
* Call form to get the SO key
  PERFORM F_GET_SO_INFO   USING OBJECT-KEY-IDOCNUMBER            
                       CHANGING V_SO. 
                                                                 
  objkey = V_SO.                                                 
  SWC_CREATE_OBJECT OBJECT-ORDER objtype objkey.                 
  SWC_SET_ELEMENT CONTAINER 'Order' OBJECT-ORDER.                                                                                
END_PROPERTY.                                                    

Best regards,

// Mattias

former_member186746
Active Contributor
0 Kudos

Hi,

I think you should use another container element to retrieve the data from the instantiated BO, then you should use swc_get_element with the other container and then you can set the element in the BO.

also check include <cntn01> for correct format in creating the business object.

Kind regards, Rob Dielemans

Former Member
0 Kudos

Hey!

Thanks for your input.

I did it the "usual" way and it worked fine:


  objkey = V_SO.                                   
  SWC_CREATE_OBJECT OBJECT-ORDER objtype objkey.   
  SWC_SET_ELEMENT CONTAINER 'Order' OBJECT-ORDER.  

Order object of type ZBUS2032 is populated to the ZCO_ORDCHG object. IDOCORCHG is populated with the object of type BUS2032...

Now only the Workflow parts left. And Workflow is... just something

Best regards.

// Mattias