SAP COPY_PURCHASING_DATA Function Module for copy purchasing data from a reference site to another one









COPY_PURCHASING_DATA is a standard copy purchasing data 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 purchasing data from a reference site to another one 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 copy purchasing data FM, simply by entering the name COPY_PURCHASING_DATA into the relevant SAP transaction such as SE37 or SE38.

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



Function COPY_PURCHASING_DATA 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 'COPY_PURCHASING_DATA'"copy purchasing data from a reference site to another one
EXPORTING
* SIMULATE = ' ' "Asks for simulation only
REFSITE_OLD = "Reference site for purchasing
REFSITE_NEW = "Reference site for purchasing
PURCH_ORG = "Purchasing organization
* OVERRIDE_LFM2 = ' ' "Asks to override existing LFM2
* OVERRIDE_EINE = ' ' "Asks to override existing EINE

IMPORTING
TOTAL_EINE = "Returns number of eine records
TOTAL_LFM2 = "Returns number of lfm2 records
TOTAL_EINE_OV = "Returns number of eine overriden
TOTAL_LFM2_OV = "Returns number of lfm2 overriden
.



IMPORTING Parameters details for COPY_PURCHASING_DATA

SIMULATE - Asks for simulation only

Data type: C
Default: SPACE
Optional: Yes
Call by Reference: Yes

REFSITE_OLD - Reference site for purchasing

Data type: MMSITEREF-REFSITE
Optional: No
Call by Reference: Yes

REFSITE_NEW - Reference site for purchasing

Data type: MMSITEREF-REFSITE
Optional: No
Call by Reference: Yes

PURCH_ORG - Purchasing organization

Data type: MMSITEREF-EKORG
Optional: No
Call by Reference: Yes

OVERRIDE_LFM2 - Asks to override existing LFM2

Data type: C
Default: SPACE
Optional: Yes
Call by Reference: Yes

OVERRIDE_EINE - Asks to override existing EINE

Data type: C
Default: SPACE
Optional: Yes
Call by Reference: Yes

EXPORTING Parameters details for COPY_PURCHASING_DATA

TOTAL_EINE - Returns number of eine records

Data type: I
Optional: No
Call by Reference: Yes

TOTAL_LFM2 - Returns number of lfm2 records

Data type: I
Optional: No
Call by Reference: Yes

TOTAL_EINE_OV - Returns number of eine overriden

Data type: I
Optional: No
Call by Reference: Yes

TOTAL_LFM2_OV - Returns number of lfm2 overriden

Data type: I
Optional: No
Call by Reference: Yes

Copy and paste ABAP code example for COPY_PURCHASING_DATA 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_simulate  TYPE C, "   SPACE
lv_total_eine  TYPE I, "   
lv_total_lfm2  TYPE I, "   
lv_refsite_old  TYPE MMSITEREF-REFSITE, "   
lv_refsite_new  TYPE MMSITEREF-REFSITE, "   
lv_total_eine_ov  TYPE I, "   
lv_purch_org  TYPE MMSITEREF-EKORG, "   
lv_total_lfm2_ov  TYPE I, "   
lv_override_lfm2  TYPE C, "   SPACE
lv_override_eine  TYPE C. "   SPACE

  CALL FUNCTION 'COPY_PURCHASING_DATA'  "copy purchasing data from a reference site to another one
    EXPORTING
         SIMULATE = lv_simulate
         REFSITE_OLD = lv_refsite_old
         REFSITE_NEW = lv_refsite_new
         PURCH_ORG = lv_purch_org
         OVERRIDE_LFM2 = lv_override_lfm2
         OVERRIDE_EINE = lv_override_eine
    IMPORTING
         TOTAL_EINE = lv_total_eine
         TOTAL_LFM2 = lv_total_lfm2
         TOTAL_EINE_OV = lv_total_eine_ov
         TOTAL_LFM2_OV = lv_total_lfm2_ov
. " COPY_PURCHASING_DATA




ABAP code using 7.40 inline data declarations to call FM COPY_PURCHASING_DATA

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_simulate) = ' '.
 
 
 
"SELECT single REFSITE FROM MMSITEREF INTO @DATA(ld_refsite_old).
 
"SELECT single REFSITE FROM MMSITEREF INTO @DATA(ld_refsite_new).
 
 
"SELECT single EKORG FROM MMSITEREF INTO @DATA(ld_purch_org).
 
 
DATA(ld_override_lfm2) = ' '.
 
DATA(ld_override_eine) = ' '.
 


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!