GOS LINK Attachment
GOS LINK Attachment
GOS LINK Attachment
REPORT
ZTEST_VENU3.
PARAMETERS:
p_type TYPE
p_file TYPE
p_desc TYPE
folder_id = ls_fol_id
EXCEPTIONS
OTHERS = 1.
ls_obj_data-objsns = 'O'.
ls_obj_data-objla = sy-langu.
ls_obj_data-objdes = p_desc.
lv_offset = STRLEN( p_file ) - 3.
ls_obj_data-file_ext = p_file+lv_offset(3).
ls_obj_data-objlen = LINES( it_content ) * 255.
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 = it_objhead
objcont = it_content
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 = 0 AND ls_object-objkey IS NOT INITIAL.
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.
ELSE.
MESSAGE 'Not OK' TYPE 'I'.
RETURN.
ENDIF.
IF sy-subrc = 0.
MESSAGE 'OK' TYPE 'I'.
ELSE.
MESSAGE 'Not OK' TYPE 'I'.
ENDIF.
METHOD if_ex_mb_document_badi~mb_document_before_update.
* Internal table declaration
DATA: it_otf
TYPE STANDARD TABLE OF itcoo,
it_docs
TYPE STANDARD TABLE OF docs,
it_lines
TYPE STANDARD TABLE OF tline.
* Declaration of local variables.
DATA:
st_job_output_info
TYPE ssfcrescl,
st_document_output_info TYPE ssfcrespd,
st_job_output_options
TYPE ssfcresop,
st_output_options
TYPE ssfcompop,
st_control_parameters
TYPE ssfctrlop,
v_len_in
TYPE so_obj_len,
*
v_language
TYPE sflangu VALUE 'E',
v_e_devtype
TYPE rspoptype,
v_bin_filesize
TYPE i,
v_name
TYPE string,
v_path
TYPE string,
v_fullpath
TYPE string,
v_filter
TYPE string,
v_uact
TYPE i,
v_guiobj
TYPE REF TO cl_gui_frontend_services,
v_filename
TYPE string,
v_fm_name
TYPE rs38l_fnam.
TYPE
TYPE
CONSTANTS c_formname
ztr_ftr_t,
ztr_adr_t.
TYPE tdsfname VALUE 'ZTR_FTLETTER01'.
IMPORTING
document_output_info
job_output_info
job_output_options
TABLES
it_ftr
it_adr
EXCEPTIONS
formatting_error
internal_error
send_error
user_canceled
OTHERS
IF sy-subrc <> 0.
* Implement suitable error
ENDIF.
= st_document_output_info
= st_job_output_info
= st_job_output_options
= it_ftr
= it_adr
=
=
=
=
=
1
2
3
4
5.
handling here
DATA:lv_objlen
ls_string
TYPE so_obj_len,
TYPE string.
IMPORTING
character_table
= lt_objcont
EXCEPTIONS
no_flat_charlike_structure = 1
OTHERS
= 2.
IF sy-subrc NE 0.
ENDIF.
*Create Folder id.
DATA:ls_folder_id
TYPE soodk.
CALL FUNCTION 'SO_FOLDER_ROOT_ID_GET'
EXPORTING
region
= 'B'
IMPORTING
folder_id = ls_folder_id
EXCEPTIONS
OTHERS
= 1.
IF sy-subrc NE 0.
ENDIF.
* Now Create Attachment.
DATA:
ls_object_id
ls_object_hd_change
TYPE soodk,
TYPE sood1.
ls_object_id = ls_folder_id.
ls_object_hd_change-objlen = lv_objlen.
ls_object_hd_change-objla = sy-langu.
ls_object_hd_change-objdes = 'GRN'.
ls_object_hd_change-file_ext = 'PDF'.
ls_object_hd_change-objnam = 'GRNTEST'.
* Extract object description and extention from filename
DATA:
lv_attach_type
lv_uname
DATA:ls_attach_id
TYPE soodk.
DATA:lt_objhead
TYPE soli_tab.
MOVE sy-uname TO lv_uname.
CALL FUNCTION 'SO_ATTACHMENT_INSERT'
EXPORTING
object_id
= ls_object_id
object_hd_change
= ls_object_hd_change
attach_type
= lv_attach_type
owner
= lv_uname
IMPORTING
attach_id
= ls_attach_id
TABLES
objcont
objhead
EXCEPTIONS
active_user_not_exist
object_type_not_exist
operation_no_authorization
owner_not_exist
parameter_error
substitute_not_active
substitute_not_defined
x_error
system_failure
communication_failure
OTHERS
IF sy-subrc NE 0.
ENDIF.
= lt_objcont
= lt_objhead
=
=
=
=
=
=
=
=
=
=
=
1
2
3
4
5
6
7
8
9
10
11.
INTO ls_obj_roleb-objkey.
ls_obj_rolea-objkey .
*
*
*
*
*
*
*
*
*
*
*