Skip to Content
0
Former Member
Apr 16, 2008 at 06:58 PM

GOS, programmatically changing the URL attachment

4324 Views

Hello all,

I just started working on a project that will use generic object services to attach a URL to a business object. Programmatically I have determined how to create a URL attachment, delete the URL attachment, and create a report listing all of the URLs titles.

I'm having A much harder time trying to determine how to programmatically change the URL. I have some code that will display a list of the URLs. But I don't know how to actually change the value of the URL. I'm sure that at some point in the future we will need this functionality due to some change in the system where the URLs are stored.

Change www.OLD.document.pdf

to www.NEW.document.pdf.

Has anyone done this.

This is the code that I'm using to create a list of the actual URLs.

  • Include for BO macros

INCLUDE : <cntn01>.

PARAMETERS:

p_botype like borident-objtype default 'BUS3006',

p_bo_id like borident-objkey default '100 0001000012',

p_reltyp like breltyp-reltype default 'URL'.

DATA: lo_is_object_a TYPE sibflporb,

lt_links TYPE obl_t_link,

wa_links LIKE LINE OF lt_links.

DATA : lt_rel TYPE obl_t_relt,

wa_rel LIKE LINE OF lt_rel.

lo_is_object_a-instid = p_bo_id.

lo_is_object_a-typeid = p_botype.

lo_is_object_a-catid = 'BO'.

wa_rel-sign = 'I'.

wa_rel-option = 'EQ'.

wa_rel-low = p_reltyp.

APPEND wa_rel TO lt_rel.

*

CALL METHOD cl_binary_relation=>read_links

EXPORTING

is_object = lo_is_object_a

  • IP_LOGSYS =

  • IT_ROLE_OPTIONS =

it_relation_options = lt_rel

  • IP_NO_BUFFER = SPACE

IMPORTING

et_links = lt_links

  • ET_ROLES =

.

*

DATA : lv_document_id TYPE sofolenti1-doc_id.

DATA : lt_header TYPE STANDARD TABLE OF solisti1 WITH HEADER LINE,

lt_content TYPE STANDARD TABLE OF solisti1 WITH HEADER LINE.

DATA: i_attachment_list TYPE soattlsti1 OCCURS 0.

*

LOOP AT lt_links INTO wa_links WHERE typeid_b = 'MESSAGE'.

*

SKIP 1.

WRITE: '>>> lt_links ITAB <<<'.

SKIP 1.

MOVE wa_links-instid_b TO lv_document_id.

*

CALL FUNCTION 'SO_DOCUMENT_READ_API1'

EXPORTING

document_id = lv_document_id

  • FILTER = 'X '

  • IMPORTING

  • DOCUMENT_DATA =

TABLES

object_header = lt_header

object_content = lt_content

  • OBJECT_PARA =

  • OBJECT_PARB =

attachment_list = i_attachment_list

  • RECEIVER_LIST =

  • CONTENTS_HEX =

EXCEPTIONS

document_id_not_exist = 1

operation_no_authorization = 2

x_error = 3

OTHERS = 4

.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

LOOP AT lt_header.

WRITE /: 'Header ', lt_header.

SKIP 1.

ENDLOOP.

LOOP AT lt_content.

WRITE /: 'Content', lt_content.

ENDLOOP.

*

ENDLOOP. " lt_links INTO wa_links WHERE typeid_b = 'MESSAGE'.

Thanks

Bruce