SAP L_TO_CANCEL Function Module for Cancelling transfer order
L_TO_CANCEL is a standard l to cancel SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Cancelling transfer order 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 to cancel FM, simply by entering the name L_TO_CANCEL into the relevant SAP transaction such as SE37 or SE38.
Function Group: L03B
Program Name: SAPLL03B
Main Program: SAPLL03B
Appliation area: L
Release date: 19-Apr-1995
Mode(Normal, Remote etc): Remote-Enabled
Update:

Function L_TO_CANCEL 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_TO_CANCEL'"Cancelling transfer order.
EXPORTING
I_LGNUM = "Warehouse number
I_TANUM = "Transfer order number
* I_SOLEX = 0 "
* I_CANCL = ' ' "Cancel all open items
* I_SUBST = ' ' "Control subsystem
* I_QNAME = SY-UNAME "User who is executing the cancellation
* I_UPDATE_TASK = ' ' "Indicator: update via update task
* I_COMMIT_WORK = 'X' "Indicator whether COMMIT WORK in function module
TABLES
T_LTAP_CANCL = "Table of individual items to be cancelled
EXCEPTIONS
TO_CONFIRMED = 1 UPDATE_WITHOUT_COMMIT = 10 NO_AUTHORITY = 11 TO_DOESNT_EXIST = 2 ITEM_CONFIRMED = 3 ITEM_DOESNT_EXIST = 4 FOREIGN_LOCK = 5 DOUBLE_LINES = 6 NOTHING_TO_DO = 7 XFELD_WRONG = 8 SU_MOVEMENT_PARTLY_CONFIRMED = 9
IMPORTING Parameters details for L_TO_CANCEL
I_LGNUM - Warehouse number
Data type: LTAK-LGNUMOptional: No
Call by Reference: No ( called with pass by value option)
I_TANUM - Transfer order number
Data type: LTAK-TANUMOptional: No
Call by Reference: No ( called with pass by value option)
I_SOLEX -
Data type: LTAK-SOLEXOptional: Yes
Call by Reference: No ( called with pass by value option)
I_CANCL - Cancel all open items
Data type: RL03B-CANCLDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_SUBST - Control subsystem
Data type: RL03T-SUBSTDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_QNAME - User who is executing the cancellation
Data type: LTAP-QNAMEDefault: SY-UNAME
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_UPDATE_TASK - Indicator: update via update task
Data type: RL03A-VERBUDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_COMMIT_WORK - Indicator whether COMMIT WORK in function module
Data type: RL03B-COMITDefault: 'X'
Optional: Yes
Call by Reference: No ( called with pass by value option)
TABLES Parameters details for L_TO_CANCEL
T_LTAP_CANCL - Table of individual items to be cancelled
Data type: LTAP_CANCLOptional: No
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
TO_CONFIRMED - Transfer order already confirmed
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
UPDATE_WITHOUT_COMMIT - Update via update task only using Commit
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
NO_AUTHORITY - No authorization
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
TO_DOESNT_EXIST - Transfer order does not exist
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
ITEM_CONFIRMED - TO item already confirmed
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
ITEM_DOESNT_EXIST - TO item does not exist
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
FOREIGN_LOCK - An SAP block has been set by another user
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
DOUBLE_LINES - In T_LTAP_CANCL there are multiple entries
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
NOTHING_TO_DO - Acc.to transf.parameter, no proc.required
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
XFELD_WRONG - Incorrect value for checkbox
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
SU_MOVEMENT_PARTLY_CONFIRMED - SU movement already partially confirmed
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for L_TO_CANCEL 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 LTAK-LGNUM, " | |||
| lv_to_confirmed | TYPE LTAK, " | |||
| lt_t_ltap_cancl | TYPE STANDARD TABLE OF LTAP_CANCL, " | |||
| lv_update_without_commit | TYPE LTAP_CANCL, " | |||
| lv_no_authority | TYPE LTAP_CANCL, " | |||
| lv_i_tanum | TYPE LTAK-TANUM, " | |||
| lv_to_doesnt_exist | TYPE LTAK, " | |||
| lv_i_solex | TYPE LTAK-SOLEX, " 0 | |||
| lv_item_confirmed | TYPE LTAK, " | |||
| lv_i_cancl | TYPE RL03B-CANCL, " SPACE | |||
| lv_item_doesnt_exist | TYPE RL03B, " | |||
| lv_i_subst | TYPE RL03T-SUBST, " SPACE | |||
| lv_foreign_lock | TYPE RL03T, " | |||
| lv_i_qname | TYPE LTAP-QNAME, " SY-UNAME | |||
| lv_double_lines | TYPE LTAP, " | |||
| lv_i_update_task | TYPE RL03A-VERBU, " SPACE | |||
| lv_nothing_to_do | TYPE RL03A, " | |||
| lv_xfeld_wrong | TYPE RL03A, " | |||
| lv_i_commit_work | TYPE RL03B-COMIT, " 'X' | |||
| lv_su_movement_partly_confirmed | TYPE RL03B. " |
|   CALL FUNCTION 'L_TO_CANCEL' "Cancelling transfer order |
| EXPORTING | ||
| I_LGNUM | = lv_i_lgnum | |
| I_TANUM | = lv_i_tanum | |
| I_SOLEX | = lv_i_solex | |
| I_CANCL | = lv_i_cancl | |
| I_SUBST | = lv_i_subst | |
| I_QNAME | = lv_i_qname | |
| I_UPDATE_TASK | = lv_i_update_task | |
| I_COMMIT_WORK | = lv_i_commit_work | |
| TABLES | ||
| T_LTAP_CANCL | = lt_t_ltap_cancl | |
| EXCEPTIONS | ||
| TO_CONFIRMED = 1 | ||
| UPDATE_WITHOUT_COMMIT = 10 | ||
| NO_AUTHORITY = 11 | ||
| TO_DOESNT_EXIST = 2 | ||
| ITEM_CONFIRMED = 3 | ||
| ITEM_DOESNT_EXIST = 4 | ||
| FOREIGN_LOCK = 5 | ||
| DOUBLE_LINES = 6 | ||
| NOTHING_TO_DO = 7 | ||
| XFELD_WRONG = 8 | ||
| SU_MOVEMENT_PARTLY_CONFIRMED = 9 | ||
| . " L_TO_CANCEL | ||
ABAP code using 7.40 inline data declarations to call FM L_TO_CANCEL
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 LTAK INTO @DATA(ld_i_lgnum). | ||||
| "SELECT single TANUM FROM LTAK INTO @DATA(ld_i_tanum). | ||||
| "SELECT single SOLEX FROM LTAK INTO @DATA(ld_i_solex). | ||||
| "SELECT single CANCL FROM RL03B INTO @DATA(ld_i_cancl). | ||||
| DATA(ld_i_cancl) | = ' '. | |||
| "SELECT single SUBST FROM RL03T INTO @DATA(ld_i_subst). | ||||
| DATA(ld_i_subst) | = ' '. | |||
| "SELECT single QNAME FROM LTAP INTO @DATA(ld_i_qname). | ||||
| DATA(ld_i_qname) | = SY-UNAME. | |||
| "SELECT single VERBU FROM RL03A INTO @DATA(ld_i_update_task). | ||||
| DATA(ld_i_update_task) | = ' '. | |||
| "SELECT single COMIT FROM RL03B INTO @DATA(ld_i_commit_work). | ||||
| DATA(ld_i_commit_work) | = 'X'. | |||
Search for further information about these or an SAP related objects