SAP HR_RELATION_WRITE Function Module for NOTRANSL: Schreiben von Verknüpfungen
HR_RELATION_WRITE is a standard hr relation write SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for NOTRANSL: Schreiben von Verknüpfungen processing and below is the pattern details for this FM, showing its interface including any import and export parameters, exceptions etc. there is also a full "cut and paste" ABAP pattern code example, along with implementation ABAP coding, documentation and contribution comments specific to this or related objects.
See here to view full function module documentation and code listing for hr relation write FM, simply by entering the name HR_RELATION_WRITE into the relevant SAP transaction such as SE37 or SE38.
Function Group: RHP1
Program Name: SAPLRHP1
Main Program: SAPLRHP1
Appliation area: C
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function HR_RELATION_WRITE pattern details
In-order to call this FM within your sap programs, simply using the below ABAP pattern details to trigger the function call...or see the full ABAP code listing at the end of this article. You can simply cut and paste this code into your ABAP progrom as it is, including variable declarations.CALL FUNCTION 'HR_RELATION_WRITE'"NOTRANSL: Schreiben von Verknüpfungen.
EXPORTING
* EXPERIENCE = ' ' "
* SOURCE_OTYPE = ' ' "
* TARGET_OBJID = 00000000 "ID of Related Object
* TARGET_OTYPE = ' ' "
* IN_DATUM_BIS = SY-DATUM "
* IN_DATUM_VON = SY-DATUM "
* IN_ZEIT_BIS = 240000 "
* IN_ZEIT_VON = 000000 "
* KAPID = 00000000 "
* PRIORITY = ' ' "
* PROFICIENCY = ' ' "
* SOURCE_OBJID = 00000000 "
EXCEPTIONS
INSERT_ERROR = 1 TIME_RANGE_INCORRECT = 10 TOO_MANY_OBJECTS = 11 INVALID_ADATA = 2 INVALID_KAPID = 3 INVALID_OBJID = 4 INVALID_OTYPE = 5 NO_INTEGRATION = 6 RELATION_EXISTENT = 7 SOURCE_OBJECT_NOT_VALID = 8 TARGET_OBJECT_NOT_VALID = 9
IMPORTING Parameters details for HR_RELATION_WRITE
EXPERIENCE -
Data type: CRPAD31-EXPERDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
SOURCE_OTYPE -
Data type: PLOG-OTYPEDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
TARGET_OBJID - ID of Related Object
Data type: PLOG-OBJIDDefault: 00000000
Optional: Yes
Call by Reference: No ( called with pass by value option)
TARGET_OTYPE -
Data type: PLOG-OTYPEDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
IN_DATUM_BIS -
Data type: PCHDY-ENDDADefault: SY-DATUM
Optional: Yes
Call by Reference: No ( called with pass by value option)
IN_DATUM_VON -
Data type: PCHDY-BEGDADefault: SY-DATUM
Optional: Yes
Call by Reference: No ( called with pass by value option)
IN_ZEIT_BIS -
Data type: SY-UZEITDefault: 240000
Optional: Yes
Call by Reference: No ( called with pass by value option)
IN_ZEIT_VON -
Data type: SY-UZEITDefault: 000000
Optional: Yes
Call by Reference: No ( called with pass by value option)
KAPID -
Data type: KAKO-KAPIDDefault: 00000000
Optional: Yes
Call by Reference: No ( called with pass by value option)
PRIORITY -
Data type: P1001-PRIOXDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
PROFICIENCY -
Data type: CRPAD31-CHARADefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
SOURCE_OBJID -
Data type: PLOG-OBJIDDefault: 00000000
Optional: Yes
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
INSERT_ERROR -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
TIME_RANGE_INCORRECT -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
TOO_MANY_OBJECTS -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
INVALID_ADATA -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
INVALID_KAPID -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
INVALID_OBJID -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
INVALID_OTYPE - Obj. Type Not Permitted
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
NO_INTEGRATION -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
RELATION_EXISTENT -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
SOURCE_OBJECT_NOT_VALID -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
TARGET_OBJECT_NOT_VALID -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for HR_RELATION_WRITE Function Module
The ABAP code below is a full code listing to execute function module POPUP_TO_CONFIRM including all data declarations. The code uses the original data declarations rather than the latest in-line data DECLARATION SYNTAX but I have included an ABAP code snippet at the end to show how declarations would look using the newer method of declaring data variables on the fly. This will allow you to compare and fully understand the new inline method. Please note some of the newer syntax such as the @DATA is not available until a later 4.70 service pack (SP8), which i why i have stuck to the origianl for this example.| DATA: | ||||
| lv_experience | TYPE CRPAD31-EXPER, " SPACE | |||
| lv_insert_error | TYPE CRPAD31, " | |||
| lv_source_otype | TYPE PLOG-OTYPE, " SPACE | |||
| lv_time_range_incorrect | TYPE PLOG, " | |||
| lv_target_objid | TYPE PLOG-OBJID, " 00000000 | |||
| lv_too_many_objects | TYPE PLOG, " | |||
| lv_target_otype | TYPE PLOG-OTYPE, " SPACE | |||
| lv_in_datum_bis | TYPE PCHDY-ENDDA, " SY-DATUM | |||
| lv_invalid_adata | TYPE PCHDY, " | |||
| lv_in_datum_von | TYPE PCHDY-BEGDA, " SY-DATUM | |||
| lv_invalid_kapid | TYPE PCHDY, " | |||
| lv_in_zeit_bis | TYPE SY-UZEIT, " 240000 | |||
| lv_invalid_objid | TYPE SY, " | |||
| lv_in_zeit_von | TYPE SY-UZEIT, " 000000 | |||
| lv_invalid_otype | TYPE SY, " | |||
| lv_kapid | TYPE KAKO-KAPID, " 00000000 | |||
| lv_no_integration | TYPE KAKO, " | |||
| lv_priority | TYPE P1001-PRIOX, " SPACE | |||
| lv_relation_existent | TYPE P1001, " | |||
| lv_proficiency | TYPE CRPAD31-CHARA, " SPACE | |||
| lv_source_object_not_valid | TYPE CRPAD31, " | |||
| lv_source_objid | TYPE PLOG-OBJID, " 00000000 | |||
| lv_target_object_not_valid | TYPE PLOG. " |
|   CALL FUNCTION 'HR_RELATION_WRITE' "NOTRANSL: Schreiben von Verknüpfungen |
| EXPORTING | ||
| EXPERIENCE | = lv_experience | |
| SOURCE_OTYPE | = lv_source_otype | |
| TARGET_OBJID | = lv_target_objid | |
| TARGET_OTYPE | = lv_target_otype | |
| IN_DATUM_BIS | = lv_in_datum_bis | |
| IN_DATUM_VON | = lv_in_datum_von | |
| IN_ZEIT_BIS | = lv_in_zeit_bis | |
| IN_ZEIT_VON | = lv_in_zeit_von | |
| KAPID | = lv_kapid | |
| PRIORITY | = lv_priority | |
| PROFICIENCY | = lv_proficiency | |
| SOURCE_OBJID | = lv_source_objid | |
| EXCEPTIONS | ||
| INSERT_ERROR = 1 | ||
| TIME_RANGE_INCORRECT = 10 | ||
| TOO_MANY_OBJECTS = 11 | ||
| INVALID_ADATA = 2 | ||
| INVALID_KAPID = 3 | ||
| INVALID_OBJID = 4 | ||
| INVALID_OTYPE = 5 | ||
| NO_INTEGRATION = 6 | ||
| RELATION_EXISTENT = 7 | ||
| SOURCE_OBJECT_NOT_VALID = 8 | ||
| TARGET_OBJECT_NOT_VALID = 9 | ||
| . " HR_RELATION_WRITE | ||
ABAP code using 7.40 inline data declarations to call FM HR_RELATION_WRITE
The below ABAP code uses the newer in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. Please note some of the newer syntax below, such as the @DATA is not available until 4.70 EHP 8.| "SELECT single EXPER FROM CRPAD31 INTO @DATA(ld_experience). | ||||
| DATA(ld_experience) | = ' '. | |||
| "SELECT single OTYPE FROM PLOG INTO @DATA(ld_source_otype). | ||||
| DATA(ld_source_otype) | = ' '. | |||
| "SELECT single OBJID FROM PLOG INTO @DATA(ld_target_objid). | ||||
| DATA(ld_target_objid) | = 00000000. | |||
| "SELECT single OTYPE FROM PLOG INTO @DATA(ld_target_otype). | ||||
| DATA(ld_target_otype) | = ' '. | |||
| "SELECT single ENDDA FROM PCHDY INTO @DATA(ld_in_datum_bis). | ||||
| DATA(ld_in_datum_bis) | = SY-DATUM. | |||
| "SELECT single BEGDA FROM PCHDY INTO @DATA(ld_in_datum_von). | ||||
| DATA(ld_in_datum_von) | = SY-DATUM. | |||
| "SELECT single UZEIT FROM SY INTO @DATA(ld_in_zeit_bis). | ||||
| DATA(ld_in_zeit_bis) | = 240000. | |||
| "SELECT single UZEIT FROM SY INTO @DATA(ld_in_zeit_von). | ||||
| DATA(ld_in_zeit_von) | = 000000. | |||
| "SELECT single KAPID FROM KAKO INTO @DATA(ld_kapid). | ||||
| DATA(ld_kapid) | = 00000000. | |||
| "SELECT single PRIOX FROM P1001 INTO @DATA(ld_priority). | ||||
| DATA(ld_priority) | = ' '. | |||
| "SELECT single CHARA FROM CRPAD31 INTO @DATA(ld_proficiency). | ||||
| DATA(ld_proficiency) | = ' '. | |||
| "SELECT single OBJID FROM PLOG INTO @DATA(ld_source_objid). | ||||
| DATA(ld_source_objid) | = 00000000. | |||
Search for further information about these or an SAP related objects