Yuxin's profileDream SpacePhotosBlogLists Tools Help

Blog


    4/18/2008

    [SAP]Saving Passwords for SAP shortcuts

    Passwords are not saved in shortcuts created within SAPGUI.
    In fact, when you edit a shortcut the password field is grayed out.
    Why? Because you need to first register the SAPshortcuts using:
    sapshcut -register
    SAPSHCUT.exe is located under the SAPpcsapgui directory.
    In SAPGUI 4.0 it was called SAPSH.exe.
    Once you do the registration you need to open the registry (regedit or regedt32) and change the value data of "EnablePassword" to "1" under:
    [HKCU]\Software\SAP\SAPShortcut\Security
    Then, you will be able to type and save your passwords.
    SAP Shortcut

    4/15/2008

    [ABAP]How to assign Fun. key to reserved key F4,Shift+F10

    How to assign Function key to 【予約機能キー】(reserved key) F4 and Shift-F10 ?
     
    In Menu painter(SE41) place the cursor on the Function keys and click the "attributes" button in application tool bar or click Shift+F1.
    Then one pop-up screen appear where click the "Function keys for standard function handling in lists" checkbox.

    Then can have the option【予約機能キー】(Reserved Key) to assign your own function code for F4 key and Shift-F10 key.
    4/10/2008

    Authorization Checks in Your Own Developments

    procedurAuthorization Checks in Your Own Developments
    Each time a transaction is started, the system automatically checks for authorization object S_TCODE. This check is also executed for any transactions that you created yourself.
    If you use the Profile Generator to generate your authorization profiles automatically, the authorizations for the authorization object S_TCODE are contained in the profiles.
    You can also add your own authorization checks to protect critical points in your ABAP programs.
    achtungIf you call a transaction indirectly, that is from another transaction, the authorization check is not automatically performed. You must use transaction SE97 to set the check indicator check for the entry for the pair of calling and called transaction to ensure that the called transactions are also subject to an authorization check (see SAP Note 358122).
    Adding Authorization Checks to Programs
    In order to maintain authorization objects and fields, you need access to the authorization object Authorizations (S_USER_AUT).
    To add authorization checks to programs, you need to do the following:
           1.      Create an Authorization Field
           2.      Create an Authorization Object
           3.      Programming Authorization Checks
    Use the ABAP AUTHORITY-CHECK statement. Specify alphabetic values in uppercase letters: ABC. Test values from user master records are converted to uppercase before being passed to AUTHORITY-CHECK.
    See the ABAP programming documentation for more information (bookcheck authorization).
    4/2/2008

    SAP Field Exits

    From 4.6c onwards, Field exits will no more be supported by SAP.  They removed the function of field exit but they had given lot of flexibility through userexit.

    However, if you still required it, here is how to activate it :-

    First called up transaction  CMOD.
    Then called up transaction PRFB.

    or

    Activation of the field exits and assignment of the dynpros can also be carried out using program RSMODPRF. For this purpose, the program must be started without parameters (input fields remain blank).  If required, new field exits can be created using program RSMODPRF (see the program documentation).

    http://www.sap-basis-abap.com/sapab014.htm

    2/10/2008

    解决win xp sp2及win 2003 sp1看不了sapshow notes的方法

    Start Registry Editor (Start -> Run -> regedit.exe)
     
    Select the following key in the Windows registry:
     
    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\
    Main\FeatureControl\FEATURE_DISABLE_MK_PROTOCOL]
     
    -  Select "New" -> "DWORD Value"
       Value Name: sapshow.exe
       Value: 0x00000000
    7/19/2007

    ABAP中LOCAL关键字的使用

      Local语句可以保护在子过程对全局变量的修改不会影响到子过程之外。特别是在子过程里不能直接使用Tables定义工作区,既是你将TABLES语句写在子过程里,该工作区也是全局性的。
     
      如果你需要定义子程序内的工作区,你可以先用tables定义一个全局的,再在子程序里使用local定义本地的,代码样例如下:

    REPORT demo_mod_tech_local.
    TABLES sflight.
    PERFORM tabtest1.
    WRITE: / sflight-planetype, sflight-price currency sflight-currency.

    PERFORM tabtest2.
    WRITE: / sflight-planetype, sflight-price currency sflight-currency.

    FORM tabtest1.
      sflight-planetype = 'A310'.
      sflight-price = '150.00'.
      WRITE: / sflight-planetype, sflight-price currency sflight-currency.
    ENDFORM.

    FORM tabtest2.
      LOCAL sflight.
      sflight-planetype = 'B747'.
      sflight-price = '500.00'.
      WRITE: / sflight-planetype, sflight-price currency sflight-currency.
    ENDFORM.

    5/31/2007

    But fix for SAPgui for windows 640 and IE 7.00

    With upgrading your MS Internet Explorer to release 7.00 and running SAP GUI for Windows 6.40 the GUI controls based on HTML might work no longer properly.

    To fix this bug it is neseccary to patch your SAP GUI to patchlevel 23. Download the patch and run the exe-file on the machine where the SAP GUI for Windows 6.40 is installed.

    5/14/2007

    Using shortcut to auto logon SAPgui

    As you know, SAPgui connection has the timeout setting, so we have to logon the SAPgui continually.
    Now, I will introduce an easy setting to you for autologon.
    1. run the command 'REGEDIT'
    2. Find the key 'HKEY_CURRENT_USER\Software\SAP\SAPShortcut\Security'
    3. change the value of the string 'EnablePassword' from 0 to 1.
    4. start the SAPgui logon to create a shortcut for autologon.

    This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email by you is prohibited.

    5/12/2007

    SAP ALV的Header内容如何居中

    ”SAP ALV的Header内容如何居中?
    “如果会写HTML语句,就简单多了。请看下面例子。
     
    REPORT zzzz_test_alv. "@ides 900
     
    ........
     
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_buffer_active          = space
          i_callback_program       = 'ZZZZ_TEST_ALV'
          i_callback_pf_status_set = l_c_manu
          i_callback_user_command  = l_c_func
    *      I_CALLBACK_TOP_OF_PAGE   = 'ALV_TOP_OF_PAGE'
          i_callback_html_top_of_page
                                   = 'HTML_TOP_OF_PAGE'

          it_fieldcat              = l_itab_fcat
          is_layout                = l_str_layout
          it_events                = itab_event
          i_grid_settings          = l_str_gridset
        TABLES
          t_outtab                 = itab_dis
        EXCEPTIONS
          program_error            = 1
          OTHERS                   = 2.
     
     
     
    FORM html_top_of_page
      USING
        cl_dd TYPE REF TO cl_dd_document.
     
      DATA:
        l_mp            TYPE i,
        l_fp            TYPE i,
        l_mbuff         TYPE string,
        l_string(99).
     
    * You must using HTML to modify your header.
      CONCATENATE '<CENTER><H1>My header test</H1 ></CENTER>'
                  '<br>Created by: '   sy-uname
                  '<br>Created date: ' sy-datum
             INTO l_mbuff.
    *
      CALL METHOD cl_dd->html_insert
        EXPORTING
          contents = l_mbuff
        CHANGING
          position = l_mp.
     
    ENDFORM.                    " html_top_of_page
    5/1/2007

    Introduction to SELECTION-SCREEN Function Keys

    SAP的选择屏幕的标准工具栏上系统预先定义了5个按钮,他们对应的功能码是FC01-FC05,默认是不激活的。用户可以使用SELECTION-SCREEN FUNCTION KEY i.来激活这5个按钮(这里的i必须是1-5),这五个按钮的文本放在SSCRFields的对应的Functxt_0i中。当用户按下按钮时,系统将触发AT SELECTION-SCREEN 事件,并将功能码放到sscrfieldsucomm字段中。

    代码样例:
    REPORT demo_sel_screen_function_key.

    TABLES sscrfields.                 "定义工作区

    PARAMETERS: p_carrid TYPE s_carr_id,
                p_cityfr TYPE s_from_cit.

    SELECTION-SCREEN: FUNCTION KEY 1,   "激活按钮
                      FUNCTION KEY 2.

    INITIALIZATION.
      sscrfields-functxt_01 = 'LH'.    "定义按钮文本
      sscrfields-functxt_02 = 'UA'.
      

    AT SELECTION-SCREEN.
      CASE sscrfields-ucomm.          "处理按钮命令
          WHEN'FC01'.
          p_carrid = 'LH'.
          p_cityfr = 'Frankfurt'.
        WHEN 'FC02'.
          p_carrid = 'UA'.
          p_cityfr = 'Chicago'.
      ENDCASE.

    START-OF-SELECTION.
      WRITE / 'START-OF-SELECTION'.

    注意:AT SELECTION-SCREEN事件执行后,系统将再次显示屏幕,只有当用选择Execute(F8),系统才会进行其他事件的执行。

    CL_ABAP_CHAR_UTILITIES

    在编写SAP程序时,程序员经常需要将常字符串进行分割,在字符串中加入回车换行或TAB字符,在其他语言可以使用$13$10的ASCII码进行插入.而在abap里却出错,为了解决此问题,请使用sap的类CL_ABAP_CHAR_UTILITIES.
    CL_ABAP_CHAR_UTILITIES中有字符常量:如:CR_LF,HORIZONTAL_TAB,NEWLINE等等.
    下面给出字符串中加入回车换行的示例:
    DATA: crlf(2) TYPE c.
    DATA: l_html(4096)  TYPE C.
    crlf = cl_ABAP_char_utilities=>cr_lf.

    Implement DropDownList on Selection Screen

    "Implement DropDownList on Selection Screen
    REPORT ZMENG_SO_LIST.
     
    TYPE-POOLS vrm.
     
    DATA: l_name    TYPE vrm_id,
          itab_list TYPE vrm_values,
          str_value LIKE LINE OF itab_list.
     

    PARAMETERS: ps_parm(20) AS LISTBOX VISIBLE LENGTH 20.
     
    AT SELECTION-SCREEN OUTPUT.
     
      l_name = 'PS_PARM'.
     
      str_value-key = 'NO1'.
      str_value-text = 'YULONG.CHEN'.
      APPEND str_value TO itab_list.
     
      str_value-key = 'NO2'.
      str_value-text = 'XIAOHUA.SUN'.
      APPEND str_value TO itab_list.
     
      str_value-key = 'NO3'.
      str_value-text = 'FANG.YU'.
      APPEND str_value TO itab_list.
     
      CALL FUNCTION 'VRM_SET_VALUES'
           EXPORTING
                id     = l_name
                values = itab_list.
     
    START-OF-SELECTION.
      WRITE: / 'Parameter:', ps_parm.
    2/8/2007

    [ABAP] Add select-options screen to screen

    1 、定义select-options screen

    TABLES: t001.
    DATA: number(4) TYPE n VALUE '1100'.
    SELECTION-SCREEN BEGIN OF SCREEN 1100 AS SUBSCREEN.
    SELECTION-SCREEN BEGIN OF BLOCK block_0 WITH FRAME TITLE text-000.
    SELECT-OPTIONS so_bukrs FOR t001-bukrs.
    SELECTION-SCREEN END OF BLOCK block_0.
    SELECTION-SCREEN END OF SCREEN 1100.

    2、定义屏幕100
    在屏幕100加入一个子屏幕sub_screen: sub1

    3、定义屏幕100 BPO
    PROCESS BEFORE OUTPUT.
    MODULE status_0100.
    CALL SUBSCREEN: sub1 INCLUDING sy-repid number.

    4定义屏幕100 PAI
    PROCESS AFTER INPUT.
    CALL SUBSCREEN: sub1.
    MODULE exit_command AT EXIT-COMMAND.
    MODULE user_command_0100.

    This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email by you is prohibited.

    12/14/2006

    [BC] To view the user list

    TCode - Description
    ----------------------------------
    AL08 - Users Logged On
    SM04 - User List
     

    This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email by you is prohibited.

    12/12/2006

    [ABAP] Finding the user-exits of a SAP transaction code

    REPORT zmeng_exit  NO STANDARD PAGE HEADING.
    *
    * Finding the user-exits of a SAP transaction code
    *
    * Enter the transaction code in which you are looking for the user-exit
    * and it will list you the list of user-exits in the transaction code.
    * Also a drill down is possible which will help you to branch to SMOD.
    *
    * Written by : SAP Basis, ABAP Programming and Other IMG Stuff
    *              http://www.sap-img.com
    *
     
    TABLES : tstc, tadir, modsapt, modact, trdir, tfdir, enlfdir.
    TABLES : tstct.
     
    DATA : jtab LIKE tadir OCCURS 0 WITH HEADER LINE.
    DATA : field1(30).
    DATA : v_devclass LIKE tadir-devclass.
     
    PARAMETERS : p_tcode LIKE tstc-tcode OBLIGATORY.
     
    SELECT SINGLE * FROM tstc WHERE tcode EQ p_tcode.
    IF sy-subrc EQ 0.
      SELECT SINGLE * FROM tadir WHERE pgmid = 'R3TR'
                       AND object = 'PROG'
                       AND obj_name = tstc-pgmna.
      MOVE : tadir-devclass TO v_devclass.
      IF sy-subrc NE 0.
        SELECT SINGLE * FROM trdir WHERE name = tstc-pgmna.
        IF trdir-subc EQ 'F'.
          SELECT SINGLE * FROM tfdir WHERE pname = tstc-pgmna.
          SELECT SINGLE * FROM enlfdir WHERE funcname =
          tfdir-funcname.
          SELECT SINGLE * FROM tadir WHERE pgmid = 'R3TR'
                             AND object = 'FUGR'
                             AND obj_name EQ enlfdir-area.
     
          MOVE : tadir-devclass TO v_devclass.
        ENDIF.
      ENDIF.
      SELECT * FROM tadir INTO TABLE jtab
                    WHERE pgmid = 'R3TR'
                      AND object = 'SMOD'
                      AND devclass = v_devclass.
      SELECT SINGLE * FROM tstct WHERE sprsl EQ sy-langu AND
                                       tcode EQ p_tcode.
      FORMAT COLOR COL_POSITIVE INTENSIFIED OFF.
      WRITE:/(19) 'Transaction Code - ',
           20(20) p_tcode,
           45(50) tstct-ttext.
      SKIP.
      IF NOT jtab[] IS INITIAL.
        WRITE:/(95) sy-uline.
        FORMAT COLOR COL_HEADING INTENSIFIED ON.
        WRITE:/1 sy-vline,
               2 'Exit Name',
              21 sy-vline ,
              22 'Description',
              95 sy-vline.
        WRITE:/(95) sy-uline.
        LOOP AT jtab.
          SELECT SINGLE * FROM modsapt
                 WHERE sprsl = sy-langu AND
                        name = jtab-obj_name.
          FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
          WRITE:/1 sy-vline,
                 2 jtab-obj_name HOTSPOT ON,
                21 sy-vline ,
                22 modsapt-modtext,
                95 sy-vline.
        ENDLOOP.
        WRITE:/(95) sy-uline.
        DESCRIBE TABLE jtab.
        SKIP.
        FORMAT COLOR COL_TOTAL INTENSIFIED ON.
        WRITE:/ 'No of Exits:' , sy-tfill.
      ELSE.
        FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
        WRITE:/(95) 'No User Exit exists'.
      ENDIF.
    ELSE.
      FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
      WRITE:/(95) 'Transaction Code Does Not Exist'.
    ENDIF.
     
    AT LINE-SELECTION.
      GET CURSOR FIELD field1.
      CHECK field1(4) EQ 'JTAB'.
      SET PARAMETER ID 'MON' FIELD sy-lisel+1(10).
      CALL TRANSACTION 'SMOD' AND SKIP FIRST   SCREEN.
     
    *---End of Program

    This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email by you is prohibited.

    12/3/2006

    [ZT] 如何进行各种码制数据之间转换

    1 系统内部转换命令(一般建议不直接使用) 
    SYSTEM-CALL CONVERT ID id DATA data
        ENCODING encoding
        ENDIAN endian
        IGNORE_CERR ignore_cerr N n
        POSITION position
        REPLACEMENT replacement
        LEN len
        BUFFER buffer
        ERR err.
    Text and lines are converted between different formats.

    2 使用SAP系统封装的类CL_ABAP_CONV_IN_CE and  CL_ABAP_CONV_OUT_CE
    样例
    data  STR TYPE C.

      DATA: S TYPE STRING,
            LEN TYPE I.
      DATA: CVTI_UTF8 TYPE REF TO CL_ABAP_CONV_IN_CE.
      FIELD-SYMBOLS : <X> TYPE X.

      ASSIGN STR TO <X> CASTING.

      CVTI_UTF8 =  CL_ABAP_CONV_IN_CE=>CREATE( ENCODING = 'UTF-8' INPUT    = <X> ).

      CALL METHOD CVTI_UTF8->READ
        IMPORTING
            DATA = S
            LEN  = LEN
        EXCEPTIONS OTHERS = 1.

      STR = S.

    3 使用sap封装的Form
    要包含以下单元:RSCPICINC
    封装的form
    CONV_TO_ASCII
    CONV_TO_EBCDIC
    CONV_TO_UTF8
    CONV_FROM_ASCII
    CONV_FROM_ASCII
    CONV_FROM_EBCDIC

    4使用sap封装的函数(外部->系统默认代码,系统默认代码->外部)
    function translate_codepage_in.

    *"  IMPORTING
    *"     VALUE(CODEPAGE_FROM) TYPE  ABAP_ENCOD
    *"  TABLES
    *"      T_DATA
    *"  EXCEPTIONS
    *"      ERROR_TRANSLATE
    function translate_codepage_out.
    *"  IMPORTING
    *"     VALUE(CODEPAGE_FROM) TYPE  ABAP_ENCOD
    *"  TABLES
    *"      T_DATA
    *"  EXCEPTIONS
    *"      ERROR_TRANSLATE

    5使用TRANSLATE命令
    TRANSLATE c ...FROM CODE PAGE g1...     TO CODE PAGE g2.

    6 常见代码编号
    EBCDIC = '0100'
    ASCII  =  '1100'
    UTF8 = 'UTF-8'

    7 相关的元素
    ABAP_ENCOD
    TCP00(表)

    Saved From : http://blog.csdn.net/CompassButton/archive/2006/11/28/1418479.aspx

    12/1/2006

    ABAP: Check the file extension in the selection screen.

    ABAP: Check the file extension in the selection screen.

    REPORT zmeng_testi .

    DATA: file_filter TYPE string .
    DATA: wf_filetab TYPE filetable.
    DATA: wf_filerc  TYPE sy-subrc.

    PARAMETERS: p_file TYPE PCFILE-PATH LOWER CASE .


    INITIALIZATION.
      file_filter = 'PDF files (*.pdf*)|*.pdf*'.


    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

    * allow user to only select pdf file.
      CALL METHOD cl_gui_frontend_services=>file_open_dialog
        EXPORTING
          window_title            = 'Select the File'
    *    DEFAULT_EXTENSION       = cl_gui_frontend_services=>FILETYPE_TEXT
    *    DEFAULT_FILENAME        =
         file_filter              = file_filter
    *    INITIAL_DIRECTORY       =
    *    MULTISELECTION          =
        CHANGING
          file_table              = wf_filetab
          rc                      = wf_filerc
    *    USER_ACTION             =
    *  EXCEPTIONS
    *    file_open_dialog_failed = 1
    *    cntl_error              = 2
    *    error_no_gui            = 3
    *    not_supported_by_gui    = 4
    *    OTHERS                  = 5
              .

      READ TABLE wf_filetab INTO p_file INDEX 1.

    START-OF-SELECTION.

    * ABAP: Check the file extension in the selection screen.
      DATA: l_drive  LIKE pcfile-drive,
            l_path   LIKE pcfile-path,
            l_ext(3) TYPE c.

      CALL FUNCTION 'PC_SPLIT_COMPLETE_FILENAME'
        EXPORTING
          complete_filename = p_file
    *      CHECK_DOS_FORMAT =
        IMPORTING
          drive = l_drive
          extension = l_ext
    *     NAME =
    *     NAME_WITH_EXT =
          path = l_path
    *   EXCEPTIONS
    *   INVALID_DRIVE = 1
    *   INVALID_EXTENSION = 2
    *   INVALID_NAME = 3
    *   INVALID_PATH = 4
    *   OTHERS = 5
    .


      write: / 'File name = ', p_file,
             / 'Drive     = ', l_drive,
             / 'Extension = ', l_ext,
             / 'Path      = ', l_path.

    This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email by you is prohibited.

    11/7/2006

    正确地使用SAP的标准对话框函数[转]

    在用户设计sap的程序时,经常需要一些对话框,用户可以自己编写,但使用SAP系统中提供了的对话框函数将减少许多开发工作。

    1、sap的函数组列表和用途说明

    适用情况

    Function group

    提示用户将可能丢失数据

    SPO1

    提示用户对某个问题选择Yes或者No 

    SPO1

    提示用户将可能丢失数据, 并询问用户是否继续操作

    SPO1

    提示用户在多个操作中选择一个操作

    SPO2

    提示用户是继续当前操作或者取消当前操作

    SPO2

    提示用户输入数据 (可以根据一个表检查或者不检查输入值)

    SPO4

    将数据显示给用户

    SPO4

    将详细数据显示给用户

    SPO6

    从列表中选择数据 SP05

    用可滚动的对话框显示数据给用户

    STAB

    从视图或者数据表中打印数据

    STPR

     

    2、函数列表和说明
    2.1 SPO1的函数

    • POPUP_TO_CONFIRM_STEP
      用此函数可以建立一个对话框用于询问用户是否执行某步操作,用户可以选择Yes No或者Cancel。该函数可以传入一个标题和两行的文本(提示问题)。系统在窗口上显示一个绿色问号图标。
      可以设置某个按钮作为默认按钮。
           CALL FUNCTION 'POPUP_TO_CONFIRM_STEP'
                EXPORTING TITEL        = '确认提示测试'
                          TEXTLINE1    =  '确实要执行'
                          TEXTLINE2    = '测试?'
                          CANCEL_DISPLAY = SPACE  "不显示CANCEL按钮
                IMPORTING ANSWER       = ANSWER.
    • POPUP_TO_CONFIRM_WITH_MESSAGE
      类似POPUP_TO_CONFIRM_STEP,只是多三行的文本错误诊断提示。 系统在窗口上显示一个绿色问号图标。
           call function 'POPUP_TO_CONFIRM_WITH_MESSAGE'
                exporting titel         = '确认提示测试'
                          textline1     =  '确实要执行                         ;;'
                          textline2     = spop-textline2
                          diagnosetext1 = spop-diagnose1
                          diagnosetext2 = spop-diagnose2
                          diagnosetext3 = spop-diagnose3
                importing answer        = answer.
    • POPUP_TO_CONFIRM_WITH_VALUE
      用此函数可以建立一个对话框用于询问用户是否执行某步操作,该操作可能会丢失数据,用户可以选择Yes No或者Cancel。该函数可以传入一个标题,两行的文本(提示问题)和一个对象值(对象值将会插入在提示问题文本的两部分之间)。系统在窗口上显示一个绿色问号图标。
      可以设置某个按钮作为默认按钮。
           CALL FUNCTION 'POPUP_TO_CONFIRM_WITH_VALUE'
                EXPORTING TITEL        = TITEL
                          TEXT_BEFORE  = '确实要执行'
                          OBJECTVALUE  = 'TEST'
                          TEXT_AFTER   = '?'
                IMPORTING ANSWER       = ANSWER.
    • POPUP_TO_CONFIRM_LOSS_OF_DATA
      用此函数可以建立一个对话框用于询问用户是否执行某步操作,该操作可能会丢失数据,用户可以选择Yes No或者Cancel。该函数可以传入一个标题和一个两行的文本(提示问题)。 系统在窗口上显示一个黄色!图标和一行“数据将丢失。”。
      可以设置某个按钮作为默认按钮。
           CALL FUNCTION 'POPUP_TO_CONFIRM_LOSS_OF_DATA'
                EXPORTING TITEL        = TITEL
                          TEXTLINE1    = SPOP-TEXTLINE1
                          TEXTLINE2    = SPOP-TEXTLINE2
                IMPORTING ANSWER       = ANSWER.
    • POPUP_TO_CONFIRM
      该函数是POPUP函数的增强版,可以自定义按钮文本和图标。

    2.2、Function group SPO2

    • POPUP_TO_DECIDE
    • 显示一个对话框,用户可以两个操作中的一个或者取消。可以传入三行提示文本。
    • POPUP_TO_DECIDE_WITH_MESSAGE
    • 类同POPUP_TO_DECIDE,程序员可以多传入With this function module you create a dialog box in which you inform the user about a specific decision point via a diagnosis text, during an action. He or she can choose one of two alternative actions offered or cancel the action.
      The action, the diagnosis text, the question and the alternative actions are passed as parameters.
      The user action (Alternative 1, Alternative 2, or Cancel) is returned in a parameter.

    2.3、Function group SPO4

    • POPUP_GET_VALUES
      This function module sends a dialog box for data display and input.
      The input fields are passed in a structure and must be defined in the Dictionary. You can also specify individual field display attributes and a field text, if the key word from the Dictionary is not to be displayed as field text in the dialog box, in the structure.
      The standard help functionality (F1, F4) is supported.
    • POPUP_GET_VALUES_DB_CHECKED
      This function module sends a dialog box for data to be input und checked against the database.
      The input fields are passed in a structure and must be defined in the Dictionary. You can also specify individual field display attributes and a field text in the structure, if the key word from the Dictionary is not to be displayed as field text in the dialog box.
      A comparison operator for checking the input data in the database is passed. You can specify whether the check is for the existence or absence of an object. A foreign key relationship check is supported.
      The standard help functionality (F1, F4) is supported.
      The user action is returned in a parameter.
    • POPUP_GET_VALUES_USER_CHECKED
    • This function module sends a dialog box for data to be input and checked in an external sub-routine (user exit). The input fields are passed in a structure and must be defined in the dictionary. You can also specify individual field display attributes and a field text in the structure, if the key word from the Dictionary is not to be displayed as field text in the dialog box.
      The Data input by the user in the dialog box are passed to the sub-routine specified in the interface for checking. Errors found by the check are entered in an error structure and are evaluated on return from the sub-routine by the function module.
      The standard help functionality (F1, F4) is supported.
      The user action (Continue or Cancel) is returned in a parameter.
    • POPUP_GET_VALUES_USER_HELP
    • This function module sends a dialog box for data to be input with the possibility of a check in an external sub-routine (user exit) and branching in a user F1 or F4 help.
      The input fields are passed in a structure and must be defined in the Dictionary. You can also specify individual field display attributes and a field text in the structure, if the key word from the Dictionary is not to be displayed as field text in the dialog box.
      You can pass the data which are entered by the user in a dialog box to a sub-routine which must be specified in the interface for checking. Errors occurring in the check are stored in an error structure and are analyzed by the function module upon return from the sub-routine. The data, and an error message, if appropriate, are displayed again.
      The standard help functionality (F1, F4) is supported.
      User exits for a user F1 or F4 help can also be specified.
      The user action (Continue or Cancel) is returned in a parameter.
    • POPUP_GET_VALUES_USER_BUTTONS
    • This function module is like the previous function module POPUP_GET_VALUES_USER_HELP, with the additional possibility of passing one or two additional pushbuttons and a standard pushbutton, which the user can name.
    • POPUP_GET_VALUES_SET_MAX_FIELD
    • With this function module you can specify the maximum number of fields which can be displayed in dialog boxes for this function group (SPO4). The specified value is stored in the function group local memory and applies for the rest of the application. Dialog boxes which display more then this number of fields are displayed with a scroll bar.

    2.4、Function group SPO6

    • POPUP_DISPLAY_TEXT

    • With this function module you display a text which exists in the system in a dialog box.
    • POPUP_DISPLAY_TEXT_WITH_PARAMS

    • With this function module you display a text which exists in the system with parameters in a dialog box. The parameter values are passed in a table. The use of numbered texts is recommended, to make the parameter values translatable.
      The parameter names must be passed in upper-case letters.

    2.5、Function group SPO5 

    • POPUP_TO_DECIDE_LIST

    • 从列表中选择数据,样例程序

    report  rsspo500.
    data:   selectlist like spopli occurs 5 with header line.
    data:   antwort   type c.
    while antwort ne 2.
    clear   selectlist.
    refresh selectlist.
    selectlist-varoption = 显示含有单选按钮的弹出框'.
    append selectlist.
    selectlist-varoption = '显示含有复选框的弹出框'.
    selectlist-selflag   = 'X'.
    append selectlist.
    call function 'POPUP_TO_DECIDE_LIST'
         exporting
    *         CURSORLINE         = 1
    *         MARK_FLAG          = ' '
              mark_max           = 1
              start_col          = 10
              start_row          = 10
              textline1          = 'Text1'
              textline2          = 'POPUP_TO_DECIDE_LIST'
              textline3          = 'TEXT3'
              titel              = 'TITLE '
         importing
              answer             =  antwort
         tables
              t_spopli           =  selectlist
         exceptions
              not_enough_answers = 1
              too_much_answers   = 2
              too_much_marks     = 3
              others             = 4.
      if antwort eq 'A'.
        exit.
      endif.
    endwhile.

    if antwort ne 'A'.
      clear   selectlist.
      refresh selectlist.
      selectlist-varoption = '最多 15 个选项'.
      selectlist-selflag   = 'X'.
      append selectlist.
      selectlist-varoption = '含有复选框'.
      selectlist-selflag   = 'X'.
      append selectlist.
      selectlist-varoption = '或单选按钮'.
      selectlist-selflag   = 'X'.
      append selectlist.
      selectlist-varoption = '典型的列表功能:'.
      selectlist-selflag   = 'X'.
      append selectlist.
      selectlist-varoption = '* 选择'.
      selectlist-selflag   = 'X'.
      append selectlist.
      selectlist-varoption = '* 选择全部'.
      selectlist-selflag   = 'X'.
      append selectlist.
      selectlist-varoption = ' 取消全部选择'.
      selectlist-selflag   = 'X'.
      append selectlist.
      selectlist-varoption = '3 70字符/选项'.
      selectlist-selflag   = 'X'.
      append selectlist.
      selectlist-varoption = '65 字符/选项'.
      selectlist-selflag   = 'X'.
      append selectlist.
      selectlist-varoption =  '激活/不激活可选行'.
      selectlist-selflag   = 'X'.
      selectlist-inactive  = 'X'.
      append selectlist.

    * 2. Aufruf **********************************************************

      call function 'POPUP_TO_DECIDE_LIST'
           exporting
    *         CURSORLINE         = 1
                mark_flag          = 'X'
                mark_max           = 0
              start_col          = 15
              start_row          = 15
                textline1          = 'Das POPUP bietet'(c01)
                textline2          = 'folgende Funktionalit鋞:'(c02)
                titel              = 'Das Beispiel 2'(b02)
           importing
                answer             =  antwort
           tables
                t_spopli           =  selectlist
           exceptions
                not_enough_answers = 1
                too_much_answers   = 2
                too_much_marks     = 3
                others             = 4.

    endif.

    Posted from:http://blog.csdn.net/CompassButton/archive/2006/09/29/1306632.aspx

    如何访问SAP的Domain的Value Range[转]

    访问Domain的Value Range有两种方法:

    1、直接访问表
    dd07l和dd07T
       select * from dd07l
              where domname   = 'domname' and
                    as4local   = active.

    2、使用SAP的标准函数 
          call function 'DD_DOMVALUES_GET'
               exporting
                    domname        =  p_domname
               importing
                    rc             = l_subrc
               tables
                    dd07v_tab      =  l_dd07v
               exceptions
                    wrong_textflag = 1
                    others         = 2.

    Posted from:http://blog.csdn.net/CompassButton/archive/2006/10/11/1330477.aspx

    10/7/2006

    [ABAP] Make use of SELECT-OPTIONS easier on the selection screen

    REPORT zmeng_testc .

     

    TABLES: bseg.

     

    * データ型プール SSCR のインクルード

    TYPE-POOLS sscr.

     

    * パラメータ RESTRICTION に渡すオブジェクトの定義

    DATA itab_restrict TYPE sscr_restrict.

     

    * RESTRICT に入力するための補足オブジェクト

    DATA str_opt_list TYPE sscr_opt_list.

    DATA str_ass     TYPE sscr_ass.

     

    SELECT-OPTIONS:

      so_werks   FOR bseg-werks NO-EXTENSION NO INTERVALS.

     

    INITIALIZATION.

     

    * JUST_EQ: EQ のみ使用可

      CLEAR str_opt_list.

      MOVE 'JUST_EQ' TO str_opt_list-name.

      MOVE 'X' TO str_opt_list-options-eq.

      APPEND str_opt_list TO itab_restrict-opt_list_tab.

     

    * 対象項目

      CLEAR str_ass.

      MOVE: 'S'        TO str_ass-kind,

            'SO_WERKS' TO str_ass-name,

            'I'        TO str_ass-sg_main,

            'N'        TO str_ass-sg_addy,

            'JUST_EQ'  TO str_ass-op_main.

      APPEND str_ass TO itab_restrict-ass_tab.

     

    * 汎用モジュール呼出

      CALL FUNCTION 'SELECT_OPTIONS_RESTRICT'

           EXPORTING

                 restriction                = itab_restrict

           EXCEPTIONS

                 too_late                   = 1

                 repeated                   = 2

                 not_during_submit          = 3

                 db_call_after_report_call  = 4

                 selopt_without_options     = 5

                 selopt_without_signs       = 6

                 invalid_sign               = 7

                 report_call_after_db_error = 8

                 empty_option_list          = 9

                 invalid_kind               = 10

                 repeated_kind_a            = 11

                 OTHERS                     = 12.

     

    START-OF-SELECTION.

      PERFORM output_data.

     

    *&---------------------------------------------------------------------*

    *&      Form  output_data

    *&---------------------------------------------------------------------*

    FORM output_data.

      LOOP AT so_werks.

        WRITE: / so_werks-option,

                 so_werks-sign  ,

                 so_werks-low   ,

                 so_werks-high  .

      ENDLOOP.

    ENDFORM.                    " output_data