2016 Feb 18 6:41 AM
Hi All,
I have developed a program which reads file contents of DMS file ( Table DMS_DOC_FILES) using function module SCMS_DOC_READ into internal table it_bin[]
it_bin TYPE STANDARD TABLE OF sdokcntbin.
Now I want to convert this binary data of it_bin to internal table which i can use further to create a file on application server.
Please help.
Thanks,
Arpita
2016 Feb 18 9:40 AM
Hi Arpita,
You can use FM : SCMS_BINARY_TO_STRING
if you want the resulting string to be in an itab.
declare a itab type string.
data: stringtab type standard table of string.
append <result string from FM> to stringtab
Please let me know if you need any help in placing a file in Application Server.
Thanks,
Mayuresh
Have you tried to save the file in .TXT format?
Please add extension .TXT to your file name and check.
Regards,
Mayuresh
2016 Feb 18 7:03 AM
2016 Feb 18 9:40 AM
Hi Arpita,
You can use FM : SCMS_BINARY_TO_STRING
if you want the resulting string to be in an itab.
declare a itab type string.
data: stringtab type standard table of string.
append <result string from FM> to stringtab
Please let me know if you need any help in placing a file in Application Server.
Thanks,
Mayuresh
2016 Feb 19 3:08 AM
Thanks Mayuresh for input..
I have called FM SCMS_BINARY_TO_STRING
CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
EXPORTING
input_length = comp_size
IMPORTING
buffer = v_xstring
TABLES
binary_tab = i_bin
EXCEPTIONS
failed = 1
OTHERS = 2.
But Output of this FM is a buffer v_xstring ( Single line).
Can you tell me how to convert this single line of buffer to ITAB.
Thanks,
Arpita
2016 Feb 19 5:17 AM
if you want the resulting string to be in an itab.
declare a itab type xstring.
data: stringtab type standard table of xstring.
append <result string from FM> to stringtab
2016 Feb 19 6:45 AM
Thanks for reply.
now i am trying to create application server file using OPEN DATASET for OUTPUT with data from v_string of following function.
CALL FUNCTION 'SCMS_BINARY_TO_STRING'
EXPORTING
input_length = comp_size
IMPORTING
buffer = v_string
TABLES
binary_tab = i_bin
EXCEPTIONS
failed = 1
OTHERS = 2.
It is creating file but unable to open file. Do you have any idea on how to create similar way?
Thanks,
Arpita
2016 Feb 19 6:54 AM
2016 Feb 19 7:00 AM
Please check your open dataset statement.
OPEN DATASET statement with IN TEXT MODE
Thanks,
Mayuresh
2016 Feb 19 7:50 AM
Thanks
I am using text mode.
Now i am trying to create file in BINARY MODE by passing internal table GT_BIN of
FM 'SCMS_DOC_READ' but now i am getting following error while opening file from AL11
FILE1.PDF is not text file.
2016 Feb 19 8:47 AM
are you placing the file on Application Server in .PDF format?
2016 Feb 19 8:47 AM
Thanks
It is creating file in BINARY MODE but uanble to open file from AL11
2016 Feb 19 8:48 AM
File can be in any format
i tried for PDF and DOC.
It is creating file but not able to open
2016 Feb 19 8:58 AM
Please use Encoding UTF-8 in OPEN DATASET statement as below:
OPEN DATASET FOR OUTPUT IN TEXT MODE ENCODING UTF-8
Regards,
Mayuresh
2016 Feb 19 8:59 AM
Have you tried download the file to PC using CG3Y and then opening it from there?
2016 Feb 19 9:04 AM
2016 Feb 19 9:17 AM
2016 Feb 19 9:28 AM
CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
EXPORTING
input_length = v_info-comp_size
IMPORTING
buffer = v_xstring
TABLES
binary_tab = gt_bin
EXCEPTIONS
failed = 1
OTHERS = 2.
OPEN DATASET p_fname FOR OUTPUT IN BINARY MODE.
TRANSFER lv_xstring TO p_fname.
CLOSE DATASET p_fname.
Above code creating file but not able to open.Please suggest.
2016 Feb 19 9:49 AM
Please use Encoding UTF-8 in OPEN DATASET statement as below:
OPEN DATASET FOR OUTPUT IN TEXT MODE ENCODING UTF-8
Regards,
Mayuresh
2016 Feb 19 9:50 AM
v_xstring or lv_xstring -> type errors only? Is your comp_size filled with file size? Is the size of the file the same in AS after save as in v_info-comp_size?
2016 Feb 19 10:19 AM
It is spelling mistake only.
I am trying to check size of file on AP using FM EPS_GET_FILE_ATTRIBUTES
but getting error read_attributes_failed.
2016 Feb 19 10:35 AM
2016 Feb 19 11:17 AM
2016 Feb 19 11:47 AM
THen what is your sy-subrc after transfer, and do you have any content in xstring?
2016 Feb 19 12:13 PM
SY-SUBRC = 0 after transfer
COMP SIZE = 2256061
GT_BIN[] has 2208 records
v_xstring contains data like 255044462D312E330D25E2E3CFD30D0A342030206F626A0D3C3C
2016 Feb 19 1:50 PM
Then your file shouldn't have length of 0. I cannot say more than: debug open dataset , transfer, close dataset part. As normally when you have xstring and pass it via open dataset then there should be no problem with the file.
2016 Feb 22 9:28 AM
Thanks Łukasz Pęgiel for your help.
I tried with all the possibilities. My file has length of 2256061 ( All files has same length of 2256061) but not able to open and some message popup coming saying that " File abc.PDF is not text file Message no. S1333"
2016 Feb 23 6:26 AM
Have you tried to save the file in .TXT format?
Please add extension .TXT to your file name and check.
Regards,
Mayuresh
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |