<?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: Creating attachments from Services for Objects in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/creating-attachments-from-services-for-objects/m-p/8526846#M1656351</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ravi,&lt;/P&gt;&lt;P&gt; Thanks for the reply but when i am using this i am getting short dump saying&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Runtime Errors         OBJECTS_OBJREF_NOT_ASSIGNED&lt;/P&gt;&lt;P&gt;Except.                CX_SY_REF_IS_INITIAL&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   Access via 'NULL' object reference not possible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;any idea how to correct this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Pavan Jhawar.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 22 Feb 2012 06:19:53 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2012-02-22T06:19:53Z</dc:date>
    <item>
      <title>Creating attachments from Services for Objects</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/creating-attachments-from-services-for-objects/m-p/8526844#M1656349</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; I am trying to create an attachment using the FM BDS_BUSINESSDOCUMENT_CREATEF. But it is giving me sy-subrc 4(ERROR_KPRO). Can anyone explain how to correct this and if u have any better code to attach files to BO's pls post it here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is my code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA : files LIkE BAPIFILES OCCURS 1 WITH header line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;files-doc_count = '1'.&lt;/P&gt;&lt;P&gt;files-directory = 'C:\Documents and Settings\e529015\Desktop\'.&lt;/P&gt;&lt;P&gt;files-filename = 'layout.jpeg'.&lt;/P&gt;&lt;P&gt;APPEND files.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: lv_logsys type TBDLS-LOGSYS.&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                   = lv_logsys&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;          .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt; MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO&lt;/P&gt;&lt;P&gt;         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'BDS_BUSINESSDOCUMENT_CREATEF'&lt;/P&gt;&lt;P&gt;  EXPORTING&lt;/P&gt;&lt;P&gt;   LOGICAL_SYSTEM        = lv_logsys&lt;/P&gt;&lt;P&gt;    classname             = 'BUS2038'&lt;/P&gt;&lt;P&gt;    classtype             = 'BO'&lt;/P&gt;&lt;P&gt;   CLIENT                = SY-MANDT&lt;/P&gt;&lt;P&gt;   OBJECT_KEY            = '300023662'&lt;/P&gt;&lt;P&gt;  tables&lt;/P&gt;&lt;P&gt;    files                 = files&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  SIGNATURE             =&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt; EXCEPTIONS&lt;/P&gt;&lt;P&gt;   NOTHING_FOUND         = 1&lt;/P&gt;&lt;P&gt;   PARAMETER_ERROR       = 2&lt;/P&gt;&lt;P&gt;   NOT_ALLOWED           = 3&lt;/P&gt;&lt;P&gt;   ERROR_KPRO            = 4&lt;/P&gt;&lt;P&gt;   INTERNAL_ERROR        = 5&lt;/P&gt;&lt;P&gt;   NOT_AUTHORIZED        = 6&lt;/P&gt;&lt;P&gt;   OTHERS                = 7&lt;/P&gt;&lt;P&gt;          .&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;Best Regards,&lt;/P&gt;&lt;P&gt;Pavan Jhawar.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Feb 2012 04:40:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/creating-attachments-from-services-for-objects/m-p/8526844#M1656349</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-02-22T04:40:49Z</dc:date>
    </item>
    <item>
      <title>Re: Creating attachments from Services for Objects</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/creating-attachments-from-services-for-objects/m-p/8526845#M1656350</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check this code...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: NUMBER_ATTACH TYPE i.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="7" type="ul"&gt;&lt;P&gt;Data Declaration for attachment ********&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;data: go_myobject type ref to cl_gos_manager.&lt;/P&gt;&lt;P&gt;data: lo_container type ref to cl_gui_custom_container,&lt;/P&gt;&lt;P&gt;      ls_object type borident.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MODULE ATTACH_FILE input.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if ok_code = 'CATC'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF ZQTHD-JNAME is not initial.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*******Number Ranges For ATTACHMENT ********&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  if zqthd-objectkey is initial.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'NUMBER_GET_NEXT'&lt;/P&gt;&lt;P&gt;  EXPORTING&lt;/P&gt;&lt;P&gt;    NR_RANGE_NR                   = '1'&lt;/P&gt;&lt;P&gt;    OBJECT                        = 'ZATTACH_NR'&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  QUANTITY                      = '1'&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  SUBOBJECT                     = ' '&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  TOYEAR                        = '0000'&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  IGNORE_BUFFER                 = ' '&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt; IMPORTING&lt;/P&gt;&lt;P&gt;   NUMBER                        = NUMBER_ATTACH&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  QUANTITY                      =&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  RETURNCODE                    =&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;EXCEPTIONS&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  INTERVAL_NOT_FOUND            = 1&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  NUMBER_RANGE_NOT_INTERN       = 2&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  OBJECT_NOT_FOUND              = 3&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  QUANTITY_IS_0                 = 4&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  QUANTITY_IS_NOT_1             = 5&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  INTERVAL_OVERFLOW             = 6&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  BUFFER_OVERFLOW               = 7&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  OTHERS                        = 8&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;          .&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;&lt;/P&gt;&lt;P&gt;   endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  zqthd-objectkey = NUMBER_ATTACH.&lt;/P&gt;&lt;P&gt;  ls_object-objtype = 'ZQUOTATION'.&lt;/P&gt;&lt;P&gt;  ls_object-objkey  = zqthd-objectkey.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  call method go_myobject-&amp;gt;start_service_direct&lt;/P&gt;&lt;P&gt;                exporting&lt;/P&gt;&lt;P&gt;                      ip_service = 'PCATTA_CREA'&lt;/P&gt;&lt;P&gt;                      is_object = ls_object&lt;/P&gt;&lt;P&gt;                      io_container = lo_container.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; ENDIF.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Feb 2012 04:45:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/creating-attachments-from-services-for-objects/m-p/8526845#M1656350</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-02-22T04:45:25Z</dc:date>
    </item>
    <item>
      <title>Re: Creating attachments from Services for Objects</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/creating-attachments-from-services-for-objects/m-p/8526846#M1656351</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ravi,&lt;/P&gt;&lt;P&gt; Thanks for the reply but when i am using this i am getting short dump saying&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Runtime Errors         OBJECTS_OBJREF_NOT_ASSIGNED&lt;/P&gt;&lt;P&gt;Except.                CX_SY_REF_IS_INITIAL&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   Access via 'NULL' object reference not possible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;any idea how to correct this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Pavan Jhawar.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Feb 2012 06:19:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/creating-attachments-from-services-for-objects/m-p/8526846#M1656351</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-02-22T06:19:53Z</dc:date>
    </item>
    <item>
      <title>Re: Creating attachments from Services for Objects</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/creating-attachments-from-services-for-objects/m-p/8526847#M1656352</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The dump issue is solved, but from my program i am selecting the file in pop up and at the end it shows attachment saved successfully but when i check in the document it is not there. &lt;/P&gt;&lt;P&gt;Any idea.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below is my code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: go_myobject type ref to cl_gos_manager.&lt;/P&gt;&lt;P&gt;data: lo_container type ref to cl_gui_custom_container,&lt;/P&gt;&lt;P&gt;      ls_object type borident.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ls_object-objtype = 'BUS2080'.&lt;/P&gt;&lt;P&gt;ls_object-objkey = '300023662'.&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                   = ls_object-logsys&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;          .&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;Implement suitable error handling here&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;data:  lp_no_commit TYPE        sgs_cmode.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CREATE OBJECT go_myobject&lt;/P&gt;&lt;P&gt;  EXPORTING&lt;/P&gt;&lt;P&gt;    is_object        = ls_object&lt;/P&gt;&lt;P&gt;    ip_no_commit     = lp_no_commit&lt;/P&gt;&lt;P&gt;  EXCEPTIONS&lt;/P&gt;&lt;P&gt;    object_invalid   = 1&lt;/P&gt;&lt;P&gt;    callback_invalid = 2&lt;/P&gt;&lt;P&gt;    others           = 3&lt;/P&gt;&lt;P&gt;    .&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;CALL METHOD go_myobject-&amp;gt;start_service_direct&lt;/P&gt;&lt;P&gt;  EXPORTING&lt;/P&gt;&lt;P&gt;    ip_service         = 'PCATTA_CREA'&lt;/P&gt;&lt;P&gt;    is_object          = ls_object&lt;/P&gt;&lt;P&gt;    io_container       = lo_container&lt;/P&gt;&lt;P&gt;  EXCEPTIONS&lt;/P&gt;&lt;P&gt;    no_object          = 1&lt;/P&gt;&lt;P&gt;    object_invalid     = 2&lt;/P&gt;&lt;P&gt;    execution_failed   = 3&lt;/P&gt;&lt;P&gt;    others             = 4&lt;/P&gt;&lt;P&gt;        .&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;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Pavan Jhawar.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Feb 2012 06:43:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/creating-attachments-from-services-for-objects/m-p/8526847#M1656352</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-02-22T06:43:52Z</dc:date>
    </item>
    <item>
      <title>Re: Creating attachments from Services for Objects</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/creating-attachments-from-services-for-objects/m-p/8526848#M1656353</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI,&lt;/P&gt;&lt;P&gt;It is working fine now. But i have one more requirement. The present code asks the file to pick from presentation server. Is there anyway to get the file from application server and attach it to the business object.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Pavan Jhawar.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Feb 2012 08:29:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/creating-attachments-from-services-for-objects/m-p/8526848#M1656353</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-02-22T08:29:16Z</dc:date>
    </item>
  </channel>
</rss>

