SAP TREX_GET_ATTRIBUTE_TYPE Function Module for Determine TREX attribute type from DDIC type









TREX_GET_ATTRIBUTE_TYPE is a standard trex get attribute type SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Determine TREX attribute type from DDIC type 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 trex get attribute type FM, simply by entering the name TREX_GET_ATTRIBUTE_TYPE into the relevant SAP transaction such as SE37 or SE38.

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



Function TREX_GET_ATTRIBUTE_TYPE 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 'TREX_GET_ATTRIBUTE_TYPE'"Determine TREX attribute type from DDIC type
EXPORTING
* IV_DATATYPE_4 = "4 digit Data Type in ABAP dictionary (e.g.: CHAR)
* IV_DATATYPE_1 = "1 digit Data Type in ABAP runtime (e.g.: C)
* IV_LENG = "Length (No. of Characters)
* IV_DECIMALS = "Number of Decimal Places
* IV_LOWERCASE = "Lowercase letters allowed/not allowed
* IV_DOMNAME = "Domain name Domain name (for timestamp + GUID)

IMPORTING
EV_ATTRIBUTE_TYPE = "TREX attribute type
EV_DIGITS_BEFORE = "Optional for type X: digits before decimal point
EV_DIGITS_AFTER = "Optional for type X: digits after decimal point
.



IMPORTING Parameters details for TREX_GET_ATTRIBUTE_TYPE

IV_DATATYPE_4 - 4 digit Data Type in ABAP dictionary (e.g.: CHAR)

Data type: DD04V-DATATYPE
Optional: Yes
Call by Reference: Yes

IV_DATATYPE_1 - 1 digit Data Type in ABAP runtime (e.g.: C)

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

IV_LENG - Length (No. of Characters)

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

IV_DECIMALS - Number of Decimal Places

Data type: DD04V-DECIMALS
Optional: Yes
Call by Reference: Yes

IV_LOWERCASE - Lowercase letters allowed/not allowed

Data type: DD04V-LOWERCASE
Optional: Yes
Call by Reference: Yes

IV_DOMNAME - Domain name Domain name (for timestamp + GUID)

Data type: DD04V-DOMNAME
Optional: Yes
Call by Reference: Yes

EXPORTING Parameters details for TREX_GET_ATTRIBUTE_TYPE

EV_ATTRIBUTE_TYPE - TREX attribute type

Data type: TREXS_ATTR_DEF-ATTR_TYPE
Optional: No
Call by Reference: Yes

EV_DIGITS_BEFORE - Optional for type X: digits before decimal point

Data type: TREXS_ATTR_DEF-DIGITS_BEFORE
Optional: No
Call by Reference: Yes

EV_DIGITS_AFTER - Optional for type X: digits after decimal point

Data type: TREXS_ATTR_DEF-DIGITS_AFTER
Optional: No
Call by Reference: Yes

Copy and paste ABAP code example for TREX_GET_ATTRIBUTE_TYPE 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_datatype_4  TYPE DD04V-DATATYPE, "   
lv_ev_attribute_type  TYPE TREXS_ATTR_DEF-ATTR_TYPE, "   
lv_iv_datatype_1  TYPE ABAPTYPE, "   
lv_ev_digits_before  TYPE TREXS_ATTR_DEF-DIGITS_BEFORE, "   
lv_iv_leng  TYPE DDLENG, "   
lv_ev_digits_after  TYPE TREXS_ATTR_DEF-DIGITS_AFTER, "   
lv_iv_decimals  TYPE DD04V-DECIMALS, "   
lv_iv_lowercase  TYPE DD04V-LOWERCASE, "   
lv_iv_domname  TYPE DD04V-DOMNAME. "   

  CALL FUNCTION 'TREX_GET_ATTRIBUTE_TYPE'  "Determine TREX attribute type from DDIC type
    EXPORTING
         IV_DATATYPE_4 = lv_iv_datatype_4
         IV_DATATYPE_1 = lv_iv_datatype_1
         IV_LENG = lv_iv_leng
         IV_DECIMALS = lv_iv_decimals
         IV_LOWERCASE = lv_iv_lowercase
         IV_DOMNAME = lv_iv_domname
    IMPORTING
         EV_ATTRIBUTE_TYPE = lv_ev_attribute_type
         EV_DIGITS_BEFORE = lv_ev_digits_before
         EV_DIGITS_AFTER = lv_ev_digits_after
. " TREX_GET_ATTRIBUTE_TYPE




ABAP code using 7.40 inline data declarations to call FM TREX_GET_ATTRIBUTE_TYPE

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 DATATYPE FROM DD04V INTO @DATA(ld_iv_datatype_4).
 
"SELECT single ATTR_TYPE FROM TREXS_ATTR_DEF INTO @DATA(ld_ev_attribute_type).
 
 
"SELECT single DIGITS_BEFORE FROM TREXS_ATTR_DEF INTO @DATA(ld_ev_digits_before).
 
 
"SELECT single DIGITS_AFTER FROM TREXS_ATTR_DEF INTO @DATA(ld_ev_digits_after).
 
"SELECT single DECIMALS FROM DD04V INTO @DATA(ld_iv_decimals).
 
"SELECT single LOWERCASE FROM DD04V INTO @DATA(ld_iv_lowercase).
 
"SELECT single DOMNAME FROM DD04V INTO @DATA(ld_iv_domname).
 


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!