Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to create a relationship between 2 GOS objects

milan_dobias
Explorer
0 Likes
3,003

Hi all,

I have a small problem how to create a link between 2 GOS (businnes objects) .

I have 2 different business objects ( Z* type, for example class Z1 and Z2) defined using SWO1, and I want to create link between instances of 2 GOS objects.

I try to use FM 'BINARY_RELATION_CREATE' ,

fill parameters OBJ_ROLEA , OBJ_ROLEB ,

but I know how to fill parameter RELATIONTYPE.

All the time I got a message RL 301 (Role type '&1' is not assigned object type '&2').

Should I make some customization (and how ) for roles of object Z1 and Z2 ?

Or should I use any general relationtype ?

Can somebody helo me to explain, how to make customization , or any link, example ?

Thanks in advance

Milan Dobias

Hi all,

I have a small problem how to create a link between 2 GOS (businnes objects) .

I have 2 different business objects ( Z* type, for example class Z1 and Z2) defined using SWO1, and I want to create link between instances of 2 GOS objects.

I try to use FM 'BINARY_RELATION_CREATE' ,

fill parameters OBJ_ROLEA , OBJ_ROLEB ,

but I know how to fill parameter RELATIONTYPE.

All the time I got a message RL 301 (Role type '&1' is not assigned object type '&2').

Should I make some customization (and how ) for roles of object Z1 and Z2 ?

Or should I use any general relationtype ?

Can somebody helo me to explain, how to make customization , or any link, example ?

Thanks in advance

Milan Dobias

3 REPLIES 3
Read only

robert_altenstraer
Active Participant
0 Likes
1,547

hi,

1. check table: SGOSATTR Entry:Name SRELATIONS if the GOS is allowed

2. by creating the GOS:

coding snip

   CALL METHOD cl_binary_relation=>create_link
      EXPORTING
        is_object_a = lo_is_object_a
        is_object_b = lo_is_object_b
        ip_reltype  = 'ATTA'.

ATTA > attach to gos

best reg robert

Read only

1,547

Thanks for Your answer, but main problem is what relation type use to create link between 2 common objects.

Your solution (use class CL_BINARY_RELATION) returns the same error message, because this class is used in FM BINARY_RELATION_CREATE.

In the end I found that solution is to use as relationtype (ORBRELTYP-RELTYPE = 'ASGN').

CALL FUNCTION 'BINARY_RELATION_CREATE'

EXPORTING

obj_rolea = obj_a

obj_roleb = obj_b

relationtype = 'ASGN'

EXCEPTIONS

no_model = 1

internal_error = 2

unknown = 3

OTHERS = 4.

It seems to work and on both objects (A and B) I can see link (relation).

Best regards,

MD

Read only

0 Likes
1,547

Hi Milan,

Could you tell me how to find out what should be the relation type for other type of objects? I also need this information

Regards

Chandrakant Kulkarni