ABAP屏幕显示
1write语句
Write关键词,‘/’控制输出换行
语法:write [/] <输出内容>
语法:write at [/<数字>[(数字)]] <输出内容>
示例:
DATA testTxt TYPE String value 'hello world!'. WRITE at / testTxt."换行 WRITE at /5 testTxt."从第5列开始输出 WRITE at /(10) testTxt."只显示10位字符 WRITE at /5(15) testTxt."从第5列开始显示15位字符 WRITE:/'****************************'. "write <obj> <format> 按照固定格式显示 WRITE / testTxt LEFT-JUSTIFIED. "靠左显示 WRITE / testTxt RIGHT-JUSTIFIED. "靠右显示 WRITE / testTxt CENTERED. "居中显示 WRITE / testTxt NO-GAP. "无空格显示 DATA testTime type String value '1234311111'. WRITE / testTime USING EDIT MASK '__:__:__'. "使用固定格式显示 Data testData type String value '00000134'. WRITE / testData no-ZERO."不输出前面0, no-sign 不输出正负号 DATA testData1 type F value '3.44444'. WRITE / testData1 DECIMALS 3 . "显示小数点后位数 DATA testData2 type F value '3.44564'. WRITE / testData2 ROUND 3. "四舍五入小数位数 "write as checkbox WRITE:/'****************************'. DATA: FLAG1 VALUE '', FLAG2 VALUE 'X'. WRITE: / 'CHECK FLAG 1:' , FLAG1 AS CHECKBOX. WRITE: / 'CHECK FLAG 2:' , FLAG2 AS CHECKBOX. "write as sinbol Icon INCLUDE <SYMBOL>. INCLUDE <ICON>. WRITE: / 'Phone Symbol:' , SYM_PHONE AS SYMBOL. WRITE: / 'Alarm Icon:' , ICON_ALARM AS ICON. "Skip产生空白列 WRITE:/'****************************'. SKIP. "产生空白列. DATA:temp LIKE TABLE OF spfli WITH HEADER LINE. SELECT * FROM spfli INTO CORRESPONDING FIELDS OF TABLE temp WHERE CARRID = 'AA'. WRITE:/1(5)'id',(4) '国家',(18) '出发城市',(18) '目标城市'. LOOP AT temp. WRITE:/1(5) temp-connid,(4) temp-countryfr,(18) temp-cityfrom,(18) temp-cityto. ENDLOOP.
2屏幕元素
语法:
输入框:
Parameters: <变量名> type <数据类型>
[default <值>]
[lower case]
[OBLIGATORY]
多选按钮:
Parameters:<变量名> as checkbox [default ‘X’].
设置是否选中
单选按钮:
Parameters:<变量名> radiobutton group <组名>
范围输入框:
Select-options <变量名> for <数据类型>
[NO DATABASE SELECTION]
[NO-EXTENSION]
[NO INTERVALS]
No database selection:如果数据类型是数据库表,不用根据表现有内容选择值;
No-extension: 范围选择框,不显示multi-option画面,
No intervals:只显示一个输入框,不显示范围输入。
单选按钮组:
Selection-screen begin of block <按钮组名> with frame.
Parameter <按钮名> radiobutton group <组名>.
…………
Selection-screen end of block <按钮组名>.
示例1:
"*************************************************** *PARAMETERS, 一些输入框,button,radioButton *************************************************** PARAMETERS: NAME(8) TYPE C DEFAULT 'lily',"设置默认值 addr(10) type C LOWER CASE,"将输入转换成小写,默认输入转换成大写 AGE TYPE I, BIRTH TYPE D OBLIGATORY , "设置强制输入 dog as CHECKBOX DEFAULT 'x',"多选按钮 cat as CHECKBOX . PARAMETERS: boy RADIOBUTTON GROUP sex,"单选按钮 girl RADIOBUTTON GROUP sex. TABLES SPFLI. SELECT-OPTIONS AIRLINE FOR SPFLI-CONNID."范围选择框 SELECT-OPTIONS AIRLINE1 FOR SPFLI-CONNID NO-EXTENSION."范围选择框,不显示multi-option画面 SELECT-OPTIONS AIRLINE2 FOR SPFLI-CONNID NO INTERVALS."范围选择框,不显示区间画面 SELECTION-SCREEN SKIP 1. "产生两个空白列 SELECTION-SCREEN ULINE 20(30). "产生底线,位置(长度) "选择屏幕 SELECTION-SCREEN BEGIN OF BLOCK RADIO WITH FRAME . PARAMETER R1 RADIOBUTTON GROUP GR1. PARAMETER R2 RADIOBUTTON GROUP GR1. PARAMETER R3 RADIOBUTTON GROUP GR1. SELECTION-SCREEN END OF BLOCK RADIO.
示例2:
*选择屏幕pushbutton SELECTION-SCREEN BEGIN OF BLOCK main WITH FRAME TITLE text-001. "带边框和标题 "显示在一行 SELECTION-SCREEN BEGIN OF LINE. "user-command,绑定命令,使用sy-ucomm可以获取到 "pushbutton 位置(长度),指定按钮出现位置和长度 SELECTION-SCREEN PUSHBUTTON 1(20) but1 USER-COMMAND bt1. SELECTION-SCREEN PUSHBUTTON 23(20) but2 USER-COMMAND bt2. SELECTION-SCREEN END OF LINE. SELECTION-SCREEN END OF BLOCK main. "选择屏幕,不带标题 SELECTION-SCREEN BEGIN OF BLOCK main1 WITH FRAME . "只带边框 SELECTION-SCREEN BEGIN OF LINE. SELECTION-SCREEN PUSHBUTTON 1(20) but3 USER-COMMAND bt3. SELECTION-SCREEN PUSHBUTTON 22(20) but4 USER-COMMAND bt4. SELECTION-SCREEN END OF LINE. SELECTION-SCREEN END OF BLOCK main1. INITIALIZATION. * t1 = '输入栏名称'. "but1 = '按键'. CALL FUNCTION 'ICON_CREATE' "给按钮添加图标和文本 EXPORTING name = icon_check "按钮的图片的名字 text = 'button1 按钮1' "按钮的文本 info = '按钮1' IMPORTING result = but1 EXCEPTIONS OTHERS = 0. CALL FUNCTION 'ICON_CREATE' " 给按钮添加图标和文本 EXPORTING name = icon_execute_object " 按钮的图片的名字 text = 'button2 按钮2' "按钮的文本 info = '按钮2' IMPORTING result = but2 EXCEPTIONS OTHERS = 0. CALL FUNCTION 'ICON_CREATE' " 给按钮添加图标和文本 EXPORTING name = icon_execute_object " 按钮的图片的名字 text = 'button3 按钮3' "按钮的文本 info = '按钮3' IMPORTING result = but3 EXCEPTIONS OTHERS = 0. CALL FUNCTION 'ICON_CREATE' " 给按钮添加图标和文本 EXPORTING name = icon_execute_object " 按钮的图片的名字 text = 'button4 按钮4' "按钮的文本 info = '按钮4' IMPORTING result = but4 EXCEPTIONS OTHERS = 0. AT SELECTION-SCREEN. CASE sy-ucomm. WHEN 'BT1'. MESSAGE '您单击了自定义按钮' TYPE 'S'. WHEN 'BT2'. MESSAGE '您单击了自定义按钮2' TYPE 'S'. ENDCASE.
3屏幕弹窗
示例:
********************************************************定义弹窗 "screen 定义窗体 SELECTION-SCREEN BEGIN OF SCREEN 200 as window. PARAMETERS:s_name(10) TYPE C. PARAMETERS:type as CHECKBOX. SELECTION-SCREEN END OF SCREEN 200 . "设置弹窗位置 call SCREEN 200 STARTING AT 50 2 ENDING AT 100 2. "调用screen ,第一个横坐标,第二个纵坐标 "不设置默认include window 显示 call SCREEN 100.
4子屏幕
示例:
"用于screen painter 创建屏幕 SELECTION-SCREEN BEGIN OF SCREEN 300 as SUBSCREEN. PARAMETERS:s_name1(10) TYPE C. PARAMETERS:type1 as CHECKBOX. SELECTION-SCREEN END OF SCREEN 300.
5block和screen
示例:
"*******************************************************block *该语法在屏幕中定义一个BLOCK,其扩展语法包括: *WITH FRAME:创建一个框架。 *TITLE title:创建一个带标题的框架。 *NO INTERVALS:所创建的框架中限制SELECT 只有一个输入项。 SELECTION-SCREEN BEGIN OF BLOCK blk1. PARAMETERS:s_name2(10) TYPE C. SELECTION-SCREEN END OF BLOCK blk1. SELECTION-SCREEN BEGIN OF SCREEN 401. SELECTION-SCREEN BEGIN OF BLOCK blk3 . SELECTION-SCREEN BEGIN OF LINE. "同一行显示 SELECTION-SCREEN POSITION 50. "空格 PARAMETERS:s_name4(10) TYPE C. PARAMETERS:s_name5(10) TYPE C. SELECTION-SCREEN END OF LINE. SELECTION-SCREEN END OF BLOCK blk3. SELECTION-SCREEN END OF SCREEN 401. SELECTION-SCREEN BEGIN OF SCREEN 400. "block可以在screen内 SELECTION-SCREEN BEGIN OF BLOCK blk2 WITH FRAME TITLE text-001 NO INTERVALS. PARAMETERS:s_name3(10) TYPE C. SELECT-OPTIONS s_type FOR SY-REPID. SELECTION-SCREEN ULINE. "换行线 SELECTION-SCREEN SKIP 2. "产生空行 SELECTION-SCREEN END OF BLOCK blk2. SELECT-OPTIONS s_type1 FOR SY-REPID. "include blk,调用其他屏幕定义的block SELECTION-SCREEN INCLUDE BLOCKS blk3. SELECTION-SCREEN END OF SCREEN 400. "调用屏幕 CALL SCREEN 400.
6图示和pushbutton
"**********************************************pushbutton 按钮 INCLUDE <ICON>. "图示 “TCODE”:ICON 查看图示 SELECTION-SCREEN PUSHBUTTON /1(20) btn1 USER-COMMAND btn. SELECTION-SCREEN PUSHBUTTON /1(20) btn2 USER-COMMAND btn. AT SELECTION-SCREEN OUTPUT. MOVE 'my btn1' TO btn1. "为按钮1 赋值添加描述 WRITE ICON_GRAPHICS AS ICON TO btn2. "添加图示 CONCATENATE btn2 'my btn2' INTO btn2 SEPARATED BY SPACE. "按钮2赋值,并连接图示,空格连接
7组件文本显示
"*****************************************selection-screen comment 重设本地元素注释 "必须是在同一line SELECTION-SCREEN BEGIN OF LINE. "文本显示 SELECTION-SCREEN COMMENT (40) text-002 FOR FIELD p1. SELECTION-SCREEN POSITION 45. PARAMETERS p1(10) TYPE C. SELECTION-SCREEN END OF LINE. SELECTION-SCREEN BEGIN OF LINE. PARAMETERS:TYPE AS CHECKBOX. "文本显示 SELECTION-SCREEN COMMENT (40) text-003 FOR FIELD TYPE. SELECTION-SCREEN END OF LINE.
8自定义菜单
示例1:
"******************************************SELECTION-SCREEN FUNCTION KEY n. "用于在工具栏上新增一个功能按钮。该按钮的定义保存在系统结构体SSCRFIELDS中, "n为一个整数的序数,例如当n等于1时,其按钮描述保存在字段SSCRFIELDS-FUNCTXT_01中, "其按钮对象命名为“FC01",保存在字段SSCRFIELDS-UCOMM中。 " * TABLES SSCRFIELDS. SELECTION-SCREEN FUNCTION KEY 1. SELECTION-SCREEN FUNCTION KEY 2. PARAMETERS:s_name(10) TYPE C. INITIALIZATION. MOVE 'BUTTON1' TO SSCRFIELDS-FUNCTXT_01. MOVE 'BUTTON2' TO SSCRFIELDS-FUNCTXT_02. AT SELECTION-SCREEN. if SSCRFIELDS-UCOMM = 'FC01'. MESSAGE i000 WITH 'press button1'. ELSEIF SSCRFIELDS-UCOMM = 'FC02'. MESSAGE i000 WITH 'press button2'. ENDIF.
示例2:
"**********************工具栏菜单,通过菜单制作器 TYPE-POOLS ICON. TABLES SSCRFIELDS. DATA FUNCTXT TYPE SMP_DYNTXT."SMP_DYNTXT(菜单制作器:动态文本的程序接口) PARAMETERS: P_CARRID TYPE S_CARR_ID, P_CITYFR TYPE S_FROM_CIT. SELECTION-SCREEN: FUNCTION KEY 1, FUNCTION KEY 2. INITIALIZATION. "屏幕初始化 FUNCTXT-ICON_ID = ICON_WS_PLANE."文本字段中的图标(替换显示,别名) FUNCTXT-QUICKINFO = 'Preselected Carrier'."菜单制作器:信息文本 (4.0),鼠标移去过去显示的信息TIP FUNCTXT-ICON_TEXT = 'LH'."菜单制作器:图标文本 (4.0),菜单名称 SSCRFIELDS-FUNCTXT_01 = FUNCTXT. FUNCTXT-ICON_TEXT = 'UA'. SSCRFIELDS-FUNCTXT_02 = FUNCTXT. AT SELECTION-SCREEN. CASE SSCRFIELDS-UCOMM. WHEN 'FC01'. P_CARRID = 'LH'. P_CITYFR = 'Frankfurt'. WHEN 'FC02'. P_CARRID = 'UA'. P_CITYFR = 'Chicago'. ENDCASE.
9卷标子屏幕
示例:
"*********************************************tab 标签分页 "用于在屏幕上定义一个分页控件(tab),每个页签都是由一个子屏幕控制,n代表分页控件的高度, "屏幕加载时必须先通过INTIALIZATION事件初始化 SELECTION-SCREEN BEGIN OF SCREEN 100 as SUBSCREEN . SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME. PARAMETERS:s_name(10) TYPE C. SELECTION-SCREEN END OF BLOCK blk1. SELECTION-SCREEN END OF SCREEN 100. SELECTION-SCREEN BEGIN OF SCREEN 200 as SUBSCREEN. PARAMETERS:s_name1(10) TYPE C. SELECTION-SCREEN END OF SCREEN 200. *定义一个TAB空间,取名为MYTAB,控件高为5,共人两个选项卡BUTTON1\BUTTON2 *两个选项卡的功能代码分别为btn1\btn2 SELECTION-SCREEN:BEGIN OF TABBED BLOCK MYTAB FOR 5 LINES, "指框框高度为5LINES. TAB (20) BUTTON1 USER-COMMAND btn1, TAB (20) BUTTON2 USER-COMMAND btn2, END OF BLOCK MYTAB. INITIALIZATION. BUTTON1 = TEXT-010. BUTTON2 = TEXT-020. MYTAB-PROG = SY-REPID. MYTAB-DYNNR = 100. AT SELECTION-SCREEN. CASE SY-UCOMM. WHEN 'BTN1'. MYTAB-DYNNR = 100. MYTAB-ACTIVETAB = 'BUTTON1'. WHEN 'BTN2'. MYTAB-DYNNR = 200. MYTAB-ACTIVETAB = 'BUTTON2'. ENDCASE.
10页签子屏幕
示例:
TABLES SSCRFIELDS. * 定义子屏幕为100 SELECTION-SCREEN BEGIN OF SCREEN 100 AS SUBSCREEN. SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-010. PARAMETERS: P1(10) TYPE C, P2(10) TYPE C, P3(10) TYPE C. SELECTION-SCREEN END OF BLOCK B1. SELECTION-SCREEN END OF SCREEN 100. * 定义子屏幕为200 SELECTION-SCREEN BEGIN OF SCREEN 200 AS SUBSCREEN. SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-020. PARAMETERS: Q1(10) TYPE C, Q2(10) TYPE C, Q3(10) TYPE C. SELECTION-SCREEN END OF BLOCK B2. SELECTION-SCREEN END OF SCREEN 200. *定义子屏幕为300 SELECTION-SCREEN BEGIN OF SCREEN 300 AS SUBSCREEN. SELECTION-SCREEN BEGIN OF BLOCK B3 WITH FRAME TITLE TEXT-030. PARAMETERS: R1(10) TYPE C, R2(10) TYPE C, R3(10) TYPE C. SELECTION-SCREEN END OF BLOCK B3. SELECTION-SCREEN END OF SCREEN 300. * STANDARD SELECTION SCREEN SELECTION-SCREEN: FUNCTION KEY 1, "工具栏按钮 FUNCTION KEY 2. SELECTION-SCREEN: BEGIN OF TABBED BLOCK SUB FOR 10 LINES, END OF BLOCK SUB. INITIALIZATION. SSCRFIELDS-FUNCTXT_01 = '@0D@'. "按钮描述字段,图标形貌 SSCRFIELDS-FUNCTXT_02 = '@0E@'. "按钮描述字段,图标形貌 SUB-PROG = SY-REPID. "必选项 SUB-DYNNR = 100. AT SELECTION-SCREEN. CASE SY-DYNNR. "当前显示屏幕的名称 WHEN 100. IF SSCRFIELDS-UCOMM = 'FC01'. "触发事件的TOOL BAR CONTROL SUB-DYNNR = 300. "指定显示哪个屏幕 ELSEIF SSCRFIELDS-UCOMM = 'FC02'. SUB-DYNNR = 200. ENDIF. WHEN 200. IF SSCRFIELDS-UCOMM = 'FC01'. SUB-DYNNR = 100. ELSEIF SSCRFIELDS-UCOMM = 'FC02'. SUB-DYNNR = 300. ENDIF. WHEN 300. IF SSCRFIELDS-UCOMM = 'FC01'. SUB-DYNNR = 200. ELSEIF SSCRFIELDS-UCOMM = 'FC02'. SUB-DYNNR = 100. ENDIF. ENDCASE.
11动态屏幕
示例:
TABLES:aufk,afvv. SELECTION-SCREEN BEGIN OF BLOCK bl1 WITH FRAME TITLE text-002. PARAMETERS: p1 RADIOBUTTON GROUP g1 USER-COMMAND uc DEFAULT 'X', p2 RADIOBUTTON GROUP g1 . SELECTION-SCREEN END OF BLOCK bl1. SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001. SELECT-OPTIONS:s_date FOR afvv-fssld MODIF ID ty1. SELECTION-SCREEN END OF BLOCK blk1. SELECTION-SCREEN BEGIN OF BLOCK blk2 WITH FRAME TITLE text-003. PARAMETERS:p_werks LIKE aufk-werks MODIF ID ty2. SELECT-OPTIONS:s_aufnr FOR aufk-aufnr MODIF ID ty2. SELECTION-SCREEN END OF BLOCK blk2. AT SELECTION-SCREEN OUTPUT. LOOP AT SCREEN. * CASE screen-group1. * WHEN 'TY1'. * IF p1 IS INITIAL. * screen-active = '0'. * ELSE. * screen-active = '1'. * ENDIF. * WHEN 'TY2'. * IF p2 IS INITIAL. * screen-active = '0'. * ELSE. * screen-active = '1'. * ENDIF. * ENDCASE. if p1 = 'X' AND screen-group1 = 'TY2' . screen-active = '0'. ELSEif p2 = 'X' AND screen-group1 = 'TY1'. screen-active = '0'. ENDIF. MODIFY SCREEN. ENDLOOP. AT SELECTION-SCREEN. * CLEAR sy-ucomm.
12弹出框
调用function,‘POPUP_WITH_TABLE_DISPLAY_OK’显示弹窗。
示例:
DATA :BEGIN OF itab OCCURS 0, name(100) type c, END OF itab. itab-name = 'tang'. APPEND itab. itab-name = 'tang'. APPEND itab. call FUNCTION 'POPUP_WITH_TABLE_DISPLAY_OK' EXPORTING endpos_col = 80 endpos_row = 8 startpos_col = 40 startpos_row = 1 titletext = 'test pop' TABLES valuetab = itab.
参数endpos_col、endpos_row、startpos_col、startpos_row指定弹窗在主屏幕中显示位置。
调用funtion ’POPUP_TO_CONFIRM’显示一个确认弹窗。
示例:
DATA:answer(10) type c. CALL FUNCTION 'POPUP_TO_CONFIRM' EXPORTING TITLEBAR = '确认弹窗' * DIAGNOSE_OBJECT = ' ' TEXT_QUESTION = '请确认' * DEFAULT_BUTTON = '1' DISPLAY_CANCEL_BUTTON = '' * USERDEFINED_F1_HELP = ' ' * START_COLUMN = 25 * START_ROW = 6 * POPUP_TYPE = * IV_QUICKINFO_BUTTON_1 = ' ' * IV_QUICKINFO_BUTTON_2 = ' ' IMPORTING ANSWER = answer * TABLES * PARAMETER = * EXCEPTIONS * TEXT_NOT_FOUND = 1 * OTHERS = 2 . IF SY-SUBRC <> 0. * Implement suitable error handling here else. WRITE:answer. "选择yes 返回1 ; 选择no 返回2; 选择cancel 返回A ENDIF.
调用function,‘POPUP_TO_DECIDE_LIST’显示一个带单选选择列表的弹窗。
示例:
DATA: t_spopli like spopli OCCURS 0 WITH HEADER LINE. DATA: answer(10) type c. t_spopli-selflag = 'X'. "默认选中选项 t_spopli-varoption = 'hello world'. t_spopli-inactive = 'X'. "是否可用 APPEND t_spopli to t_spopli. t_spopli-selflag = 'X'. t_spopli-varoption = 'world'. t_spopli-inactive = ' '. APPEND t_spopli to t_spopli. t_spopli-selflag = ' '. t_spopli-varoption = 'hello'. t_spopli-inactive = ' '. APPEND t_spopli to t_spopli. CALL FUNCTION 'POPUP_TO_DECIDE_LIST' EXPORTING CURSORLINE = 2 * MARK_FLAG = ' ' * MARK_MAX = 1 * START_COL = 0 * START_ROW = 0 TEXTLINE1 = '请选择' * TEXTLINE2 = ' ' * TEXTLINE3 = ' ' TITEL = '选择弹窗' * DISPLAY_ONLY = ' ' IMPORTING ANSWER = answer TABLES T_SPOPLI = t_spopli * EXCEPTIONS * NOT_ENOUGH_ANSWERS = 1 * TOO_MUCH_ANSWERS = 2 * TOO_MUCH_MARKS = 3 * OTHERS = 4 . IF SY-SUBRC <> 0. * Implement suitable error handling here ELSE. WRITE:answer. "反馈选中的选项数 ENDIF.
调用function,‘FILENAME_GET’显示一个输入栏,返回输入内容弹窗。
示例:
"弹出弹窗获取用户输入文件路径 DATA:filename type SDOK_FILNM. CALL FUNCTION 'FILENAME_GET' EXPORTING IV_FILENAME = 'D:\record\test.txt' "默认文件路径 TITLE = '选择文件' IMPORTING EV_FILENAME = filename. WRITE:filename.
调用function,‘POPUP_TO_SELECT_MONTH’显示一个日期选择弹窗。
DATA:select_month like ISELLIST-MONTH. DATA:return like sy-subrc. CALL FUNCTION 'POPUP_TO_SELECT_MONTH' EXPORTING ACTUAL_MONTH = 11 "默认选择月份 FACTORY_CALENDAR = 'CN' "选择年份范围由factory_calendar决定 HOLIDAY_CALENDAR = 'CN' * LANGUAGE = SY-LANGU * START_COLUMN = 8 * START_ROW = 5 IMPORTING SELECTED_MONTH = select_month RETURN_CODE = return * EXCEPTIONS * FACTORY_CALENDAR_NOT_FOUND = 1 * HOLIDAY_CALENDAR_NOT_FOUND = 2 * MONTH_NOT_FOUND = 3 * OTHERS = 4 . IF SY-SUBRC <> 0. * Implement suitable error handling here ELSE. WRITE:'选择了',select_month,'月'. ENDIF.
调用function,‘F4_DATE’显示日期选择弹窗。
DATA:date like WORKFLDS-GKDAY. DATA:week like SCAL-WEEK. DATA:week_begin like sy-datum. DATA:week_end like sy-datum. CALL FUNCTION 'F4_DATE' EXPORTING DATE_FOR_FIRST_MONTH = '20180901' "初始日期,可以不传 * DISPLAY = 'x' FACTORY_CALENDAR_ID = 'CN' * GREGORIAN_CALENDAR_FLAG = ' ' HOLIDAY_CALENDAR_ID = 'CN' * PROGNAME_FOR_FIRST_MONTH = ' ' * DATE_POSITION = 'x' IMPORTING SELECT_DATE = date * SELECT_WEEK = week * SELECT_WEEK_BEGIN = week_begin * SELECT_WEEK_END = week_end EXCEPTIONS CALENDAR_BUFFER_NOT_LOADABLE = 1 DATE_AFTER_RANGE = 2 DATE_BEFORE_RANGE = 3 DATE_INVALID = 4 FACTORY_CALENDAR_NOT_FOUND = 5 HOLIDAY_CALENDAR_NOT_FOUND = 6 PARAMETER_CONFLICT = 7 OTHERS = 8 . IF SY-SUBRC <> 0. * Implement suitable error handling here CASE sy-subrc. WHEN 1. WRITE:/'CALENDAR_BUFFER_NOT_LOADABLE'. WHEN 2. WRITE:/ 'DATE_AFTER_RANGE'. WHEN 3. WRITE:/ 'DATE_BEFORE_RANGE'. WHEN 4. WRITE:/ 'DATE_INVALID'. WHEN 5. WRITE:/ 'HOLIDAY_CALENDAR_ID_MISSING'. WHEN 6. WRITE:/ 'HOLIDAY_CALENDAR_NOT_FOUND'. WHEN 7. WRITE:/ 'PARAMETER_CONFLICT'. WHEN OTHERS. WRITE:/ 'other exception'. ENDCASE. ELSE. WRITE:/'date=',date,'week=',week,'week_begin',week_begin,'week_end',week_end. ENDIF.