‎2013 Apr 08 9:07 AM
Hello Team,
Can u please just how to upload a document file (.DOC file ) into SAP using gui_upload .I tried using ASC type and BIN ..It appears with symbols into internal table..
Please suggest.
Regards,
Geeta
‎2013 Apr 08 10:07 AM
‎2013 Apr 08 10:19 AM
Hai,
Thanks for your reply .. but i am not able to open the second link.
1st link says for uploading Excel file..i need to upload a document .its not working for a document file.
Regards
Geeta
‎2013 Apr 08 10:24 AM
Hi, @geeta ,
You can try like this thread
https://scn.sap.com/thread/260900
You can try also concept of GOS in sap.
Also check this class & its methods
CL_ISHMED_DOC_WORD_DATA.
Try it.
Thanks
Gourav.
‎2013 Apr 08 11:20 AM
Hai kumar,
Thanks for your answer...will try this and see.
Regards,
Geeta
‎2013 Apr 08 10:36 AM
Hi Geetha.......
To upload a word-document in the native word format it is the best to do this directly in binary format (BIN). Important here is to take the binary_file size back from the gui_upload ( u can use either function module / cl_gui_frontend_services). Uploading it directly in binary format avoids later conversion.
For conversion to xstring and back from xstring to binary table you can use function modules SCMS_BINARY_TO_XSTRING and SCMS_XSTRING_TO_BINARY.
Try this u can get the result
Thanks & Regards
G.Kranthi Kumar Reddy.
‎2013 Apr 08 12:03 PM
Hi Kranthi,
As u said,first using bin type we should upload doc file in gui_upload then should use this 2 FM SCMS_BINARY_TO_XSTRING and SCMS_XSTRING_TO_BINARY.
Is it correct.
Regards,
Geeta
‎2013 Apr 08 1:19 PM
Dear Geetha u are right ,
First upload the Doc into itab ,
and then declare a xstring variable as xstring , import this throw buffer which for the 1st FM ,
and Export this buffer value into 2nd FM.
U can find full at Debugging....
thanks & Regards
Kranthi Kumar Reddy
🙂
‎2013 Apr 09 8:17 AM
Hai kranthi,
I tried the way you said but after the second FM , I got some symbols into internal table.
Regards,
Geeta
‎2013 Apr 09 10:05 AM
Dear geetha ,
R U Uploading the file with .doc or .docx ,
Please Check,
Because now a days some people using either Office 2003 or 2007
Thanks & Rgds,
Kranthi
‎2013 Apr 09 10:57 AM
Hai Kranthi,
I am uploading document with .doc only..
Regards,
Geeta
‎2013 Apr 08 11:54 AM
Hello geeta,
use filetype RAW instead of ASC and BIN.
Thanks
Sabyasachi
‎2013 Apr 08 12:15 PM
hello karforma ,
Please check ur answer before posting...
if we use ur answer it throws illegal error.
Plz check
Thanks,
Kranthi
‎2013 Apr 09 8:45 AM
Hi Geeta,
Could you just go through this program SAPRDEMO_FORM_INTERFACE.
The same is given in this thread : http://scn.sap.com/thread/1656176
Thanks,
Namrata
‎2013 Apr 09 12:12 PM
Team,
Please suggest any other way to upload a .doc file into sap .
Regards,
Geeta
‎2013 Apr 10 8:04 AM
Dear Geetha,
Have u tried this..
DATA : V_BUFFER TYPE XSTRING.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = v_file
FILETYPE = 'BIN'
* HAS_FIELD_SEPARATOR = ' '
* HEADER_LENGTH = 0
* READ_BY_LINE = 'X'
* DAT_MODE = ' '
* CODEPAGE = ' '
* IGNORE_CERR = ABAP_TRUE
* REPLACEMENT = '#'
* CHECK_BOM = ' '
* VIRUS_SCAN_PROFILE =
* NO_AUTH_CHECK = ' '
* IMPORTING
* FILELENGTH =
* HEADER =
tables
data_tab = IT_FILE
* EXCEPTIONS
* FILE_OPEN_ERROR = 1
* FILE_READ_ERROR = 2
* NO_BATCH = 3
* GUI_REFUSE_FILETRANSFER = 4
* INVALID_TYPE = 5
* NO_AUTHORITY = 6
* UNKNOWN_ERROR = 7
* BAD_DATA_FORMAT = 8
* HEADER_NOT_ALLOWED = 9
* SEPARATOR_NOT_ALLOWED = 10
* HEADER_TOO_LONG = 11
* UNKNOWN_DP_ERROR = 12
* ACCESS_DENIED = 13
* DP_OUT_OF_MEMORY = 14
* DISK_FULL = 15
* DP_TIMEOUT = 16
* OTHERS = 17
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
EXPORTING
input_length = 7
FIRST_LINE = 1
LAST_LINE = 1
IMPORTING
BUFFER = V_BUFFER
TABLES
binary_tab = it_file
* EXCEPTIONS
* FAILED = 1
* OTHERS = 2
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = V_BUFFER
* APPEND_TO_TABLE = 'X'
* IMPORTING
* OUTPUT_LENGTH =
*
tables
binary_tab = IT_FILE
.
Here it_file is document file itab
Thanks & Regards
G.Kranthi