SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Returning IDocs linked to Documents



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Interfaces | Интерфейсы
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1640

PostPosted: Mon Sep 10, 2007 8:16 pm    Post subject: Returning IDocs linked to Documents Reply with quote

Return the list of IDocs linked to the delivery

Code:
CALL FUNCTION 'EDI_GET_LINKED_IDOCS'
                 EXPORTING
                      OBJTYPE             = 'LIKP'
                      OBJKEY              = ITAB_SO-O856NO
                 TABLES
                      LINKED_IDOCS        = ITAB_LINKED_IDOCS
                 EXCEPTIONS
                      OBJECT_NOT_FOUND    = 1
                      NO_IDOCS_LINKED     = 2
                      OBJECT_TYPE_UNKNOWN = 3
                      INTERNAL_ERROR      = 4
                      OTHERS              = 5.
            IF SY-SUBRC = 0.
              CLEAR: T_VBELN_DOCNUM, T_824_DOCNUM.
              CLEAR: T_VBELN_DATE, T_824_DATE.


Return the list of IDocs linked to the invoice

Code:
CALL FUNCTION 'EDI_GET_LINKED_IDOCS'
                 EXPORTING
                      OBJTYPE             = 'VBRK'
                      OBJKEY              = ITAB_SO-O810NO
                 TABLES
                      LINKED_IDOCS        = ITAB_LINKED_IDOCS
                 EXCEPTIONS
                      OBJECT_NOT_FOUND    = 1
                      NO_IDOCS_LINKED     = 2
                      OBJECT_TYPE_UNKNOWN = 3
                      INTERNAL_ERROR      = 4
                      OTHERS              = 5.


Version 4.6X
Code:

DATA:      t_roles LIKE relroles OCCURS 5 WITH HEADER LINE.
DATA:      t_object LIKE borident.


            t_object-objkey = itab_data-objky.
            t_object-objtype = 'BUS2035'.    “Scheduling Agreements

            CALL FUNCTION 'SREL_GET_NEXT_RELATIONS'
                 EXPORTING
                      object         = t_object
                 TABLES
                      roles          = t_roles
                 EXCEPTIONS
                      internal_error = 1
                      no_logsys      = 2
                      OTHERS         = 3.


R/3 note no. 317864

In Release 4.6, the IDoc base does not use the Workflow container with type C to save links but the system was changed to the generic object services.
This note describes in which relations the objects in the IDoc processing are saved.
This know-how is a prerequisite in order to effectively find a special object whose link was saved during the IDoc processing.
All relationships types defined in the SAP System can be found in table VRBRELTYP.
From the IDoc base, the following essential relationships have been defined:
IDC0 - Application document and outbound IDoc are related
IDC1 - Inbound IDoc and application document are related
IDC3 - Inbound IDoc and its original IDoc are related (while editing)
IDC4 - Inbound IDoc and outbound IDoc of the sending system are related (for R/3 - R/3 link)
IDC7 - Outbound IDoc and its original IDoc are related (while editing)
IDC8 - Inbound IDoc and transaction ID (of tRFC) are related
IDCA - Outbound IDoc and transaction ID (of tRFC) are related
In order to read relationships use SREL_GET_NEXT_RELATIONS. Generally, you need to transfer the BOR object (triple: object key, object type an logical system) for which you want to read the relationships to this function module.
In order to find a special link you should know in which relationship the link was saved and whether the BOR object was saved into role A or into role B.
For individual relationship types you can find this information also in table VRBRELTYP.
For the relationship types described above, the object named first is always in role A and the second object is always in role B.
Example: Searching the outbound IDoc of the sending system for an inbound IDoc which was generated via an R/3 - R/3 communication. The example source code represents the correction.
The internal table will then contain an entry from which you can read the following information:
The fields OBJKEY_A, OBJTYPE_A and LOGSYS_A contain all transferred values of the object for whose link you are searching - this object occurs in role A.
The field RELTYPE contains the value 'IDC4' - since we only searched for this.
The fields OBJKEY_B, OBJTYPE_B and LOGSYS_B contain all values of the searched linked object - this searched object occurs in role B.
That is: the field OBJKEY_B contains the IDoc number of the sending system, the field OBJTYPE_B should contain the value 'IDOC' and the field LOGSYS_B should contain the sending logical system.

Example:

Code:
     * find the outbound-IDoc of the sending system for an inbound-IDoc,
     * which was created during R/3 - R/3 - communication
     report test.
     data: object1 like borident.
     data: begin of links occurs 0.
             include structure relgraphlk.
     data: end of links.
       object1-objkey = '0000000000004711'."IDOC-Nummer of the inbound-IDoc
       object1-objtype = 'IDOC'.
       object1-logsys  = 'TTTCLNT999'.     " << own logical system

       CALL FUNCTION 'SREL_GET_NEXT_RELATIONS'


        EXPORTING
         OBJECT               = object1
     *   ROLETYPE             =
         RELATIONTYPE         = 'IDC4'
     *   MAX_HOPS             = 1
     *   INCL_APPLRELS        = ' '
     *   EXCL_ROLES           =
     *   EXCL_RELATIONS       =
        TABLES
         LINKS                = links
     *   ROLES                =
     *   APPLLINKS            =
        EXCEPTIONS
         OTHERS               = 4.

     * in table links we can find one entry with following informations:
     * in fields OBJKEY_A, OBJTYPE_A und LOGSYS_A are all values of
     * object1 - to this object we looked for the special link
     * object1 appears in role A
     * in field RELTYPE is the value 'IDC4' - we looked only for this kind
     * in fields OBJKEY_B, OBJTYPE_B and LOGSYS_B are all values of the
     * linked object - this linked object appears in role B
     * this means: in field OBJKEY_B is the IDoc-number of the sending
                                                                       Page 4

     * system, in field OBJTYPE_B should be 'IDOC' and in LOGSYS_B is the
     * name of the sending logical system.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Interfaces | Интерфейсы All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.