SAP BAR_CODE_TRANS Function Module for Bar code translation









BAR_CODE_TRANS is a standard bar code trans SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Bar code translation 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 bar code trans FM, simply by entering the name BAR_CODE_TRANS into the relevant SAP transaction such as SE37 or SE38.

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



Function BAR_CODE_TRANS 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 'BAR_CODE_TRANS'"Bar code translation
EXPORTING
I_BAR_CODE_STRING = "Raw bar code string
I_APP_FIELD = "Application field type
I_WHS_ID = "Warehouse ID
* I_VER_MAT = '1' "

IMPORTING
O_BIN_VER = "Bin verification field
O_DLV = "Delivery field
O_HU = "External handling unit ID
O_BATCH = "Batch Number
O_SU = "Storage unit field
O_MAT = "Material field
O_EAN = "EAN field
O_ALTMAT = "Alternate material field
O_QTY = "Quantity field
O_SHP = "Shipment field
O_GROUP = "Group field
O_MSA = "MS-Area field

EXCEPTIONS
ILLEGAL_BAR_CODE = 1 CONVERSION_ERROR = 2 SYSTEM_ERROR = 3 NUMERIC_ERROR = 4
.




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_SAPLLMGT_001 Extension for barcode translation
EXIT_SAPLLMGT_083 User exit for print

IMPORTING Parameters details for BAR_CODE_TRANS

I_BAR_CODE_STRING - Raw bar code string

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

I_APP_FIELD - Application field type

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

I_WHS_ID - Warehouse ID

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

I_VER_MAT -

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

EXPORTING Parameters details for BAR_CODE_TRANS

O_BIN_VER - Bin verification field

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

O_DLV - Delivery field

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

O_HU - External handling unit ID

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

O_BATCH - Batch Number

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

O_SU - Storage unit field

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

O_MAT - Material field

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

O_EAN - EAN field

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

O_ALTMAT - Alternate material field

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

O_QTY - Quantity field

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

O_SHP - Shipment field

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

O_GROUP - Group field

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

O_MSA - MS-Area field

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

EXCEPTIONS details

ILLEGAL_BAR_CODE - Bar code is not in a readable format

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

CONVERSION_ERROR - Error while translating the bar code string

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

SYSTEM_ERROR - Incorrect customization values

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

NUMERIC_ERROR - Conversion to a number is not possible

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

Copy and paste ABAP code example for BAR_CODE_TRANS 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_o_bin_ver  TYPE LAGP-VERIF, "   
lv_illegal_bar_code  TYPE LAGP, "   
lv_i_bar_code_string  TYPE LAGP, "   
lv_o_dlv  TYPE LTAK-VBELN, "   
lv_o_hu  TYPE VEKP-EXIDV, "   
lv_o_batch  TYPE LTAP-CHARG, "   
lv_o_su  TYPE LEIN-LENUM, "   
lv_i_app_field  TYPE T313D-APPLI, "   
lv_conversion_error  TYPE T313D, "   
lv_o_mat  TYPE LTAP-MATNR, "   
lv_i_whs_id  TYPE LTAP-LGNUM, "   
lv_system_error  TYPE LTAP, "   
lv_o_ean  TYPE MEAN-EAN11, "   
lv_i_ver_mat  TYPE C, "   '1'
lv_numeric_error  TYPE C, "   
lv_o_altmat  TYPE MARA-BISMT, "   
lv_o_qty  TYPE LTAP-VSOLA, "   
lv_o_shp  TYPE VTTK-TKNUM, "   
lv_o_group  TYPE LEMOBDATA-RDWAVE, "   
lv_o_msa  TYPE LEMOBDATA-RDMSAREA. "   

  CALL FUNCTION 'BAR_CODE_TRANS'  "Bar code translation
    EXPORTING
         I_BAR_CODE_STRING = lv_i_bar_code_string
         I_APP_FIELD = lv_i_app_field
         I_WHS_ID = lv_i_whs_id
         I_VER_MAT = lv_i_ver_mat
    IMPORTING
         O_BIN_VER = lv_o_bin_ver
         O_DLV = lv_o_dlv
         O_HU = lv_o_hu
         O_BATCH = lv_o_batch
         O_SU = lv_o_su
         O_MAT = lv_o_mat
         O_EAN = lv_o_ean
         O_ALTMAT = lv_o_altmat
         O_QTY = lv_o_qty
         O_SHP = lv_o_shp
         O_GROUP = lv_o_group
         O_MSA = lv_o_msa
    EXCEPTIONS
        ILLEGAL_BAR_CODE = 1
        CONVERSION_ERROR = 2
        SYSTEM_ERROR = 3
        NUMERIC_ERROR = 4
. " BAR_CODE_TRANS




ABAP code using 7.40 inline data declarations to call FM BAR_CODE_TRANS

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 VERIF FROM LAGP INTO @DATA(ld_o_bin_ver).
 
 
 
"SELECT single VBELN FROM LTAK INTO @DATA(ld_o_dlv).
 
"SELECT single EXIDV FROM VEKP INTO @DATA(ld_o_hu).
 
"SELECT single CHARG FROM LTAP INTO @DATA(ld_o_batch).
 
"SELECT single LENUM FROM LEIN INTO @DATA(ld_o_su).
 
"SELECT single APPLI FROM T313D INTO @DATA(ld_i_app_field).
 
 
"SELECT single MATNR FROM LTAP INTO @DATA(ld_o_mat).
 
"SELECT single LGNUM FROM LTAP INTO @DATA(ld_i_whs_id).
 
 
"SELECT single EAN11 FROM MEAN INTO @DATA(ld_o_ean).
 
DATA(ld_i_ver_mat) = '1'.
 
 
"SELECT single BISMT FROM MARA INTO @DATA(ld_o_altmat).
 
"SELECT single VSOLA FROM LTAP INTO @DATA(ld_o_qty).
 
"SELECT single TKNUM FROM VTTK INTO @DATA(ld_o_shp).
 
"SELECT single RDWAVE FROM LEMOBDATA INTO @DATA(ld_o_group).
 
"SELECT single RDMSAREA FROM LEMOBDATA INTO @DATA(ld_o_msa).
 


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!