on 03-02-2016 6:39 PM
Hi Ujwal,
The reason your file is getting damaged because it is damaging the PDF Stream,
replace the following code and it might work
DATA lt_pdf TYPE tline_tab.
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = im_xstring
append_to_table = c_x
TABLES
binary_tab = lt_pdf.
CALL FUNCTION 'SX_TABLE_LINE_WIDTH_CHANGE'
TABLES
content_in = lt_pdf
content_out = SOLI_TAB( lt_cont)
EXCEPTIONS
OTHERS = 4.
Regards
Gaurav Ahluwalia
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mallik,
please look into my below code, Im writing it inside a function module . I get XSTRINg value in IM_XSTRINg and sales document in IM_VBELN.
DATA : ls_fol_id TYPE soodk,
ls_obj_id TYPE soodk,
ls_obj_data TYPE sood1,
ls_objhead TYPE soli,
lv_key TYPE swo_typeid,
lv_type TYPE swo_objtyp,
ls_object TYPE borident,
ls_folmem_k TYPE sofmk,
lv_ep_note TYPE borident-objkey,
ls_note TYPE borident,
lv_name TYPE string,
lv_extension TYPE string,
lv_offset TYPE i,
lv_size TYPE i,
lv_temp_len TYPE i,
lv_offset_old TYPE i.
DATA: lt_doc_content TYPE solix_tab,
lt_cont TYPE soli_tab,
lt_objhead TYPE STANDARD TABLE OF soli.
*-----Folder Root
CALL FUNCTION 'SO_FOLDER_ROOT_ID_GET'
EXPORTING
* OWNER = ' '
region = 'B'
IMPORTING
folder_id = ls_fol_id
EXCEPTIONS
communication_failure = 1
owner_not_exist = 2
system_failure = 3
x_error = 4
OTHERS = 5.
CHECK sy-subrc = 0.
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = im_xstring
append_to_table = c_x
TABLES
binary_tab = lt_doc_content.
CALL FUNCTION 'SO_SOLIXTAB_TO_SOLITAB'
EXPORTING
ip_solixtab = lt_doc_content
IMPORTING
ep_solitab = lt_cont.
SPLIT im_fname AT '.' INTO lv_name lv_extension.
TRANSLATE lv_extension TO UPPER CASE .
ls_obj_data-objsns = 'O'.
ls_obj_data-objla = sy-langu.
ls_obj_data-objdes = lv_name .
ls_obj_data-file_ext = lv_extension.
ls_obj_data-objlen = lines( lt_doc_content ) * 255.
* ls_obj_data-objlen = xstrlen( im_xstring ).
CONCATENATE '&SO_FILENAME=' lv_name '.' lv_extension INTO ls_objhead-line.
APPEND ls_objhead TO lt_objhead.
ls_objhead-line = '&SO_FORMAT=BIN'.
APPEND ls_objhead TO lt_objhead.
CALL FUNCTION 'SO_OBJECT_INSERT'
EXPORTING
folder_id = ls_fol_id
object_type = 'EXT'
object_hd_change = ls_obj_data
IMPORTING
object_id = ls_obj_id
TABLES
objhead = lt_objhead
objcont = lt_cont
EXCEPTIONS
active_user_not_exist = 35
folder_not_exist = 6
object_type_not_exist = 17
owner_not_exist = 22
parameter_error = 23
OTHERS = 1000.
IF sy-subrc EQ 0 .
* attach document as GOS attacment to realted bussiness object
ls_object-objkey = im_vbeln.
ls_object-objtype = 'BUS2096'.
ls_folmem_k-foltp = ls_fol_id-objtp.
ls_folmem_k-folyr = ls_fol_id-objyr.
ls_folmem_k-folno = ls_fol_id-objno.
ls_folmem_k-doctp = ls_obj_id-objtp.
ls_folmem_k-docyr = ls_obj_id-objyr.
ls_folmem_k-docno = ls_obj_id-objno.
lv_ep_note = ls_folmem_k.
ls_note-objtype = 'MESSAGE'.
ls_note-objkey = lv_ep_note.
CALL FUNCTION 'BINARY_RELATION_CREATE_COMMIT'
EXPORTING
obj_rolea = ls_object
obj_roleb = ls_note
relationtype = 'ATTA'
EXCEPTIONS
OTHERS = 1.
IF sy-subrc = 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = c_x.
COMMIT WORK.
WAIT UP TO 10 SECONDS.
ENDIF.
ENDIF.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.