DATA output TYPE update_pdf_dummy .
DATA input TYPE return_update_pdf_sa.
TRY.
DATA(Base64_pdf) = NEW outbound_update_pdf( ).
Base64_pdf->si_outbound_update_pdf_titulos(
EXPORTING
output = output
IMPORTING
input = input ).
CATCH cx_ai_system_fault INTO DATA(system_fault).
BREAK-POINT.
ENDTRY.
DATA twebpdf TYPE string.
DATA fic_binario TYPE xstring.
twebpdf = base64.
CALL FUNCTION 'SSFC_BASE64_DECODE'
EXPORTING
b64data = twebpdf
IMPORTING
bindata = fic_binario.
DATA contents_tb TYPE TABLE OF sdokcntbin.
DATA contents_st TYPE sdokcntbin.
DATA file_length TYPE i.
DATA flag TYPE c.
DATA off TYPE i.
DATA len TYPE i.
DATA file_name TYPE string VALUE '/usr/sap/tmp/'.
TRY.
len = xstrlen( fic_binario ).
file_length = len.
WHILE flag IS INITIAL.
IF len LE 1022.
contents_st-line = fic_binario+off(len).
flag = 'X'.
ELSE.
contents_st-line = fic_binario+off(1022).
off = off + 1022.
len = len - 1022.
ENDIF.
APPEND contents_st TO contents_tb.
ENDWHILE.
CONCATENATE file_name filename INTO file_name.
CONDENSE file_name NO-GAPS.
OPEN DATASET file_name FOR OUTPUT IN BINARY MODE.
LOOP AT contents_tb ASSIGNING FIELD-SYMBOL(<contents_fs>).
TRANSFER <contents_fs> TO file_name.
ENDLOOP.
CLOSE DATASET file_name.
ENDTRY.
DATA content_tb TYPE STANDARD TABLE OF soli.
DATA content_st TYPE soli.
DATA file TYPE string VALUE '/usr/sap/tmp/'.
CONCATENATE file filename INTO file.
OPEN DATASET file FOR INPUT IN BINARY MODE.
WHILE sy-subrc = 0.
READ DATASET file INTO content_st.
APPEND content_st TO content_tb.
ENDWHILE.
CLOSE DATASET file.
CALL FUNCTION 'SO_CONVERT_CONTENTS_BIN'
EXPORTING
it_contents_bin = content_tb[]
IMPORTING
et_contents_bin = content_tb[].
DATA folder_id TYPE soodk.
CALL FUNCTION 'SO_FOLDER_ROOT_ID_GET'
EXPORTING
region = 'B' “Privado
IMPORTING
folder_id = folder_id
EXCEPTIONS
communication_failure = 1
owner_not_exist = 2
system_failure = 3
x_error = 4
OTHERS = 5.
DATA objhead_tb TYPE STANDARD TABLE OF soli.
DATA file_name TYPE c LENGTH 100.
DATA extension TYPE c LENGTH 4.
CALL FUNCTION 'CH_SPLIT_FILENAME'
EXPORTING
complete_filename = file
IMPORTING
extension = extension
name_with_ext = file_name
EXCEPTIONS
invalid_drive = 1
invalid_path = 2
OTHERS = 3.
IF sy-subrc EQ 0.
APPEND INITIAL LINE TO objhead_tb ASSIGNING FIELD-SYMBOL(<objhead_fs>).
CONCATENATE '&SO_FILENAME=' file_name INTO <objhead_fs>.
ENDIF.
DATA content_tb TYPE STANDARD TABLE OF soli.
DATA objhead_tb TYPE STANDARD TABLE OF soli.
DATA object_st TYPE borident.
DATA obj_id TYPE soodk.
DATA content_st TYPE soli.
DATA obj_data_st TYPE sood1.
object_st-objkey = objid.
object_st-objtype = 'BSEG'.“BSEG pq é FBL1N outras transações isso muda
obj_data_st-objsns = 'O'.
obj_data_st-objla = sy-langu.
obj_data_st-objdes = 'Attachment by Thiago'.
obj_data_st-file_ext = extension.
TRANSLATE obj_data_st-file_ext TO UPPER CASE.
obj_data_st-objlen = lines( content_tb ) * 255.
CALL FUNCTION 'SO_OBJECT_INSERT'
EXPORTING
folder_id = folder_id
object_type = 'EXT'
object_hd_change = obj_data_st
IMPORTING
object_id = obj_id
TABLES
objhead = objhead_tb
objcont = content_tb
EXCEPTIONS
active_user_not_exist = 1
communication_failure = 2
component_not_available = 3
dl_name_exist = 4
folder_not_exist = 5
folder_no_authorization = 6
object_type_not_exist = 7
operation_no_authorization = 8
owner_not_exist = 9
parameter_error = 10
substitute_not_active = 11
substitute_not_defined = 12
system_failure = 13
x_error = 14
OTHERS = 15.
DATA folmem_k_st TYPE sofmk.
DATA note_st TYPE borident.
DATA ep_note TYPE borident-objkey.
folmem_k_st-foltp = folder_id-objtp.
folmem_k_st-folyr = folder_id-objyr.
folmem_k_st-folno = folder_id-objno.
folmem_k_st-doctp = folder_id-objtp.
folmem_k_st-docyr = folder_id-objyr.
folmem_k_st-docno = folder_id-objno.
ep_note = folmem_k_st.
note_st-objtype = 'MESSAGE'.
note_st-objkey = ep_note.
CALL FUNCTION 'BINARY_RELATION_CREATE_COMMIT'
EXPORTING
obj_rolea = object_st
obj_roleb = note_st
relationtype = 'ATTA'
EXCEPTIONS
no_model = 1
internal_error = 2
unknown = 3
OTHERS = 4.
IF sy-subrc EQ 0.
COMMIT WORK.
ENDIF.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
3 | |
2 | |
2 | |
2 | |
2 | |
2 | |
1 | |
1 | |
1 | |
1 |