‎2009 Jan 22 6:34 PM
Hi ,
I need to display the text from 'Object Services' for a Material in a report. The Object type is 'BUS1001' for Material . Users Maintain texts in these Object services in Transaction MM03/MM02. I have to extract and display latest text entered by the user for each material in the Report.
Please let me know, How to extract the Data from Object services?
Any ideas will be rewarded with points.
Thanks
Shekar
‎2009 Jan 22 7:23 PM
Reading form the GOS object would not be a easy task.
Steps would be like:
1. Get the all GOS attachement which are NOTES by calling method CL_BINARY_RELATION=>READ_LINKS providing the Business Object Key
2. Call the FM SO_OBJECT_READ to get the NOTE by providing the Folder and Object information.
Here is the sample code:
REPORT ztest_np_gos_note.
PARAMETERS: p_matnr TYPE mara-matnr.
START-OF-SELECTION.
DATA: gs_lpor TYPE sibflporb.
gs_lpor-instid = p_matnr.
gs_lpor-typeid = 'BUS1001006'.
gs_lpor-catid = 'BO'.
DATA: lt_relat TYPE obl_t_relt,
la_relat LIKE LINE OF lt_relat.
la_relat-sign = 'I'.
la_relat-option = 'EQ'.
la_relat-low = 'NOTE'.
APPEND la_relat TO lt_relat.
DATA: t_links TYPE obl_t_link,
la_links LIKE LINE OF t_links.
DATA: lo_root TYPE REF TO cx_root.
TRY.
CALL METHOD cl_binary_relation=>read_links
EXPORTING
is_object = gs_lpor
it_relation_options = lt_relat
IMPORTING
et_links = t_links.
CATCH cx_root INTO lo_root.
ENDTRY.
DATA l_folder_id TYPE soodk.
DATA l_object_id TYPE soodk.
DATA document_id TYPE sofmk.
READ TABLE t_links INTO la_links INDEX 1.
document_id = la_links-instid_b.
l_folder_id-objtp = document_id-foltp.
l_folder_id-objyr = document_id-folyr.
l_folder_id-objno = document_id-folno.
l_object_id-objtp = document_id-doctp.
l_object_id-objyr = document_id-docyr.
l_object_id-objno = document_id-docno.
DATA document_content TYPE STANDARD TABLE OF soli.
CALL FUNCTION 'SO_OBJECT_READ'
EXPORTING
folder_id = l_folder_id
object_id = l_object_id
TABLES
objcont = document_content
EXCEPTIONS
active_user_not_exist = 1
communication_failure = 2
component_not_available = 3
folder_not_exist = 4
folder_no_authorization = 5
object_not_exist = 6
object_no_authorization = 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.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Regards,
Naimesh Patel
‎2009 Jan 22 7:23 PM
Reading form the GOS object would not be a easy task.
Steps would be like:
1. Get the all GOS attachement which are NOTES by calling method CL_BINARY_RELATION=>READ_LINKS providing the Business Object Key
2. Call the FM SO_OBJECT_READ to get the NOTE by providing the Folder and Object information.
Here is the sample code:
REPORT ztest_np_gos_note.
PARAMETERS: p_matnr TYPE mara-matnr.
START-OF-SELECTION.
DATA: gs_lpor TYPE sibflporb.
gs_lpor-instid = p_matnr.
gs_lpor-typeid = 'BUS1001006'.
gs_lpor-catid = 'BO'.
DATA: lt_relat TYPE obl_t_relt,
la_relat LIKE LINE OF lt_relat.
la_relat-sign = 'I'.
la_relat-option = 'EQ'.
la_relat-low = 'NOTE'.
APPEND la_relat TO lt_relat.
DATA: t_links TYPE obl_t_link,
la_links LIKE LINE OF t_links.
DATA: lo_root TYPE REF TO cx_root.
TRY.
CALL METHOD cl_binary_relation=>read_links
EXPORTING
is_object = gs_lpor
it_relation_options = lt_relat
IMPORTING
et_links = t_links.
CATCH cx_root INTO lo_root.
ENDTRY.
DATA l_folder_id TYPE soodk.
DATA l_object_id TYPE soodk.
DATA document_id TYPE sofmk.
READ TABLE t_links INTO la_links INDEX 1.
document_id = la_links-instid_b.
l_folder_id-objtp = document_id-foltp.
l_folder_id-objyr = document_id-folyr.
l_folder_id-objno = document_id-folno.
l_object_id-objtp = document_id-doctp.
l_object_id-objyr = document_id-docyr.
l_object_id-objno = document_id-docno.
DATA document_content TYPE STANDARD TABLE OF soli.
CALL FUNCTION 'SO_OBJECT_READ'
EXPORTING
folder_id = l_folder_id
object_id = l_object_id
TABLES
objcont = document_content
EXCEPTIONS
active_user_not_exist = 1
communication_failure = 2
component_not_available = 3
folder_not_exist = 4
folder_no_authorization = 5
object_not_exist = 6
object_no_authorization = 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.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Regards,
Naimesh Patel
‎2009 Jan 22 8:11 PM
Hi Patel,
Excellent!!! Problem Solved...
Thanks alot
Regards
Shekar
‎2009 May 13 11:29 AM
Hi,
which method do you use to display notes?
I tried to use fm SGOS_NOTE_DISPLAY, but it dumps every time I enter data ...
thx
Dieter
‎2009 Aug 18 7:16 PM
I used function module "'SWU_OBJECT_PUBLISH' to display. This Function module will activate the Object Services button on the screen(Above application tool bar and Next Title of the screen) where this FM is called.
Thanks
Shekar
‎2020 Sep 14 10:26 AM