SAP CPE_CONVERT_STRUC_TO_NAMEVALUE Function Module for CPE - Converting Structure Fields into Name Value Pairs for CPE Processing









CPE_CONVERT_STRUC_TO_NAMEVALUE is a standard cpe convert struc to namevalue SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for CPE - Converting Structure Fields into Name Value Pairs for CPE Processing 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 cpe convert struc to namevalue FM, simply by entering the name CPE_CONVERT_STRUC_TO_NAMEVALUE into the relevant SAP transaction such as SE37 or SE38.

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



Function CPE_CONVERT_STRUC_TO_NAMEVALUE 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 'CPE_CONVERT_STRUC_TO_NAMEVALUE'"CPE - Converting Structure Fields into Name Value Pairs for CPE Processing
EXPORTING
IV_STRUCTURE_NAME = "Name of a structure
IS_STRUCTURE_DATA = "Filled structure. Fields are converted into 'name-value-pairs'.
* IV_FIELD_NAME = "Field name of structure. If provided FM performance is boostet.
IT_MAPPING = "CPE Caller - Table Type for Mapping of Business Data

IMPORTING
EV_FIELDNAME_MISMATCH_OCCURED = "Single-character flag

CHANGING
* CT_NAMEVALUEPAIRS_10 = "CPE Caller - Table Type for Name Value Pairs (L=10)
* CT_NAMEVALUEPAIRS_50 = "CPE Caller - Table Type for Name Value Pairs (L=50)
* CT_NAMEVALUEPAIRS_255 = "CPE Caller - Table Type for Name Value Pairs (L=255)

EXCEPTIONS
STRUCTURE_READ_NOT_POSSIBLE = 1 DDIC_READ_NOT_POSSIBLE = 2
.



IMPORTING Parameters details for CPE_CONVERT_STRUC_TO_NAMEVALUE

IV_STRUCTURE_NAME - Name of a structure

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

IS_STRUCTURE_DATA - Filled structure. Fields are converted into 'name-value-pairs'.

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

IV_FIELD_NAME - Field name of structure. If provided FM performance is boostet.

Data type: FNAM_____4
Optional: Yes
Call by Reference: Yes

IT_MAPPING - CPE Caller - Table Type for Mapping of Business Data

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

EXPORTING Parameters details for CPE_CONVERT_STRUC_TO_NAMEVALUE

EV_FIELDNAME_MISMATCH_OCCURED - Single-character flag

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

CHANGING Parameters details for CPE_CONVERT_STRUC_TO_NAMEVALUE

CT_NAMEVALUEPAIRS_10 - CPE Caller - Table Type for Name Value Pairs (L=10)

Data type: CPET_NAMEVALUEPAIRS_10_TAB
Optional: Yes
Call by Reference: Yes

CT_NAMEVALUEPAIRS_50 - CPE Caller - Table Type for Name Value Pairs (L=50)

Data type: CPET_NAMEVALUEPAIRS_50_TAB
Optional: Yes
Call by Reference: Yes

CT_NAMEVALUEPAIRS_255 - CPE Caller - Table Type for Name Value Pairs (L=255)

Data type: CPET_NAMEVALUEPAIRS_255_TAB
Optional: Yes
Call by Reference: Yes

EXCEPTIONS details

STRUCTURE_READ_NOT_POSSIBLE -

Data type:
Optional: No
Call by Reference: Yes

DDIC_READ_NOT_POSSIBLE -

Data type:
Optional: No
Call by Reference: Yes

Copy and paste ABAP code example for CPE_CONVERT_STRUC_TO_NAMEVALUE 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_iv_structure_name  TYPE STRUKNAME, "   
lv_ct_namevaluepairs_10  TYPE CPET_NAMEVALUEPAIRS_10_TAB, "   
lv_structure_read_not_possible  TYPE CPET_NAMEVALUEPAIRS_10_TAB, "   
lv_ev_fieldname_mismatch_occured  TYPE CHAR1, "   
lv_is_structure_data  TYPE ANY, "   
lv_ct_namevaluepairs_50  TYPE CPET_NAMEVALUEPAIRS_50_TAB, "   
lv_ddic_read_not_possible  TYPE CPET_NAMEVALUEPAIRS_50_TAB, "   
lv_iv_field_name  TYPE FNAM_____4, "   
lv_ct_namevaluepairs_255  TYPE CPET_NAMEVALUEPAIRS_255_TAB, "   
lv_it_mapping  TYPE CPET_MAPPING_TAB. "   

  CALL FUNCTION 'CPE_CONVERT_STRUC_TO_NAMEVALUE'  "CPE - Converting Structure Fields into Name Value Pairs for CPE Processing
    EXPORTING
         IV_STRUCTURE_NAME = lv_iv_structure_name
         IS_STRUCTURE_DATA = lv_is_structure_data
         IV_FIELD_NAME = lv_iv_field_name
         IT_MAPPING = lv_it_mapping
    IMPORTING
         EV_FIELDNAME_MISMATCH_OCCURED = lv_ev_fieldname_mismatch_occured
    CHANGING
         CT_NAMEVALUEPAIRS_10 = lv_ct_namevaluepairs_10
         CT_NAMEVALUEPAIRS_50 = lv_ct_namevaluepairs_50
         CT_NAMEVALUEPAIRS_255 = lv_ct_namevaluepairs_255
    EXCEPTIONS
        STRUCTURE_READ_NOT_POSSIBLE = 1
        DDIC_READ_NOT_POSSIBLE = 2
. " CPE_CONVERT_STRUC_TO_NAMEVALUE




ABAP code using 7.40 inline data declarations to call FM CPE_CONVERT_STRUC_TO_NAMEVALUE

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.

 
 
 
 
 
 
 
 
 
 


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!