SAP RH_COPY_INFTY Function Module for Copy Infotype Records from one Object to Another
RH_COPY_INFTY is a standard rh copy infty SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Copy Infotype Records from one Object to Another 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 rh copy infty FM, simply by entering the name RH_COPY_INFTY into the relevant SAP transaction such as SE37 or SE38.
Function Group: RHAP
Program Name: SAPLRHAP
Main Program: SAPLRHAP
Appliation area: H
Release date: 02-Sep-1999
Mode(Normal, Remote etc): Normal Function Module
Update:

Function RH_COPY_INFTY 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 'RH_COPY_INFTY'"Copy Infotype Records from one Object to Another.
EXPORTING
PLVAR = "
* FCODE = 'INSE' "
VTASK = "
* ORDER_FLG = 'X' "
* COMMIT_FLG = 'X' "
* AUTHY = 'X' "
* KEEP_LUPD = "
* WORKF_ACTV = 'X' "
OTYPE = "
SOURCE_OBJID = "
TARGET_OBJID = "
* INFTY = "
* SUBTY = "
* ISTAT = "
* BEGDA = '19000101' "
* ENDDA = '99991231' "
EXCEPTIONS
ALL_INFTY_WITH_SUBTY = 1 INTERNAL_ERROR = 10 NO_SELECTION = 2 NO_AUTHORIZATION = 3 ERROR_DURING_INSERT = 4 ERROR_DURING_UPDATE = 5 ERROR_DURING_COPY = 6 CORR_EXIT = 7 INVALID_PARAMETERS = 8 INVALID_TARGET_OBJECT = 9
IMPORTING Parameters details for RH_COPY_INFTY
PLVAR -
Data type: PLOG-PLVAROptional: No
Call by Reference: No ( called with pass by value option)
FCODE -
Data type: HRRHAP-FCODEDefault: 'INSE'
Optional: Yes
Call by Reference: No ( called with pass by value option)
VTASK -
Data type: HRRHAP-VTASKOptional: No
Call by Reference: No ( called with pass by value option)
ORDER_FLG -
Data type: HRRHAP-ORDER_FLGDefault: 'X'
Optional: Yes
Call by Reference: No ( called with pass by value option)
COMMIT_FLG -
Data type: HRRHAP-COMMIT_FLGDefault: 'X'
Optional: Yes
Call by Reference: No ( called with pass by value option)
AUTHY -
Data type: HRRHAP-AUTHYDefault: 'X'
Optional: Yes
Call by Reference: No ( called with pass by value option)
KEEP_LUPD -
Data type: HRRHAP-KEEP_LUPDOptional: Yes
Call by Reference: No ( called with pass by value option)
WORKF_ACTV -
Data type: HRRHAP-WORKF_ACTVDefault: 'X'
Optional: Yes
Call by Reference: No ( called with pass by value option)
OTYPE -
Data type: PLOG-OTYPEOptional: No
Call by Reference: No ( called with pass by value option)
SOURCE_OBJID -
Data type: PLOG-OBJIDOptional: No
Call by Reference: No ( called with pass by value option)
TARGET_OBJID -
Data type: PLOG-OBJIDOptional: No
Call by Reference: No ( called with pass by value option)
INFTY -
Data type: PLOG-INFTYOptional: Yes
Call by Reference: No ( called with pass by value option)
SUBTY -
Data type: PLOG-SUBTYOptional: Yes
Call by Reference: No ( called with pass by value option)
ISTAT -
Data type: PLOG-ISTATOptional: Yes
Call by Reference: No ( called with pass by value option)
BEGDA -
Data type: PLOG-ENDDADefault: '19000101'
Optional: Yes
Call by Reference: No ( called with pass by value option)
ENDDA -
Data type: PLOG-ENDDADefault: '99991231'
Optional: Yes
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
ALL_INFTY_WITH_SUBTY -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
INTERNAL_ERROR -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
NO_SELECTION -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
NO_AUTHORIZATION -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
ERROR_DURING_INSERT -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
ERROR_DURING_UPDATE -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
ERROR_DURING_COPY -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
CORR_EXIT -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
INVALID_PARAMETERS -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
INVALID_TARGET_OBJECT -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for RH_COPY_INFTY 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_plvar | TYPE PLOG-PLVAR, " | |||
| lv_all_infty_with_subty | TYPE PLOG, " | |||
| lv_fcode | TYPE HRRHAP-FCODE, " 'INSE' | |||
| lv_internal_error | TYPE HRRHAP, " | |||
| lv_vtask | TYPE HRRHAP-VTASK, " | |||
| lv_order_flg | TYPE HRRHAP-ORDER_FLG, " 'X' | |||
| lv_commit_flg | TYPE HRRHAP-COMMIT_FLG, " 'X' | |||
| lv_authy | TYPE HRRHAP-AUTHY, " 'X' | |||
| lv_keep_lupd | TYPE HRRHAP-KEEP_LUPD, " | |||
| lv_workf_actv | TYPE HRRHAP-WORKF_ACTV, " 'X' | |||
| lv_otype | TYPE PLOG-OTYPE, " | |||
| lv_no_selection | TYPE PLOG, " | |||
| lv_source_objid | TYPE PLOG-OBJID, " | |||
| lv_no_authorization | TYPE PLOG, " | |||
| lv_target_objid | TYPE PLOG-OBJID, " | |||
| lv_error_during_insert | TYPE PLOG, " | |||
| lv_infty | TYPE PLOG-INFTY, " | |||
| lv_error_during_update | TYPE PLOG, " | |||
| lv_subty | TYPE PLOG-SUBTY, " | |||
| lv_error_during_copy | TYPE PLOG, " | |||
| lv_istat | TYPE PLOG-ISTAT, " | |||
| lv_corr_exit | TYPE PLOG, " | |||
| lv_begda | TYPE PLOG-ENDDA, " '19000101' | |||
| lv_invalid_parameters | TYPE PLOG, " | |||
| lv_endda | TYPE PLOG-ENDDA, " '99991231' | |||
| lv_invalid_target_object | TYPE PLOG. " |
|   CALL FUNCTION 'RH_COPY_INFTY' "Copy Infotype Records from one Object to Another |
| EXPORTING | ||
| PLVAR | = lv_plvar | |
| FCODE | = lv_fcode | |
| VTASK | = lv_vtask | |
| ORDER_FLG | = lv_order_flg | |
| COMMIT_FLG | = lv_commit_flg | |
| AUTHY | = lv_authy | |
| KEEP_LUPD | = lv_keep_lupd | |
| WORKF_ACTV | = lv_workf_actv | |
| OTYPE | = lv_otype | |
| SOURCE_OBJID | = lv_source_objid | |
| TARGET_OBJID | = lv_target_objid | |
| INFTY | = lv_infty | |
| SUBTY | = lv_subty | |
| ISTAT | = lv_istat | |
| BEGDA | = lv_begda | |
| ENDDA | = lv_endda | |
| EXCEPTIONS | ||
| ALL_INFTY_WITH_SUBTY = 1 | ||
| INTERNAL_ERROR = 10 | ||
| NO_SELECTION = 2 | ||
| NO_AUTHORIZATION = 3 | ||
| ERROR_DURING_INSERT = 4 | ||
| ERROR_DURING_UPDATE = 5 | ||
| ERROR_DURING_COPY = 6 | ||
| CORR_EXIT = 7 | ||
| INVALID_PARAMETERS = 8 | ||
| INVALID_TARGET_OBJECT = 9 | ||
| . " RH_COPY_INFTY | ||
ABAP code using 7.40 inline data declarations to call FM RH_COPY_INFTY
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 PLVAR FROM PLOG INTO @DATA(ld_plvar). | ||||
| "SELECT single FCODE FROM HRRHAP INTO @DATA(ld_fcode). | ||||
| DATA(ld_fcode) | = 'INSE'. | |||
| "SELECT single VTASK FROM HRRHAP INTO @DATA(ld_vtask). | ||||
| "SELECT single ORDER_FLG FROM HRRHAP INTO @DATA(ld_order_flg). | ||||
| DATA(ld_order_flg) | = 'X'. | |||
| "SELECT single COMMIT_FLG FROM HRRHAP INTO @DATA(ld_commit_flg). | ||||
| DATA(ld_commit_flg) | = 'X'. | |||
| "SELECT single AUTHY FROM HRRHAP INTO @DATA(ld_authy). | ||||
| DATA(ld_authy) | = 'X'. | |||
| "SELECT single KEEP_LUPD FROM HRRHAP INTO @DATA(ld_keep_lupd). | ||||
| "SELECT single WORKF_ACTV FROM HRRHAP INTO @DATA(ld_workf_actv). | ||||
| DATA(ld_workf_actv) | = 'X'. | |||
| "SELECT single OTYPE FROM PLOG INTO @DATA(ld_otype). | ||||
| "SELECT single OBJID FROM PLOG INTO @DATA(ld_source_objid). | ||||
| "SELECT single OBJID FROM PLOG INTO @DATA(ld_target_objid). | ||||
| "SELECT single INFTY FROM PLOG INTO @DATA(ld_infty). | ||||
| "SELECT single SUBTY FROM PLOG INTO @DATA(ld_subty). | ||||
| "SELECT single ISTAT FROM PLOG INTO @DATA(ld_istat). | ||||
| "SELECT single ENDDA FROM PLOG INTO @DATA(ld_begda). | ||||
| DATA(ld_begda) | = '19000101'. | |||
| "SELECT single ENDDA FROM PLOG INTO @DATA(ld_endda). | ||||
| DATA(ld_endda) | = '99991231'. | |||
Search for further information about these or an SAP related objects