batch classification_BAPI

  data: t_mseg type mseg.
  data t_objectkey type bapi1003_key-object.
  data :
  t_allocvaluesnumnew type table of bapi1003_alloc_values_char ,
  t_allocvaluescharnew type table of bapi1003_alloc_values_char,
  t_allocvaluescurrnew type table of bapi1003_alloc_values_char.
  data wa_return   type table of bapiret2 .
  data t_xchpf type marc-xchpf.
  clear t_mseg.
  loop at xmseg into t_mseg where bukrs = 'CNTY'.

    select single xchpf into t_xchpf
    from marc
    where matnr = t_mseg-matnr
    and werks = t_mseg-werks
    and xchpf <> ''.
     check sy-subrc = 0.
    move t_mseg-matnr to t_objectkey+0(18).
    move t_mseg-werks to t_objectkey+18(4).
    move t_mseg-charg to t_objectkey+22(10).

    call function 'BAPI_OBJCL_CHANGE'
      exporting
        objectkey                = t_objectkey
        objecttable              = 'MCHA'
        classnum                 = 'ZR_FIFO'
        classtype                = '022'
*   STATUS                   = '1'
*   STANDARDCLASS            =
*   CHANGENUMBER             =
*   KEYDATE                  = SY-DATUM
*   NO_DEFAULT_VALUES        = ' '
* IMPORTING
*   CLASSIF_STATUS           =
      tables
        allocvaluesnumnew        =  t_allocvaluesnumnew
    allocvaluescharnew       =  t_allocvaluescharnew
     allocvaluescurrnew      =  t_allocvaluescurrnew
         return                   = wa_return
              .

    call function 'BAPI_TRANSACTION_COMMIT'
         exporting
              wait = 'X'.
  endloop.

请使用浏览器的分享功能分享到微信等