funcation location分配classification

3 篇文章 0 订阅
 data: lt_list like table of bapi1003_alloc_list,
        lt_num  like table of bapi1003_alloc_values_num,
        lt_curr like table of bapi1003_alloc_values_curr,
        lt_char like table of bapi1003_alloc_values_char.

  clear: lt_num,
         lt_curr,
         lt_char,
         lt_list.

  clear: gv_class,gv_object,gt_return,gt_char.

  if  gs_tab-n_feg_online is initial
  and gs_tab-n_feg_outage is initial
  and gs_tab-n_i0_status  is initial
  and gs_tab-n_quality    is initial.

  else.
* 将function  location的外部编码转换为内部编码
    call function 'CONVERSION_EXIT_TPLNR_INPUT'
      exporting
        input     = gs_tab-tplnr
      importing
        output    = gv_object
      exceptions
        not_found = 1
        others    = 2.

* 获取class
    gv_class = 'N_GENERAL'.  
  gv_ctype = '003'.

    call function 'BAPI_OBJCL_GETCLASSES'
      exporting
        objectkey_imp   = gv_object
        objecttable_imp = 'IFLOT'
        classtype_imp   = gv_ctype
        read_valuations = 'X'
        keydate         = sy-datum
        language        = sy-langu
      tables
        alloclist       = lt_list
        allocvalueschar = lt_char
        allocvaluescurr = lt_curr
        allocvaluesnum  = lt_num
        return          = gt_return.

    if not lt_char is initial.
      append lines of lt_char to gt_char.
    endif.

    if not lt_curr is initial.
      append lines of lt_curr to gt_curr.
    endif.

    if not lt_num is initial.
      append lines of lt_num to gt_num.
    endif.

* 获取特征值的value
    mcr_character_value:
           'N_FEG_ONLINE'        gs_tab-n_feg_online,   
           'N_FEG_OUTAGE'        gs_tab-n_feg_outage,   " 
           'N_I0_STATUS'         gs_tab-n_i0_status ,   " 
           'N_QUALITY_AND_SAFETY_CLASS'    gs_tab-n_quality.      "
    clear gt_return.
*******************************************************
    call function 'BAPI_OBJCL_CHANGE'
      exporting
        objectkey          = gv_object
        objecttable        = 'IFLOT'
        classnum           = gv_class
        classtype          = gv_ctype
        status             = '1'
        keydate            = sy-datum
      tables
        allocvaluesnumnew  = gt_num
        allocvaluescharnew = gt_char
        allocvaluescurrnew = gt_curr
        return             = gt_return.
*/--End of Change  On 2011-02-11-----*

    clear: gs_return,gs_error.
* 记录创建失败的错误信息
    read table gt_return into gs_return with key type = 'E'.

    if sy-subrc = 0.
      move-corresponding gs_tab to gs_error.
      loop at gt_return into gs_return where type = 'E'.
        concatenate gs_error-message gs_return-message into gs_error-message
                   separated by space.
      endloop.
      gs_error-lines  = gv_lines.
      append gs_error to gt_error.


      call function 'BAPI_TRANSACTION_ROLLBACK'.

    else.
      call function 'BAPI_TRANSACTION_COMMIT'
        exporting
          wait = 'X'.
    endif.
  endif.

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值