2018 Oct 02 5:38 PM
As per the class and method ( cl_fitv_gos=>save )mentioned in the Erik Mertens's answer for attaching the document to Notification in SAP PM i am trying to replicate the same, and i have picked my document and using (cl_gui_frontend_services=>gui_upload) i have converted my document into Binary and then converted into Xstring. But while using the class (cl_fitv_gos=>save) i am getting error message saying that (Folders cannot be sent) Type (E) ID (SO) and Number (067). Any help for correct use of this method will be highly appreciated.
Regards,
Pradeep
2018 Oct 03 7:59 PM
2018 Oct 05 8:55 AM
c436ae948d684935a91fce8b976e5aa7 Thanks for your reply. This is complete code which i have used for my requirement.
DATA: lr_mime_rep TYPE REF TO if_mr_api.
DATA: lv_filename TYPE string.
DATA: lv_path TYPE string.
DATA: lv_fullpath TYPE string.
DATA: lv_content TYPE xstring.
DATA: lv_length TYPE i.
DATA: lv_rc TYPE sy-subrc.
DATA: lt_file TYPE filetable.
DATA: ls_file LIKE LINE OF lt_file.
DATA: lv_notif TYPE qmnum,
lv_objtyp TYPE so_obj_tp.
DATA: lt_data TYPE STANDARD TABLE OF x255,
ls_porb TYPE sibflporb,
lv_name TYPE string,
lt_message TYPE bapirettab.
* ------------------------------------------------------SO_DOCUMENT_INSERT_API1 Declaration------------------------------------------------
* -----------------------------------------------------SO_DOCUMENT_INSERT_API1----------------------------------------------
cl_gui_frontend_services=>file_open_dialog(
CHANGING
file_table = lt_file " Table Holding Selected Files
rc = lv_rc ). " Return Code, Number of Files or -1 If Error Occurred
READ TABLE lt_file INTO ls_file INDEX 1.
IF sy-subrc = 0.
lv_filename = ls_file-filename.
ENDIF.
cl_gui_frontend_services=>gui_upload(
EXPORTING
filename = lv_filename " Name of file
filetype = 'BIN'
IMPORTING
filelength = lv_length " File length
CHANGING
data_tab = lt_data " Transfer table for file contents
EXCEPTIONS
OTHERS = 19 ).
CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
EXPORTING
input_length = lv_length
* first_line = 0
* last_line = 0
IMPORTING
buffer = lv_content
TABLES
binary_tab = lt_data
EXCEPTIONS
failed = 1
OTHERS = 2.
* hardcoding the notification number-------------------------
lv_name = 'Tiger'.
lv_notif = '300003937'.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = lv_notif
IMPORTING
output = lv_notif.
ls_porb-instid = lv_notif.
ls_porb-typeid = 'BUS2080'.
ls_porb-catid = 'BO'.
lv_objtyp = 'EXT'.
CALL METHOD cl_fitv_gos=>save
EXPORTING
iv_name = lv_name
* iv_content =
iv_content_hex = lv_content
is_lporb = ls_porb
iv_objtp = lv_objtyp
* iv_commit_on =
RECEIVING
rt_messages = lt_message.
Please guide me if Xstring converted from the binary image file can be attached by cl_fitv_gos=>save
Regards,
Pradeep
2018 Oct 05 1:12 PM
Have you looked at business object BUS2007? Plant maintenance order? I'm not sure about which object type that would be. It probably is EXT - PC document. Another thought what type of document are you uploading?
2024 Mar 08 5:59 AM
En el nombre debes de poner la extension del archivo por ejemplo .gif para imagenes
lv_name = 'Tiger'.gif.