2013 Oct 17 4:13 AM
Hi people !!
I have requeriment that i have spent almost two days without finding a solution.
The users attach some files in GOS in the me21n transaction.
my question is... ¿ how to get these files in abap?.
I have been trying to use the class "cl_gos_document_service" with no succeed
My purpose is:
get the files attached in abap for converting or decoding them in BASE64,
once converted the files in base64, they will be send to another system (xml).
I just need the files to convert them in base 64.
if you have another solution let me know
I hope your help.
Regards
2013 Oct 17 9:07 AM
2013 Oct 17 4:46 AM
Hi,
Check table SRGBTBREL. Also check tables SOOD, SOFM, SOFD. If it is attached at Business Object chances are they are links that open documents from a document repository (Like Documentum, IXOS etc.).
Cheers,
Arindam
2013 Oct 17 5:34 AM
Hi,
So can you tell us exactly what you did try in those 2 days?
I just tried debugging GOS > Attachment List > Export, and ended up in function module SO_DOCUMENT_VIEW_MANAGER with parameter FUNCTION = 'EXPO'.
Perhaps try putting a breakpoint in there.
good luck
Paul
2013 Oct 17 8:44 AM
Hi,
To read GOS Files
Check ur ip_role in your system,means debug ME23N and find the ip_role by setting break at
cl_binary_relation=>read_links_of_binrels.
gs_option-sign = 'I'.
gs_option-option = 'EQ'.
gs_option-low = 'ATTA'.
APPEND gs_option TO gt_options.
gs_option-low = 'NOTE'.
APPEND gs_option TO gt_options.
gs_option-low = 'URL'.
APPEND gs_option TO gt_options.
gv_var = <fs_ekko>-ebeln.
gs_lpor-instid = gv_var.
gs_lpor-typeid = 'TY'.
gs_lpor-catid = 'BO'.
TRY.
CALL METHOD cl_binary_relation=>read_links_of_binrels
EXPORTING
is_object = gs_lpor
it_relation_options = gt_options
ip_role = 'GOSAPPLOBJ'
ip_no_buffer = 'X'
IMPORTING
et_links = et_links.
CATCH cx_obl_parameter_error .
CATCH cx_obl_internal_error .
CATCH cx_obl_model_error .
ENDTRY.
DESCRIBE TABLE et_links.
after that check SOOD table
Regards
2013 Oct 17 8:50 AM
Please check FMs:
BDS_GOS_CONNECTIONS_GET
BDS_BUSINESSDOCUMENT_GET_TAB
Following link may help you:
http://scn.sap.com/thread/447038
Regards
2013 Oct 17 9:07 AM
2013 Oct 17 10:46 AM
Hi Ivan,
Please find the below code which I've used to download the GOS attachments for Material Master.
My requirement is to print the pictures attached in Material Master (MM01/02) on the Smartforms.
For that I've tried with the below code and I was successful in downloading them to my PC.
I am passing the material number from my selection-screen to the program, and the program will download the images if any to my PC and will upload it to SE78 (Graphics Repository for printing in forms).
Hope it will be helpful...
*&---------------------------------------------------------------------*
*& Date : 23/08/2013 *
*& Desc : Report to get the attachment list for the materials *
*& maintainted in the Material Master and download it to the *
*& presentation layer and there by uploading them to SE78 to use*
*& them for printing in Smartforms. *
*&---------------------------------------------------------------------*
REPORT z_example.
DATA: lo_bin_realtion TYPE REF TO cl_binary_relation.
*&---------------------------------------------------------------------*
*& Selection - Screen
*&---------------------------------------------------------------------*
SELECTION-SCREEN: BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
PARAMETERS: p_matnr TYPE mara-matnr.
SELECTION-SCREEN: END OF BLOCK blk1.
* ---- Start-of-Selection
START-OF-SELECTION.
CREATE OBJECT lo_bin_realtion.
PERFORM get_attachments.
*&---------------------------------------------------------------------*
*& Form GET_ATTACHMENTS
*&---------------------------------------------------------------------*
FORM get_attachments .
TYPES : BEGIN OF ty_binary,
binary_field(1000) TYPE c,
END OF ty_binary.
DATA: ls_obj TYPE sibflporb,
ls_reltyp TYPE obl_s_relt,
lt_reltyp TYPE obl_t_relt,
lt_links TYPE obl_t_link,
ls_link TYPE obl_s_link,
lt_roles TYPE obl_t_role,
ls_role TYPE obl_s_role.
DATA: lv_docid TYPE sofolenti1-doc_id,
lt_objhead TYPE TABLE OF solisti1,
lt_objcontent TYPE TABLE OF solisti1,
lt_content TYPE TABLE OF solix,
ls_foldinfo TYPE sofolenti1,
ls_objhead TYPE solisti1,
ls_objcontent TYPE solisti1.
DATA: lv_res TYPE boolean,
lv_sub TYPE so_obj_des,
lt_msg TYPE bcsy_text,
ls_msg TYPE soli,
lt_atta TYPE rmps_t_post_content,
ls_atta TYPE rmps_post_content,
lt_rec TYPE TABLE OF uiys_iusr,
ls_rec TYPE uiys_iusr,
lv_filenm TYPE string,
lv_content TYPE xstring.
DATA: gi_filename TYPE rlgrap-filename,
gi_name TYPE stxbitmaps-tdname,
gi_object TYPE stxbitmaps-tdobject,
gi_id TYPE stxbitmaps-tdid,
gi_btype TYPE stxbitmaps-tdbtype,
gi_resident TYPE stxbitmaps-resident,
gi_autoheight TYPE stxbitmaps-autoheight,
gi_bmcomp TYPE stxbitmaps-bmcomp,
gi_resolution TYPE stxbitmaps-resolution,
l_extension TYPE rlgrap-filename,
l_docid TYPE stxbitmaps-docid.
DATA: hex_tab1 TYPE TABLE OF ty_binary.
* Fill the material related data
ls_obj-instid = p_matnr.
ls_obj-typeid = 'BUS1001006'. "BO for Material Master
ls_obj-catid = 'BO'.
* Specify the type of the attachement
* ATTA - Attachment type
* URL - URL type
ls_reltyp-sign = 'I'.
ls_reltyp-option = 'EQ'.
ls_reltyp-low = 'ATTA'.
APPEND ls_reltyp TO lt_reltyp.
TRY.
CALL METHOD cl_binary_relation=>read_links
EXPORTING
is_object = ls_obj
* ip_logsys =
* it_role_options =
it_relation_options = lt_reltyp
* ip_no_buffer = SPACE
IMPORTING
et_links = lt_links
et_roles = lt_roles.
CATCH cx_obl_parameter_error .
CATCH cx_obl_internal_error .
CATCH cx_obl_model_error .
ENDTRY.
LOOP AT lt_links INTO ls_link.
lv_docid = ls_link-instid_b.
CALL FUNCTION 'SO_DOCUMENT_READ_API1'
EXPORTING
document_id = lv_docid
* FILTER = 'X '
IMPORTING
document_data = ls_foldinfo
TABLES
object_header = lt_objhead
object_content = lt_objcontent
* OBJECT_PARA =
* OBJECT_PARB =
* ATTACHMENT_LIST =
* RECEIVER_LIST =
contents_hex = lt_content
EXCEPTIONS
document_id_not_exist = 1
operation_no_authorization = 2
x_error = 3
OTHERS = 4.
IF sy-subrc = 0.
lv_filenm = 'C:\PHOTOS\IMG1.bmp'.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
* BIN_FILESIZE =
filename = lv_filenm
filetype = 'BIN'
TABLES
data_tab = lt_content
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
OTHERS = 22.
IF sy-subrc = 0.
gi_filename = lv_filenm.
gi_name = 'ZTEST_SIGN'.
gi_object = 'GRAPHICS'.
gi_id = 'BMAP'.
gi_btype = 'BCOL'. "If u want black and white pass BMON
gi_resident = ' '.
gi_autoheight = 'X'.
gi_bmcomp = 'X'.
l_extension = 'BMP'.
PERFORM import_bitmap_bds IN PROGRAM saplstxbitmaps
USING gi_filename
gi_name
gi_object
gi_id
gi_btype
l_extension
' '
gi_resident
gi_autoheight
gi_bmcomp
CHANGING l_docid
gi_resolution.
ENDIF.
ENDIF.
ENDLOOP.
ENDFORM. " GET_ATTACHMENTS
Regards,
Narayana Reddy A V L.
2013 Oct 17 4:04 PM
I am trying not to download the files,
I would like to get them in abap and pass the files inmediately to a FM to encode the files in BASE64.
Is there a way to do that?
thanks for your replies
Regards
2013 Oct 17 11:38 PM
Soooo... what have you already tried and what problems have you encountered?
More information please.
cheers
Paul
2013 Oct 18 5:21 PM
I couldn´t get the files without downloading the files.
so, i had to download the file in the front-end then get the file again and upload it.!!!
after that i finally converted to base64 to send to another system.
2024 Mar 11 9:49 AM