SAP G_CONVERT_INPUT Function Module for Conversion of user inputs









G_CONVERT_INPUT is a standard g convert input SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Conversion of user inputs 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 g convert input FM, simply by entering the name G_CONVERT_INPUT into the relevant SAP transaction such as SE37 or SE38.

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



Function G_CONVERT_INPUT 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 'G_CONVERT_INPUT'"Conversion of user inputs
EXPORTING
* CONVERTED_LENGTH = 0 "Length of the value after the conversion
* CONVEXIT = ' ' "Conversion exit
* DATATYPE = 'CHAR' "Data base field type (for example,
* INPUT_LENGTH = 0 "Length of the entry field (number of characters)
INPUT_VALUE = "Input value as entered by the user
* LENGTH = 0 "Length of the input field (in char
* LOWERCASE = 'X' "
* FLAG_CONVERT_' ' = "

IMPORTING
CONVERTED_VALUE = "Input value after conversion

EXCEPTIONS
DATE_DOES_NOT_EXIST = 1 DATE_FORMAT_UNRECOGNIZED = 2 ILLEGAL_LENGTH = 3 INPUT_IS_NOT_NUMERIC = 4 CONVERSION_FAILURE = 5
.



IMPORTING Parameters details for G_CONVERT_INPUT

CONVERTED_LENGTH - Length of the value after the conversion

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

CONVEXIT - Conversion exit

Data type: DFIES-CONVEXIT
Default: SPACE
Optional: Yes
Call by Reference: Yes

DATATYPE - Data base field type (for example,

Data type: DFIES-DATATYPE
Default: 'CHAR'
Optional: Yes
Call by Reference: Yes

INPUT_LENGTH - Length of the entry field (number of characters)

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

INPUT_VALUE - Input value as entered by the user

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

LENGTH - Length of the input field (in char

Data type: DFIES-LENG
Optional: Yes
Call by Reference: Yes

LOWERCASE -

Data type: DFIES-LOWERCASE
Default: 'X'
Optional: Yes
Call by Reference: Yes

FLAG_CONVERT_SPACE -

Data type: SY-DATAR
Optional: Yes
Call by Reference: Yes

EXPORTING Parameters details for G_CONVERT_INPUT

CONVERTED_VALUE - Input value after conversion

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

EXCEPTIONS details

DATE_DOES_NOT_EXIST - Invalid date

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

DATE_FORMAT_UNRECOGNIZED - Invalid date format

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

ILLEGAL_LENGTH - Inadmissible length specification

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

INPUT_IS_NOT_NUMERIC - Entry in NUMC field not numeric

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

CONVERSION_FAILURE -

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

Copy and paste ABAP code example for G_CONVERT_INPUT 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_converted_value  TYPE ANY, "   
lv_converted_length  TYPE ANY, "   0
lv_date_does_not_exist  TYPE ANY, "   
lv_convexit  TYPE DFIES-CONVEXIT, "   SPACE
lv_date_format_unrecognized  TYPE DFIES, "   
lv_datatype  TYPE DFIES-DATATYPE, "   'CHAR'
lv_illegal_length  TYPE DFIES, "   
lv_input_length  TYPE ANY, "   0
lv_input_is_not_numeric  TYPE ANY, "   
lv_input_value  TYPE ANY, "   
lv_conversion_failure  TYPE ANY, "   
lv_length  TYPE DFIES-LENG, "   0
lv_lowercase  TYPE DFIES-LOWERCASE, "   'X'
lv_flag_convert_space  TYPE SY-DATAR. "   

  CALL FUNCTION 'G_CONVERT_INPUT'  "Conversion of user inputs
    EXPORTING
         CONVERTED_LENGTH = lv_converted_length
         CONVEXIT = lv_convexit
         DATATYPE = lv_datatype
         INPUT_LENGTH = lv_input_length
         INPUT_VALUE = lv_input_value
         LENGTH = lv_length
         LOWERCASE = lv_lowercase
         FLAG_CONVERT_SPACE = lv_flag_convert_space
    IMPORTING
         CONVERTED_VALUE = lv_converted_value
    EXCEPTIONS
        DATE_DOES_NOT_EXIST = 1
        DATE_FORMAT_UNRECOGNIZED = 2
        ILLEGAL_LENGTH = 3
        INPUT_IS_NOT_NUMERIC = 4
        CONVERSION_FAILURE = 5
. " G_CONVERT_INPUT




ABAP code using 7.40 inline data declarations to call FM G_CONVERT_INPUT

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 CONVEXIT FROM DFIES INTO @DATA(ld_convexit).
DATA(ld_convexit) = ' '.
 
 
"SELECT single DATATYPE FROM DFIES INTO @DATA(ld_datatype).
DATA(ld_datatype) = 'CHAR'.
 
 
 
 
 
 
"SELECT single LENG FROM DFIES INTO @DATA(ld_length).
 
"SELECT single LOWERCASE FROM DFIES INTO @DATA(ld_lowercase).
DATA(ld_lowercase) = 'X'.
 
"SELECT single DATAR FROM SY INTO @DATA(ld_flag_convert_space).
 


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!