SAP CP_PLAN_ARCHIVE_OBJECT Function Module for Transfer object to archiving









CP_PLAN_ARCHIVE_OBJECT is a standard cp plan archive object SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Transfer object to archiving 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 cp plan archive object FM, simply by entering the name CP_PLAN_ARCHIVE_OBJECT into the relevant SAP transaction such as SE37 or SE38.

Function Group: CPRE
Program Name: SAPLCPRE
Main Program: SAPLCPRE
Appliation area:
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:



Function CP_PLAN_ARCHIVE_OBJECT 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 'CP_PLAN_ARCHIVE_OBJECT'"Transfer object to archiving
EXPORTING
ARCHIVE_HANDLE = "
* RESET_IMP = ' ' "Generic Type
* FLG_PROTOCOL = ' ' "Generic Type
* ALL_HTL = "Generic Type
* TEST_MODE = "Generic Type
PLNTY_IMP = "Task List Type
PLNNR_IMP = "Key for Task List Group
* PLNAL_IMP = ' ' "Group Counter
VERWE_IMP = "
WERKS_IMP = "
* OBJECT_DELETE_FLAG = 'X' "
* STTAG_IMP = '19000101' "Key date for reorganization
* FLG_NO_CHECKS = "Generic Type

EXCEPTIONS
WRONG_ACCESS_TO_ARCHIVE = 1 PLAN_NOT_EXIST_ON_DB = 2 PLAN_IN_USE = 3 NO_AUTHORITY = 4 PLNTY_NOT_ALLOTED_FOR_REORG = 5 STTAG_GT_SY_DATUM = 6 FOREIGN_LOCK = 7
.




Customer Function user exits

Below is a list of CUSTOMER FUNCTION exit user exits that are available within this program and maybe relevant for this FM.
EXIT_SAPLCPRE_001 Authorization checks when archiving and deleting routings

IMPORTING Parameters details for CP_PLAN_ARCHIVE_OBJECT

ARCHIVE_HANDLE -

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

RESET_IMP - Generic Type

Data type: C
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

FLG_PROTOCOL - Generic Type

Data type: C
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

ALL_HTL - Generic Type

Data type: C
Optional: Yes
Call by Reference: No ( called with pass by value option)

TEST_MODE - Generic Type

Data type: C
Optional: Yes
Call by Reference: No ( called with pass by value option)

PLNTY_IMP - Task List Type

Data type: PLKO-PLNTY
Optional: No
Call by Reference: Yes

PLNNR_IMP - Key for Task List Group

Data type: PLKO-PLNNR
Optional: No
Call by Reference: Yes

PLNAL_IMP - Group Counter

Data type: PLKO-PLNAL
Default: SPACE
Optional: Yes
Call by Reference: Yes

VERWE_IMP -

Data type: PLKO-VERWE
Optional: No
Call by Reference: Yes

WERKS_IMP -

Data type: PLKO-WERKS
Optional: No
Call by Reference: Yes

OBJECT_DELETE_FLAG -

Data type:
Default: 'X'
Optional: Yes
Call by Reference: No ( called with pass by value option)

STTAG_IMP - Key date for reorganization

Data type: RC27REO-STTAG
Default: '19000101'
Optional: Yes
Call by Reference: No ( called with pass by value option)

FLG_NO_CHECKS - Generic Type

Data type: C
Optional: Yes
Call by Reference: No ( called with pass by value option)

EXCEPTIONS details

WRONG_ACCESS_TO_ARCHIVE -

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

PLAN_NOT_EXIST_ON_DB -

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

PLAN_IN_USE -

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

NO_AUTHORITY -

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

PLNTY_NOT_ALLOTED_FOR_REORG -

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

STTAG_GT_SY_DATUM -

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

FOREIGN_LOCK -

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

Copy and paste ABAP code example for CP_PLAN_ARCHIVE_OBJECT 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_archive_handle  TYPE STRING, "   
lv_wrong_access_to_archive  TYPE STRING, "   
lv_reset_imp  TYPE C, "   SPACE
lv_flg_protocol  TYPE C, "   SPACE
lv_all_htl  TYPE C, "   
lv_test_mode  TYPE C, "   
lv_plnty_imp  TYPE PLKO-PLNTY, "   
lv_plan_not_exist_on_db  TYPE PLKO, "   
lv_plnnr_imp  TYPE PLKO-PLNNR, "   
lv_plan_in_use  TYPE PLKO, "   
lv_plnal_imp  TYPE PLKO-PLNAL, "   SPACE
lv_no_authority  TYPE PLKO, "   
lv_verwe_imp  TYPE PLKO-VERWE, "   
lv_plnty_not_alloted_for_reorg  TYPE PLKO, "   
lv_werks_imp  TYPE PLKO-WERKS, "   
lv_sttag_gt_sy_datum  TYPE PLKO, "   
lv_foreign_lock  TYPE PLKO, "   
lv_object_delete_flag  TYPE PLKO, "   'X'
lv_sttag_imp  TYPE RC27REO-STTAG, "   '19000101'
lv_flg_no_checks  TYPE C. "   

  CALL FUNCTION 'CP_PLAN_ARCHIVE_OBJECT'  "Transfer object to archiving
    EXPORTING
         ARCHIVE_HANDLE = lv_archive_handle
         RESET_IMP = lv_reset_imp
         FLG_PROTOCOL = lv_flg_protocol
         ALL_HTL = lv_all_htl
         TEST_MODE = lv_test_mode
         PLNTY_IMP = lv_plnty_imp
         PLNNR_IMP = lv_plnnr_imp
         PLNAL_IMP = lv_plnal_imp
         VERWE_IMP = lv_verwe_imp
         WERKS_IMP = lv_werks_imp
         OBJECT_DELETE_FLAG = lv_object_delete_flag
         STTAG_IMP = lv_sttag_imp
         FLG_NO_CHECKS = lv_flg_no_checks
    EXCEPTIONS
        WRONG_ACCESS_TO_ARCHIVE = 1
        PLAN_NOT_EXIST_ON_DB = 2
        PLAN_IN_USE = 3
        NO_AUTHORITY = 4
        PLNTY_NOT_ALLOTED_FOR_REORG = 5
        STTAG_GT_SY_DATUM = 6
        FOREIGN_LOCK = 7
. " CP_PLAN_ARCHIVE_OBJECT




ABAP code using 7.40 inline data declarations to call FM CP_PLAN_ARCHIVE_OBJECT

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.

 
 
DATA(ld_reset_imp) = ' '.
 
DATA(ld_flg_protocol) = ' '.
 
 
 
"SELECT single PLNTY FROM PLKO INTO @DATA(ld_plnty_imp).
 
 
"SELECT single PLNNR FROM PLKO INTO @DATA(ld_plnnr_imp).
 
 
"SELECT single PLNAL FROM PLKO INTO @DATA(ld_plnal_imp).
DATA(ld_plnal_imp) = ' '.
 
 
"SELECT single VERWE FROM PLKO INTO @DATA(ld_verwe_imp).
 
 
"SELECT single WERKS FROM PLKO INTO @DATA(ld_werks_imp).
 
 
 
DATA(ld_object_delete_flag) = 'X'.
 
"SELECT single STTAG FROM RC27REO INTO @DATA(ld_sttag_imp).
DATA(ld_sttag_imp) = '19000101'.
 
 


Search for further information about these or an SAP related objects



Comments on this SAP object

What made you want to lookup this SAP object? Please tell us what you were looking for and anything you would like to be included on this page!