Application Development 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: 

How to create a relationship between sales order and message?

christian_swonke
Participant
0 Kudos
514

Hi all,

today when a sales order is posted via IDoc, it is possible to see this as information at sales order display:

How can I create such relationship between sales order and order source manually?

In my case order is posted via RFC call. Some parameters of the call will be stored in a Z-table.

I would like to link these record from Z-table with created sales order, now.

It would be also fine if it is just a note / info to but at least some information i.e. GUID of send message.

I had a look and I am coming all time to GOS. But I am not sure if this is the right solution...

I tried already something like this:

          CONSTANTS lc_reltype_note TYPE oblreltype VALUE 'NOTE'.

          DATA ls_object_a TYPE sibflporb.
          DATA lv_logsys    TYPE logsys.
          DATA ls_object_b TYPE sibflporb.
          DATA lv_key       TYPE string.
          DATA lv_link TYPE oblguid16.

          lv_key = |{ es_message_record-mandt } { es_message_record-company } {  es_message_record-creation_date } { es_message_record-creation_time } { es_message_record-guid }|.

          " OBJECT A - SAP DOCUMENT
          ls_object_a-instid = ev_document.
          ls_object_a-typeid = SWITCH sibftypeid( es_header-auart WHEN 'AG' THEN 'BUS2031' ELSE 'BUS2032' ).
          ls_object_a-catid  = 'BO'.

          " OBJECT B - IDOC NUMBER
          ls_object_b-instid = lv_key.
          ls_object_b-typeid = 'MESSAGE'.
          ls_object_b-catid  = 'BO'.

          CALL FUNCTION 'OWN_LOGICAL_SYSTEM_GET'
            IMPORTING
              own_logical_system             = lv_logsys
            EXCEPTIONS
              own_logical_system_not_defined = 1
              OTHERS                         = 2.
          IF sy-subrc <> 0.
          ENDIF.

          cl_binary_relation=>create_link( EXPORTING  is_object_a  = ls_object_a
                                                      ip_logsys_a  = lv_logsys
                                                      is_object_b  = ls_object_b
                                                      ip_logsys_b  = zif_base~v_sndprn
                                                      ip_reltype   = lc_reltype_note
                                          IMPORTING  ep_link_id   = lv_link ).

Link ID is created. But I can not find an information at created sales order and also not in table SRGBTBREL

Regards

Christian

0 REPLIES 0