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: 

Attachment Document Not opening

former_member213851
Active Contributor
0 Kudos

Hi All,

I have checked multiple SCN threads and tried few solutions but couldn't get excepted outcome.

I am trying to get GOS Document data using FM SO_DOCUMENT_READ_API1. Data outputted by parameter object_content is being used for further processing and attaching document data to VA01 using 'SO_OBJECT_INSERT'.

But attached document file is corrupt and not opening. Can anybody suggest what is missing.

13 REPLIES 13

ziolkowskib
Active Contributor

Hi sachin.adak,
Are you having problems with downloading or uploading the file as after reading your explanation I am not certain?
If the problem is with downloading the file then are you having the same problem when downloading the file in GUI (VA03)?
Regards,
Bartosz

Sandra_Rossi
Active Contributor
0 Kudos

It's just a bug in your [unknown] code.

mateuszadamus
Active Contributor
0 Kudos

Yeap, please share your code used for uploading and attaching the file.


Kind regards,
Mateusz

former_member213851
Active Contributor
0 Kudos

Hi All,

My requirement is to load GOS attachment through custom program. I am fetching attachment details using FM SO_DOCUMENT_READ_API1 . This FM has OBJECT_CONTENT parameter which gives us attachment data.

I am using FM SCMS_BINARY_TO_XSTRING to get XSTRING value and then again passing to 'SCMS_XSTRING_TO_BINARY' to get final table which will be passed to 'SO_DOCUMENT_INSERT' FM parameter OBJCONT_BIN.

Resultant Attachment gets linked to documents but PDF fails to open. I tried passing various sizes in BINLENGTH parameter as per attachment size still it fails.

Please suggest.

Thanks

mateuszadamus
Active Contributor
0 Kudos

Hello sachin.adak

The devil is in the details. If you don't provide your detailed code then there is no chance for anyone to guess what the issue is.

Kind regards,
Mateusz

Sandra_Rossi
Active Contributor
0 Kudos

It seems that you are doing a copy of GOS attachment. If you currently use SO_DOCUMENT_READ_API1 + SO_DOCUMENT_INSERT, why don't you avoid converting the types of parameters by using SO_DOCUMENT_INSERT_API1 instead of SO_DOCUMENT_INSERT?

former_member213851
Active Contributor
0 Kudos

Hi Sandra,

I tried using SO_DOCUMENT_INSERT_API1 but still PDF file is not opening.

Now I am not doing any conversions for Data returned by SO_DOCUMENT_READ_API1. Directly SO_DOCUMENT_READ_API1 gives table OBJECT_CONTENT and same is mapped to OBJECT_CONTENT table of FM SO_DOCUMENT_INSERT_API1.

But still PDF fails to open.

Below standard program is doing the same:

RSSOOT01 - Program for object type SOFM: Office document.

Please suggest.

Sandra_Rossi
Active Contributor
0 Kudos

I don't know what you're doing, but you do it wrong. See Mateusz request.

former_member213851
Active Contributor
0 Kudos

Hi Sandra,

Actually we are migrating GOS attachments data from ECC to S4 system using RFC.

But attachments except TXT are not opening. Here are my findings:

1. We linked 1 PDF file on ECC side manually to Sales Doc. FM SO_DOCUMENT_READ_API1 is used to read the data for that PDF on ECC

--------------------------------------------------------------------------------------------------------------------

2. Now we linked same PDF on S4 side manually to Sales Doc.. FM SO_DOCUMENT_READ_API1 is used to read the data for that PDF on S4 side.

Upon comparing data for the same PDF file attached manually on 2 different system in debug mode, we see there is significant difference. That's the reason attachments data fetched from ECC and uploaded via FM SO_DOCUMENT_INSERT_API1 in S4 corrupts the file.

Could you suggest how can we migrate attachments From ECC to S4 in such cases where data itself is stored in different format by 2 different systems foe same PDF file .

Thanks,

Sandra_Rossi
Active Contributor
0 Kudos

By debug you see a difference, it's just due to your buggy program or to an incorrect analysis. The storage technology of GOS attachments is identical between ECC and S4.

former_member213851
Active Contributor
0 Kudos

Sandra,

I am using stanadrd FM RKC_OFFICE_DOCUMENT_COPY to get PDF data.

Line 32 of this FM has SO_DOCUMENT_READ_API1 that fetches PDF data .

So there is no question of bug in custom program as data is directly being fetched by passing parameters to RKC_OFFICE_DOCUMENT_COPY in SE37.

There is no Custom Code involved at all.


Sandra_Rossi
Active Contributor
0 Kudos

If you don't have custom code, then contact SAP support.

former_member213851
Active Contributor
0 Kudos

SAP is already looking into it since a week. Just thought of discussing on this forum so that if anybody has faced similar issue and found a solution then it will help us to get rid of our issue.