SAP L_REF_CREATE Function Module for Create a reference number









L_REF_CREATE is a standard l ref create SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Create a reference number 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 l ref create FM, simply by entering the name L_REF_CREATE into the relevant SAP transaction such as SE37 or SE38.

Function Group: LSAM
Program Name: SAPLLSAM
Main Program: SAPLLSAM
Appliation area: L
Release date: 24-Apr-1995
Mode(Normal, Remote etc): Normal Function Module
Update:



Function L_REF_CREATE 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 'L_REF_CREATE'"Create a reference number
EXPORTING
I_LGNUM = "Warehouse number
* I_2SKCHECK = ' ' "
* I_COMMIT_WORK = 'X' "Commit in functionmodule
* I_CDSTO = ' ' "
I_RBTYP = "Doc.type for reference no.
I_REFNT = "Text for reference no.
* I_REFNR = ' ' "Reference no.
* I_SAMMG = ' ' "Group number
* I_KWPRO = ' ' "
* I_KAPTP = ' ' "
* I_2SKREL = ' ' "
* I_2SKMAT = ' ' "

IMPORTING
E_REFNR_STRU = "Entry for ref.no. in Table 311

TABLES
T_RBNUM = "Table of reference documents

EXCEPTIONS
END_OF_NUMBER_RANGE = 1 REFNR_BLOCKED = 2 RBNUM_IS_IN_REFNR = 3 RBTYP_WRONG = 4 LATER_NOT_AKTIVE = 5
.



IMPORTING Parameters details for L_REF_CREATE

I_LGNUM - Warehouse number

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

I_2SKCHECK -

Data type: RL05S-L2SKP
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

I_COMMIT_WORK - Commit in functionmodule

Data type: RL05S-COMIT
Default: 'X'
Optional: Yes
Call by Reference: No ( called with pass by value option)

I_CDSTO -

Data type: T311-CDSTO
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

I_RBTYP - Doc.type for reference no.

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

I_REFNT - Text for reference no.

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

I_REFNR - Reference no.

Data type: T311-REFNR
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

I_SAMMG - Group number

Data type: T311-SAMMG
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

I_KWPRO -

Data type: T311-KWPRO
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

I_KAPTP -

Data type: T311-KAPTP
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

I_2SKREL -

Data type: T311-L2SKR
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

I_2SKMAT -

Data type: T311-L2SKM
Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)

EXPORTING Parameters details for L_REF_CREATE

E_REFNR_STRU - Entry for ref.no. in Table 311

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

TABLES Parameters details for L_REF_CREATE

T_RBNUM - Table of reference documents

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

EXCEPTIONS details

END_OF_NUMBER_RANGE - End of number range

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

REFNR_BLOCKED - Reference number is blocked

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

RBNUM_IS_IN_REFNR - Ref.doc. alreaday assigned to another ref.no.

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

RBTYP_WRONG - Reference doc.type is incorrect

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

LATER_NOT_AKTIVE -

Data type:
Optional: No
Call by Reference: Yes

Copy and paste ABAP code example for L_REF_CREATE 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_i_lgnum  TYPE T311-LGNUM, "   
lt_t_rbnum  TYPE STANDARD TABLE OF T311A, "   
lv_e_refnr_stru  TYPE T311, "   
lv_end_of_number_range  TYPE T311, "   
lv_i_2skcheck  TYPE RL05S-L2SKP, "   SPACE
lv_i_commit_work  TYPE RL05S-COMIT, "   'X'
lv_i_cdsto  TYPE T311-CDSTO, "   SPACE
lv_i_rbtyp  TYPE T311A-RBTYP, "   
lv_refnr_blocked  TYPE T311A, "   
lv_i_refnt  TYPE T311-REFNT, "   
lv_rbnum_is_in_refnr  TYPE T311, "   
lv_i_refnr  TYPE T311-REFNR, "   SPACE
lv_rbtyp_wrong  TYPE T311, "   
lv_i_sammg  TYPE T311-SAMMG, "   SPACE
lv_later_not_aktive  TYPE T311, "   
lv_i_kwpro  TYPE T311-KWPRO, "   SPACE
lv_i_kaptp  TYPE T311-KAPTP, "   SPACE
lv_i_2skrel  TYPE T311-L2SKR, "   SPACE
lv_i_2skmat  TYPE T311-L2SKM. "   SPACE

  CALL FUNCTION 'L_REF_CREATE'  "Create a reference number
    EXPORTING
         I_LGNUM = lv_i_lgnum
         I_2SKCHECK = lv_i_2skcheck
         I_COMMIT_WORK = lv_i_commit_work
         I_CDSTO = lv_i_cdsto
         I_RBTYP = lv_i_rbtyp
         I_REFNT = lv_i_refnt
         I_REFNR = lv_i_refnr
         I_SAMMG = lv_i_sammg
         I_KWPRO = lv_i_kwpro
         I_KAPTP = lv_i_kaptp
         I_2SKREL = lv_i_2skrel
         I_2SKMAT = lv_i_2skmat
    IMPORTING
         E_REFNR_STRU = lv_e_refnr_stru
    TABLES
         T_RBNUM = lt_t_rbnum
    EXCEPTIONS
        END_OF_NUMBER_RANGE = 1
        REFNR_BLOCKED = 2
        RBNUM_IS_IN_REFNR = 3
        RBTYP_WRONG = 4
        LATER_NOT_AKTIVE = 5
. " L_REF_CREATE




ABAP code using 7.40 inline data declarations to call FM L_REF_CREATE

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 LGNUM FROM T311 INTO @DATA(ld_i_lgnum).
 
 
 
 
"SELECT single L2SKP FROM RL05S INTO @DATA(ld_i_2skcheck).
DATA(ld_i_2skcheck) = ' '.
 
"SELECT single COMIT FROM RL05S INTO @DATA(ld_i_commit_work).
DATA(ld_i_commit_work) = 'X'.
 
"SELECT single CDSTO FROM T311 INTO @DATA(ld_i_cdsto).
DATA(ld_i_cdsto) = ' '.
 
"SELECT single RBTYP FROM T311A INTO @DATA(ld_i_rbtyp).
 
 
"SELECT single REFNT FROM T311 INTO @DATA(ld_i_refnt).
 
 
"SELECT single REFNR FROM T311 INTO @DATA(ld_i_refnr).
DATA(ld_i_refnr) = ' '.
 
 
"SELECT single SAMMG FROM T311 INTO @DATA(ld_i_sammg).
DATA(ld_i_sammg) = ' '.
 
 
"SELECT single KWPRO FROM T311 INTO @DATA(ld_i_kwpro).
DATA(ld_i_kwpro) = ' '.
 
"SELECT single KAPTP FROM T311 INTO @DATA(ld_i_kaptp).
DATA(ld_i_kaptp) = ' '.
 
"SELECT single L2SKR FROM T311 INTO @DATA(ld_i_2skrel).
DATA(ld_i_2skrel) = ' '.
 
"SELECT single L2SKM FROM T311 INTO @DATA(ld_i_2skmat).
DATA(ld_i_2skmat) = ' '.
 


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!