SAP Jobsuche bei DV-Treff
Tekko
  • Tekko
  • SAP Forum - User Thema Starter
vor 5 Jahre
Hallo Leute,

ich muss einen externen Link zu einem Objekt erzeugen und haben folgenden Code:

Zitat:

FUNCTION Z_ANLAGE_HINZUFUEGEN4.

*"----------------------------------------------------------------------

*"*"Lokale Schnittstelle:

*" IMPORTING

*" VALUE(I_OBJECTTYPE) LIKE BORIDENT-OBJTYPE OPTIONAL

*" VALUE(I_OBJECTKEY) LIKE BORIDENT-OBJKEY OPTIONAL

*" VALUE(I_URL) LIKE SOLI-LINE OPTIONAL

*" VALUE(I_URLDES) LIKE SOOD1-OBJDES OPTIONAL

*" VALUE(I_NOCOMMIT) TYPE XFELD OPTIONAL

*" TABLES

*" OT_RETURN STRUCTURE BAPIRET2

*"----------------------------------------------------------------------

data: l_owner like soud-usrnam,

l_folderid like soodk,

l_obj_id like soodk,

l_objdata like sood1,

lt_objcont type table of soli with header line,

lt_objhead type table of soli with header line,

l_object like borident,

l_reldoc like borident,

l_syst like syst.

*-----------------------------------------------------------------------

*1. Get folder id.

l_owner = sy-uname.

call function 'SO_FOLDER_ROOT_ID_GET'

exporting

owner = l_owner

region = 'B'

importing

folder_id = l_folderid

exceptions

communication_failure = 1

owner_not_exist = 2

system_failure = 3

x_error = 4

others = 5.

if sy-subrc <> 0.

l_syst = syst.

perform collect_message using ot_return l_syst '1.FolderRoot'.

append ot_return.

exit.

endif.

*2. Insert object

l_objdata-objla = 'EN'.

l_objdata-objdes = i_urldes.

l_objdata-objsns = 'O'.

concatenate '&KEY&' i_url into lt_objcont.

append lt_objcont.

call function 'SO_OBJECT_INSERT'

exporting

folder_id = l_folderid

object_type = 'URL'

object_hd_change = l_objdata

owner = l_owner

importing

object_id = l_obj_id

tables

objcont = lt_objcont

objhead = lt_objhead

exceptions

active_user_not_exist = 1

communication_failure = 2

component_not_available = 3

dl_name_exist = 4

folder_not_exist = 5

folder_no_authorization = 6

object_type_not_exist = 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.

l_syst = syst.

perform collect_message using ot_return l_syst '2.ObjectInsert'.

append ot_return.

exit.

endif.

*3. Create binary relation

l_object-objkey = i_objectkey.

l_object-objtype = i_objecttype.

concatenate l_folderid l_obj_id into l_reldoc-objkey.

l_reldoc-objtype = 'MESSAGE'.

call function 'BINARY_RELATION_CREATE'

exporting

obj_rolea = l_object

obj_roleb = l_reldoc

relationtype = 'URL'

exceptions

no_model = 1

internal_error = 2

unknown = 3

others = 4.

if sy-subrc <> 0.

l_syst = syst.

perform collect_message using ot_return l_syst

'3.BinaryRelationCreate'.

append ot_return.

exit.

endif.

*4. Commit LUW

* All successful, sent success message.

clear: l_syst-msgid, l_syst-msgno.

l_syst-msgty = 'S'.

l_syst-msgv1 = 'Link created successfully'.

perform collect_message using ot_return l_syst '4. URLLinkCreated'.

append ot_return.

if i_nocommit is initial.

call function 'BAPI_TRANSACTION_COMMIT'.

endif.

ENDFUNCTION.

und das Unterprogramm:

Zitat:

*----------------------------------------------------------------------*

***INCLUDE /1BCDWB/LIQG000000000039F01.

*----------------------------------------------------------------------*

*&---------------------------------------------------------------------*

*& Form collect_message

*&---------------------------------------------------------------------*

FORM collect_message using o_return like bapiret2

i_syst like syst

i_callpoint like bapiret2-parameter.

clear o_return.

o_return-type = i_syst-msgty.

if i_syst-msgty is initial.

o_return-type = 'E'.

i_syst-msgty = 'E'.

endif.

o_return-id = i_syst-msgid.

o_return-number = i_syst-msgno.

o_return-message_v1 = i_syst-msgv1.

o_return-message_v2 = i_syst-msgv2.

o_return-message_v3 = i_syst-msgv3.

o_return-message_v4 = i_syst-msgv4.

o_return-parameter = i_callpoint.

message id i_syst-msgid type i_syst-msgty number i_syst-msgno into

o_return-message.

endform. " collect_message

Doch leider kommt die Fehlermeldung:

Die FORM "COLLECT_MESSAGE" existiert nicht.

Woran liegt das und wie kann ich das lösen?

Vielen Dank im Vorraus

Tekko

Förderer

daytona80
vor 5 Jahre
Hallo,

hmm schwer zu sagen, aber alle Objekte sind aktiviert wurden? Transportiert aber als lokales Objekt angelegt?


Vielen Dank und viele Grüße
Tekko
  • Tekko
  • SAP Forum - User Thema Starter
vor 5 Jahre
ja, alles ist aktiv.

Ich glaube das lag daran, das der Funktionsbaustein und die Funktionsgruppe nicht zusammen waren.

Muss noch etwas probieren 🙂