2013 Dec 04 12:35 PM
Hi,
I have a requirement to send GOS "IMAGE" attachment uploaded via QM01/02/03 via email to vendor.
I have used FM 'SO_OBJECT_READ' and i am able to attach image in mail and send.
But my when i open attachment in SOST and via MAIL it is showing No Preview Available.
Please help me here.
I have a urgent requirement.
Thanks,
Riya
2013 Dec 04 3:33 PM
Hi Riya,
When do you attach a file using GOS, this file is save on table SRGBTBREL.
You can use the method DISPLAY_ATTACHMENT of cl_gos_document_service class for display the attached file on GOS.
Do you can get this file using the method:
Use this method and FM
call method cl_binary_relation=>read_links
exporting
is_object = gs_lpor
it_relation_options = lt_relat
importing
et_links = t_links.
MOVE s_links-instid_b TO lv_document_id.
* Read the data
CALL FUNCTION 'SO_DOCUMENT_READ_API1'
EXPORTING
document_id = lv_document_id
IMPORTING
document_data = lwa_document_data
TABLES
contents_hex = lt_hex
object_content = lt_content
EXCEPTIONS
document_id_not_exist = 1
operation_no_authorization = 2
x_error = 3
OTHERS = 4.
Use class for send the email with your attachment(doc, xls, jpeg, etc.)
cl_document_bcs, cl_bcs,
Regards,
2013 Dec 04 12:52 PM
2013 Dec 04 12:54 PM
2013 Dec 04 12:59 PM
2013 Dec 04 2:45 PM
Hi,
I dont want to add image in mail body, rather i want to sent images as attachment via email.
Can anyone let me know is SO_OBJECT_READ can read image?
Or do any other FM reads images from Generic Object Services(GOS)?
Please help here.
Thanks.
2013 Dec 04 3:33 PM
Hi Riya,
When do you attach a file using GOS, this file is save on table SRGBTBREL.
You can use the method DISPLAY_ATTACHMENT of cl_gos_document_service class for display the attached file on GOS.
Do you can get this file using the method:
Use this method and FM
call method cl_binary_relation=>read_links
exporting
is_object = gs_lpor
it_relation_options = lt_relat
importing
et_links = t_links.
MOVE s_links-instid_b TO lv_document_id.
* Read the data
CALL FUNCTION 'SO_DOCUMENT_READ_API1'
EXPORTING
document_id = lv_document_id
IMPORTING
document_data = lwa_document_data
TABLES
contents_hex = lt_hex
object_content = lt_content
EXCEPTIONS
document_id_not_exist = 1
operation_no_authorization = 2
x_error = 3
OTHERS = 4.
Use class for send the email with your attachment(doc, xls, jpeg, etc.)
cl_document_bcs, cl_bcs,
Regards,
2013 Dec 04 4:19 PM
Hi David,
You mentioned below sentence:
"You can use the method DISPLAY_ATTACHMENT of cl_gos_document_service class for display the attached file on GOS."
"Use class for send the email with your attachment(doc, xls, jpeg, etc.)
cl_document_bcs, cl_bcs,"
Can you please give more details on this.
2013 Dec 05 6:14 AM
Hi David,
I have used cl_binary_relation=>read_links and function SO_DOCUMENT_READ_API1
and passed attachment to FM SO_DOCUMENT_READ_API1 to send mail.
But again when i open image it shows "No Preview Available".
Please help.
2013 Dec 05 9:27 AM
Please any inputs on this?
How to read BMP attachments from GOS?
2013 Dec 05 10:12 AM
Hi,
a part of example :
* Alimentation de la clef.
MOVE : 'I' TO is_role-sign ,
'EQ' TO is_role-option ,
'GOSAPPLOBJ' TO is_role-low.
APPEND is_role TO it_roles.
MOVE : 'I' TO is_relation-sign ,
'EQ' TO is_relation-option ,
'ATTA' TO is_relation-low .
APPEND is_relation TO it_relations.
MOVE : 'BIN' TO w_file_type.
* Extraction des liens.
TRY.
CALL METHOD cl_binary_relation=>read_links_of_objects
EXPORTING
it_objects = it_objects
it_role_options = it_roles
it_relation_options = it_relations
IMPORTING
et_links_a = it_link.
CATCH cx_obl_model_error.
CATCH cx_obl_parameter_error.
CATCH cx_obl_internal_error.
ENDTRY.
* Boucle sur les docs.
MOVE w_cpt TO w_num.
LOOP AT it_link
INTO is_link.
* Petit nom
MOVE is_link-instid_b TO w_doc_id.
MOVE '_' TO w_numc+0(1).
w_num = w_num + 1.
WRITE w_num+1(2) TO w_numc+1(2).
* Extraction du contenu.
CALL FUNCTION 'SO_DOCUMENT_READ_API1'
EXPORTING
document_id = w_doc_id
IMPORTING
document_data = is_doc_data
TABLES
contents_hex = it_contentx
EXCEPTIONS
document_id_not_exist = 1
operation_no_authorization = 2
x_error = 3
OTHERS = 4.
CONCATENATE is_cert-vbdpl-charg
w_numc
'.'
is_doc_data-obj_type
INTO w_file.
CONCATENATE is_cert-vbdpl-charg
w_numc
'.'
is_doc_data-obj_type
INTO w_content_id.
CLEAR w_content_type.
w_obj_len = is_doc_data-doc_size.
CALL METHOD obj_doc->add_attachment
EXPORTING
i_attachment_type = is_doc_data-obj_type
i_attachment_subject = w_file
i_attachment_size = w_obj_len
i_att_content_hex = it_contentx.
regards
Fred
2013 Dec 05 10:59 AM
Hi,
I am trying this method.
Where to specify email id? Any FM or class to be called after calling METHOD obj_doc->add_attachment?
Also i am getting error as it_contentx is not type compatible with formal parameter i_att_content_hex .
I have declared it_contentx as type solix occurs 0 with header line.
Please suggest.
2013 Dec 05 12:31 PM
2013 Dec 06 7:12 AM
Hi,
Can anyone guide me how to convert jpeg into pdf in sap.
Thanks.
2013 Dec 06 8:43 AM
Hi,
you can't you have to use an external program like ImageMagick
regards
Fred
2013 Dec 09 6:37 AM
My problem got resolved.
I have used CL_BCS class.
For reference: https://scn.sap.com/thread/3466624
Thanks for all your replies.
2013 Dec 09 7:29 AM
Hi Riya,
if you could post a little explanation for people who will have the same issue
regards
Fred
2019 Nov 11 10:21 AM
Thank you so much David and Fred. I solved my issue. I'm so happy, now.
2013 Dec 04 4:10 PM
2024 May 21 2:32 PM
Hi Riya,
I have a urgent requirement.
Can you send me the solution how you solved the problem i have the same requirement .could you please help
Thanks
Vijay