FM笔记

时间:2021-06-09 01:11:20

1.获取生产订单状态

    CALL FUNCTION 'STATUS_TEXT_EDIT'
EXPORTING
client = sy-mandt
objnr = p_objnr
spras = sy-langu
IMPORTING
line = p_sttxt
EXCEPTIONS
object_not_found =
OTHERS = .
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() TYPE c VALUE 'X',  

  lv_vbeln LIKE vbak-vbeln VALUE '', 

  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 =  

    system_failure =  

    OTHERS = . 

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

产生随机数的函数

CALL FUNCTION 'QF05_RANDOM_INTEGER'
EXPORTING
RAN_INT_MAX =
RAN_INT_MIN =
IMPORTING
RAN_INT = INT1
EXCEPTIONS
INVALID_INPUT =
OTHERS = .