FM笔记

1.获取生产订单状态

    CALL FUNCTION 'STATUS_TEXT_EDIT'
      EXPORTING
        client           = sy-mandt
        objnr            = p_objnr
        spras            = sy-langu
      IMPORTING
        line             = p_sttxt
      EXCEPTIONS
        object_not_found = 1
        OTHERS           = 2.
    IF p_sttxt CS 'CRTD'.
ENDIF.

 2.负号前移

*数量   

l_amount = wa_qtrk-erfmg.

*负号左移消除0   

SHIFT l_amount up to '-' left  CIRCULAR .    

SHIFT l_amount RIGHT DELETING TRAILING '.0'.    

condense l_amount.

  L_MENGE = L_I.
  CALL FUNCTION 'CLOI_PUT_SIGN_IN_FRONT'
    CHANGING
      VALUE         = L_MENGE
            .

 3.调用标准TCODE

DATA :  

  lv_skip(1) TYPE c VALUE 'X',  

  lv_vbeln LIKE vbak-vbeln VALUE '1500000015', 

  l_st_param TYPE tpara,  

  l_it_params TYPE TABLE OF tpara. 

  

CLEAR l_st_param. 

CLEAR l_it_params[]. 

  

l_st_param-paramid = 'AUN'. 

l_st_param-partext = lv_vbeln. 

APPEND l_st_param TO l_it_params. 

  

CALL FUNCTION 'CC_CALL_TRANSACTION_NEW_TASK' 

  STARTING NEW TASK 'VA03' 

  DESTINATION 'NONE' 

  EXPORTING  

    transaction = 'VA03' 

    skip_first_screen = 'X' 

  TABLES  

    paramtab = l_it_params 

  EXCEPTIONS  

    communication_failure = 97 

    system_failure = 98 

    OTHERS = 99. 

 4.获取域的固定值:FUNCTION 'RM_DOMAIN_VALUES_GET' 

 

产生随机数的函数

CALL FUNCTION 'QF05_RANDOM_INTEGER'
    EXPORTING
      RAN_INT_MAX   = 9999999
      RAN_INT_MIN   = 1000000
    IMPORTING
      RAN_INT       = INT1
    EXCEPTIONS
      INVALID_INPUT = 1
      OTHERS        = 2.

 

posted @ 2016-05-19 16:37  明大叔  阅读(324)  评论(0编辑  收藏  举报