2017 Sep 25 8:13 PM
Hi folks.
I want to create a xml file from string variable, this string have xml content. I found this method to save any document in FB03 but selecting a local file:
CALL METHOD obj_gos->create_attachment
I want to create a xml file but with my variable content.
Thanks in advance.
2017 Sep 25 9:23 PM
Simply open a file with OPEN DATASET in BINARY MODE and TRANSFER your string?
2017 Sep 25 9:43 PM
2017 Sep 26 7:18 AM
Try creating document from your xml string with SO_DOCUMENT_INSERT and attach it to FI document with CL_BINARY_RELATION=>CREATE_LINK.
2017 Sep 26 5:29 PM
Hi Raymond.
I found this tutorial and entered this values in parameters:
p_bo : BKPF
p_key : [bukrs][doc number][year]
p_url : www.sdn.sap.com
But in FB03 don't created my attachment.
2017 Sep 27 7:04 AM
Insure you pass correct internal values (some space, or leading zeroes) Also debug your code as the provided sample just catch the errors but don't return any message/clue on errors (from authorization failures to wrong parameter data or type)
2017 Oct 02 4:31 PM
2017 Sep 27 5:05 AM
Hi,
What I understand is you have a variable which has XML data and you need to create an attachment from it.
Can you try using CL_GOS_API->INSERT_AL_ITEM.
Pass the Object details (InstanceId, CategoryId and TypeId) in IS_OBJECT and contents(Filename, AttachmentCategory, Filesize, Content_X, etc.) in IS_ATTCONT and check.
2020 Jun 06 1:25 PM
Hi Ankit,
While trying to attach a .pdf using CL_GOS_API class my attachment category is of ARL(Archive link) type and the insert is not supported for this category yet {SGOS_MSG(E401)}. I would like to know if any OSS notes or alternatives are available to use this API class? My requirement is to create a PDF attachment using GOS and have the document stored at the content server.
2017 Oct 05 6:03 PM
I'm guessing your goal is not to create a "file" but to create a GOS attachment. Those are different things, technically.
FWIW I've dissected the whole GOS process in this blog a while ago. I wouldn't just copy-paste the code since the blog is just very old but the concept explanation is still valid, I believe.
I've used very similar code (again, years ago) to create a program that reads a file into XSTRING variable and then creates a GOS attachment with that data. It works for PDF and XML, code is exactly the same (only the extension is different) since we're dealing with binary data.
1. cl_document_bcs=>xstring_to_solix to convert XSTRING to SOLIX type internal table
2. FM SO_FOLDER_ROOT_ID_GET
3. SO_DOCUMENT_INSERT_API1 (contents_hex = SOLIX type table from step 1; folder_id from step 2)
4. FM BINARY_RELATION_CREATE_COMMIT
Again - I'm not saying you must use these exact FMs (check the class Raymond mentioned instead). This is just an example of what works in our rather old system to outline the steps needed.
2020 Jun 07 3:32 PM
Hi Sumanth sumanth_pyaraka ,
I am not sure of the issue w.r.t PDF object in ARL category type. As far as I remember, generally we can upload PDF types but category type I don't remember. For SAP notes you should search below as a quick search did not reveal me anything.
https://support.sap.com/en/my-support/knowledge-base.html
Thanks.