<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Problem with FM BINARY_RELATION_CREATE in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-fm-binary-relation-create/m-p/8506352#M1654516</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please use the code tag.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You're getting objectid, but you're not using it anywhere in the code. See [this blog|http://friendlyabaper.blogspot.com/2008/07/oh-my-gos.html], for example of GOS attachment creation. You don't need all the steps, but it explains in general how it works. Hopefully this will make it more clear.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 09 Feb 2012 22:20:30 GMT</pubDate>
    <dc:creator>Jelena_Perfiljeva</dc:creator>
    <dc:date>2012-02-09T22:20:30Z</dc:date>
    <item>
      <title>Problem with FM BINARY_RELATION_CREATE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-fm-binary-relation-create/m-p/8506351#M1654515</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to copy an attached document from an financial invoice to another financial invoice. I've been surfing the net and found that I can achieve this by using FM BINARY_RELATION_CREATE. But I'm not getting any success. Can you help me?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the code I'm using, obviously the program will not be used just for one case, this is just a test code with an existing invoice in my system.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;INCLUDE: &amp;lt;cntn01&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES: BEGIN OF ty_message_key,&lt;/P&gt;&lt;P&gt;  foltp TYPE so_fol_tp,&lt;/P&gt;&lt;P&gt;  folyr TYPE so_fol_yr,&lt;/P&gt;&lt;P&gt;  folno TYPE so_fol_no,&lt;/P&gt;&lt;P&gt;  doctp TYPE so_doc_tp,&lt;/P&gt;&lt;P&gt;  docyr TYPE so_doc_yr,&lt;/P&gt;&lt;P&gt;  docno TYPE so_doc_no,&lt;/P&gt;&lt;P&gt;  fortp TYPE so_for_tp,&lt;/P&gt;&lt;P&gt;  foryr TYPE so_for_yr,&lt;/P&gt;&lt;P&gt;  forno TYPE so_for_no,&lt;/P&gt;&lt;P&gt;END OF ty_message_key.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: lt_connections  TYPE TABLE OF bdn_con,&lt;/P&gt;&lt;P&gt;      lwa_connections TYPE bdn_con,&lt;/P&gt;&lt;P&gt;      system          TYPE logsys.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: objectid TYPE bapiborid.&lt;/P&gt;&lt;P&gt;DATA: lt_rellist  TYPE TABLE OF bapirellk,&lt;/P&gt;&lt;P&gt;      lwa_rellist TYPE bapirellk.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: lo_is_object_a TYPE borident.&lt;/P&gt;&lt;P&gt;DATA: lo_is_object_b TYPE borident.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Relationship&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;DATA: p_reltyp LIKE breltyp-reltype.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: p_botype LIKE borident-objtype.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: lv_message_key TYPE ty_message_key.&lt;/P&gt;&lt;P&gt;DATA: lo_message TYPE swc_object.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'OWN_LOGICAL_SYSTEM_GET'&lt;/P&gt;&lt;P&gt;  IMPORTING&lt;/P&gt;&lt;P&gt;    own_logical_system             = system&lt;/P&gt;&lt;P&gt;  EXCEPTIONS&lt;/P&gt;&lt;P&gt;    own_logical_system_not_defined = 1&lt;/P&gt;&lt;P&gt;    OTHERS                         = 2.&lt;/P&gt;&lt;P&gt;IF sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;objectid-objkey  = '52000001512011'.  "This is the original invoice&lt;/P&gt;&lt;P&gt;objectid-objtype = 'BUS2081'.&lt;/P&gt;&lt;P&gt;objectid-logsys  = system.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'BAPI_REL_GETRELATIONS'&lt;/P&gt;&lt;P&gt;  EXPORTING&lt;/P&gt;&lt;P&gt;    objectid        = objectid&lt;/P&gt;&lt;P&gt;    relation        = 'ATTA'&lt;/P&gt;&lt;P&gt;    recursionlevel  = 1&lt;/P&gt;&lt;P&gt;  TABLES&lt;/P&gt;&lt;P&gt;    listofrelations = lt_rellist.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;READ TABLE lt_rellist INTO lwa_rellist INDEX 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;lv_message_key = lwa_rellist-objkey_b.&lt;/P&gt;&lt;P&gt;swc_create_object lo_message 'MESSAGE' lv_message_key.&lt;/P&gt;&lt;P&gt;swc_refresh_object lo_message.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;swc_get_object_key lo_message lv_message_key.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;p_reltyp = 'ATTA'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;lo_is_object_a-objkey  = '52000001512011'.  "This is the original invoice&lt;/P&gt;&lt;P&gt;lo_is_object_a-objtype = 'BUS2081'.&lt;/P&gt;&lt;P&gt;lo_is_object_a-logsys  = system.&lt;/P&gt;&lt;P&gt;lo_is_object_b-objkey  = '52000001482011'.  "This is the destination invoice&lt;/P&gt;&lt;P&gt;lo_is_object_b-objtype = 'MESSAGE'.&lt;/P&gt;&lt;P&gt;*lo_is_object_b-objtype = 'BUS2081'.&lt;/P&gt;&lt;P&gt;lo_is_object_b-logsys  = system.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'BINARY_RELATION_CREATE_COMMIT'&lt;/P&gt;&lt;P&gt;  EXPORTING&lt;/P&gt;&lt;P&gt;    obj_rolea      = lo_is_object_a&lt;/P&gt;&lt;P&gt;    obj_roleb      = lo_is_object_b&lt;/P&gt;&lt;P&gt;    relationtype   = p_reltyp&lt;/P&gt;&lt;P&gt;  EXCEPTIONS&lt;/P&gt;&lt;P&gt;    no_model       = 1&lt;/P&gt;&lt;P&gt;    internal_error = 2&lt;/P&gt;&lt;P&gt;    unknown        = 3&lt;/P&gt;&lt;P&gt;    OTHERS         = 4.&lt;/P&gt;&lt;P&gt;IF sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help will be appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Carles&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Feb 2012 16:32:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-fm-binary-relation-create/m-p/8506351#M1654515</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-02-09T16:32:44Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with FM BINARY_RELATION_CREATE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-fm-binary-relation-create/m-p/8506352#M1654516</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please use the code tag.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You're getting objectid, but you're not using it anywhere in the code. See [this blog|http://friendlyabaper.blogspot.com/2008/07/oh-my-gos.html], for example of GOS attachment creation. You don't need all the steps, but it explains in general how it works. Hopefully this will make it more clear.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Feb 2012 22:20:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-fm-binary-relation-create/m-p/8506352#M1654516</guid>
      <dc:creator>Jelena_Perfiljeva</dc:creator>
      <dc:date>2012-02-09T22:20:30Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with FM BINARY_RELATION_CREATE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-fm-binary-relation-create/m-p/8506353#M1654517</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Jelena,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;your link was very helpfull in finding the solution to my problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;10 points awarded!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Carles&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Feb 2012 11:32:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-with-fm-binary-relation-create/m-p/8506353#M1654517</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-02-13T11:32:05Z</dc:date>
    </item>
  </channel>
</rss>

