2014 Aug 20 7:57 AM
Hi All,
I am trying to populate pdf from sap server to different server. when i am trying to open that pdf in target system , getting the error " root object is missing or invalid " here is my code :
CALL FUNCTION 'HTTP_SCRAMBLE'
EXPORTING
source = p_pwd
sourcelen = lv_pwd_len
key = lc_key
IMPORTING
destination = p_pwd.
* connect to FTP server
CALL FUNCTION 'FTP_CONNECT'
EXPORTING
user = p_user
password = p_pwd
* ACCOUNT =
host = p_ip
rfc_destination = lc_rfc_dest
* GATEWAY_USER =
* GATEWAY_PASSWORD =
* GATEWAY_HOST =
IMPORTING
handle = lv_handle
* EXCEPTIONS
* NOT_CONNECTED = 1
* OTHERS = 2
.
IF sy-subrc <> 0.
l_fail = 'X'.
WRITE : / 'FTP Connection failed'.
EXIT.
ENDIF.
CALL FUNCTION 'FTP_COMMAND'
EXPORTING
handle = lv_handle
command = 'cd /Payadvice '"lv_cmd
compress = 'N'
* RFC_DESTINATION = lc_rfc_dest "sapftpa
* VERIFY =
* IMPORTING
* FILESIZE =
* FILEDATE =
* FILETIME =
TABLES
data = it_output
EXCEPTIONS
tcpip_error = 1
command_error = 2
data_error = 3
OTHERS = 4
.
IF sy-subrc NE 0.
l_fail = 'X'.
EXIT.
ENDIF.
CLEAR l_fail.
CALL FUNCTION 'FTP_COMMAND'
EXPORTING
HANDLE = lv_handle
command = 'binary'
tables
data = it_lines
EXCEPTIONS
TCPIP_ERROR = 1
COMMAND_ERROR = 2
DATA_ERROR = 3
OTHERS = 4
.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
CLEAR wa_result.
CONCATENATE v_name '.pdf' INTO wa_result.
DATA: l_count TYPE i.
CALL FUNCTION 'FTP_R3_TO_SERVER'
EXPORTING
handle = lv_handle
fname = wa_result
* blob_length = l_count
character_mode = 'X'
TABLES
* BLOB =
text = it_lines"it_tmp
EXCEPTIONS
tcpip_error = 1
command_error = 2
data_error = 3
OTHERS = 4.
IF sy-subrc NE 0.
l_fail = 'X'.
EXIT.
endif.
clear insfile.
CONCATENATE 'put' wa_result INTO insfile SEPARATED BY space.
CALL FUNCTION 'FTP_COMMAND'
EXPORTING
HANDLE = lv_handle
command = insfile
* COMPRESS = 'N'
* RFC_DESTINATION =
* VERIFY =
* IMPORTING
* FILESIZE =
* FILEDATE =
* FILETIME =
tables
data = it_lines
EXCEPTIONS
TCPIP_ERROR = 1
COMMAND_ERROR = 2
DATA_ERROR = 3
OTHERS = 4 .
IF sy-subrc NE 0.
l_fail = 'X'.
EXIT.
ELSE.
UPDATE zwork_to_sapvenp SET flag1 = 'X' WHERE inv_act_doc = lv_name.
IF sy-subrc = 0.
ENDIF.
ENDIF.
*ftp disconnect
CALL FUNCTION 'FTP_DISCONNECT'
EXPORTING
handle = lv_handle.
CALL FUNCTION 'RFC_CONNECTION_CLOSE'
EXPORTING
destination = lc_rfc_dest
* TASKNAME =
* EXCEPTIONS
* DESTINATION_NOT_OPEN = 1
* OTHERS = 2
.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
here "put" command is not working properly getting command error . please help.
Hi All,
I am trying to populate pdf from sap server to different server. when i am trying to open that pdf in target system , getting the error " root object is missing or invalid " here is my code :
CALL FUNCTION 'HTTP_SCRAMBLE'
EXPORTING
source = p_pwd
sourcelen = lv_pwd_len
key = lc_key
IMPORTING
destination = p_pwd.
* connect to FTP server
CALL FUNCTION 'FTP_CONNECT'
EXPORTING
user = p_user
password = p_pwd
* ACCOUNT =
host = p_ip
rfc_destination = lc_rfc_dest
* GATEWAY_USER =
* GATEWAY_PASSWORD =
* GATEWAY_HOST =
IMPORTING
handle = lv_handle
* EXCEPTIONS
* NOT_CONNECTED = 1
* OTHERS = 2
.
IF sy-subrc <> 0.
l_fail = 'X'.
WRITE : / 'FTP Connection failed'.
EXIT.
ENDIF.
CALL FUNCTION 'FTP_COMMAND'
EXPORTING
handle = lv_handle
command = 'cd /Payadvice '"lv_cmd
compress = 'N'
* RFC_DESTINATION = lc_rfc_dest "sapftpa
* VERIFY =
* IMPORTING
* FILESIZE =
* FILEDATE =
* FILETIME =
TABLES
data = it_output
EXCEPTIONS
tcpip_error = 1
command_error = 2
data_error = 3
OTHERS = 4
.
IF sy-subrc NE 0.
l_fail = 'X'.
EXIT.
ENDIF.
CLEAR l_fail.
CALL FUNCTION 'FTP_COMMAND'
EXPORTING
HANDLE = lv_handle
command = 'binary'
tables
data = it_lines
EXCEPTIONS
TCPIP_ERROR = 1
COMMAND_ERROR = 2
DATA_ERROR = 3
OTHERS = 4
.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
CLEAR wa_result.
CONCATENATE v_name '.pdf' INTO wa_result.
DATA: l_count TYPE i.
CALL FUNCTION 'FTP_R3_TO_SERVER'
EXPORTING
handle = lv_handle
fname = wa_result
* blob_length = l_count
character_mode = 'X'
TABLES
* BLOB =
text = it_lines"it_tmp
EXCEPTIONS
tcpip_error = 1
command_error = 2
data_error = 3
OTHERS = 4.
IF sy-subrc NE 0.
l_fail = 'X'.
EXIT.
endif.
clear insfile.
CONCATENATE 'put' wa_result INTO insfile SEPARATED BY space.
CALL FUNCTION 'FTP_COMMAND'
EXPORTING
HANDLE = lv_handle
command = insfile
* COMPRESS = 'N'
* RFC_DESTINATION =
* VERIFY =
* IMPORTING
* FILESIZE =
* FILEDATE =
* FILETIME =
tables
data = it_lines
EXCEPTIONS
TCPIP_ERROR = 1
COMMAND_ERROR = 2
DATA_ERROR = 3
OTHERS = 4 .
IF sy-subrc NE 0.
l_fail = 'X'.
EXIT.
ELSE.
UPDATE zwork_to_sapvenp SET flag1 = 'X' WHERE inv_act_doc = lv_name.
IF sy-subrc = 0.
ENDIF.
ENDIF.
*ftp disconnect
CALL FUNCTION 'FTP_DISCONNECT'
EXPORTING
handle = lv_handle.
CALL FUNCTION 'RFC_CONNECTION_CLOSE'
EXPORTING
destination = lc_rfc_dest
* TASKNAME =
* EXCEPTIONS
* DESTINATION_NOT_OPEN = 1
* OTHERS = 2
.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
here "put" command is not working properly getting command error . please help.
2014 Aug 20 8:14 AM
Please post the data declaration for your variables: insfile & it_lines.
Also, there is a sap standard program RSFTP003 which is a demo for this PUT command so maybe go thru this code and see how it is done.
Hope this helps.
2014 Aug 20 8:21 AM
it_lines TYPE STANDARD TABLE OF tline WITH HEADER LINE.
insfile TYPE text ,
2014 Aug 20 8:29 AM
I think something wrong with your declarations, try same as std program i sent you.
2014 Aug 21 8:35 AM
I tried as the standard prog but still put command is not working.