CSO_P_DLVRY_GOODS_ISSUE_CREATE

Категория:

Описание модуля: 
Создание проводки ОМ
Пример использования: 
  "в примере ниже пример пакетного ввода, так же вызов ФМ
 
 DATA: lv_vbeln    TYPE  vbeln_vl
       , lf_blocked  TYPE  wiso_hndl-xfield
       , ls_return   TYPE  bapireturn1
       .
 
    DATA: lt_bdcdata    TYPE  bdcdata_tab
        , ls_options    TYPE  ctu_params
        , lt_messages   TYPE  tab_bdcmsgcoll
        , lf_error      TYPE  abap_bool
        .
 
    FIELD-SYMBOLS : <fs_bdcdata>    TYPE  bdcdata
                  , <fs_message>    TYPE  bdcmsgcoll
                  .
 
    lv_vbeln  = '' "Номер поставки
 
    IF  ( 1 = 2 ).
      CALL FUNCTION 'CSO_P_DLVRY_GOODS_ISSUE_CREATE'
        EXPORTING
          pi_deliv_numb = lv_vbeln
        IMPORTING
          pe_return1    = ls_return
          pe_gi_blocked = lf_blocked.
 
      IF  ls_return-type  IS  NOT INITIAL.
        MESSAGE   ID  ls_return-id
                TYPE  ls_return-type
              NUMBER  ls_return-number
                WITH  ls_return-message_v1  ls_return-message_v2
                      ls_return-message_v3  ls_return-message_v4
                INTO  sy-msgli.
        IF  ls_return-type  CA  'AXE'.
          "Ошибка
        ELSE.
          "Успешно
        ENDIF.
 
      ELSEIF  lf_blocked  = abap_true.
        MESSAGE e017  WITH  lv_vbeln  INTO  sy-msgli.
 
      ENDIF.
 
    ELSE.
* " User dialogue initiate
      APPEND INITIAL LINE TO  lt_bdcdata  ASSIGNING <fs_bdcdata>.
      <fs_bdcdata>-program  = 'SAPMV50A'.
      <fs_bdcdata>-dynpro   = '4004'.
      <fs_bdcdata>-dynbegin = 'X'.
 
      APPEND INITIAL LINE TO  lt_bdcdata  ASSIGNING <fs_bdcdata>.
      <fs_bdcdata>-fnam = 'LIKP-VBELN'.
      <fs_bdcdata>-fval = lv_vbeln.
 
      APPEND INITIAL LINE TO  lt_bdcdata  ASSIGNING <fs_bdcdata>.
      <fs_bdcdata>-fnam = 'BDC_OKCODE'.
      <fs_bdcdata>-fval = 'OVER_T'.   "Perform Goods Issue!
 
      APPEND INITIAL LINE TO  lt_bdcdata  ASSIGNING <fs_bdcdata>.
      <fs_bdcdata>-program  = 'SAPMV50A'.
      <fs_bdcdata>-dynpro   = '1000'.
      <fs_bdcdata>-dynbegin = 'X'.
 
      APPEND INITIAL LINE TO  lt_bdcdata  ASSIGNING <fs_bdcdata>.
      <fs_bdcdata>-fnam = 'LIKP-WADAT_IST'.
      <fs_bdcdata>-fval = |{ io_certificate->ms_header-wadat DATE = USER }|.
*      <fs_bdcdata>-fval = |{ lv_datum_test DATE = USER }|.
 
      APPEND INITIAL LINE TO  lt_bdcdata  ASSIGNING <fs_bdcdata>.
      <fs_bdcdata>-fnam = 'BDC_OKCODE'.
      <fs_bdcdata>-fval = 'WABU_T'.   "Perform Goods Issue!
 
      ls_options-dismode  = 'N'.
      ls_options-updmode  = 'S'.
      ls_options-nobinpt  = 'X'.
      ls_options-nobiend  = 'X'.
      CALL TRANSACTION  'VL02N' USING lt_bdcdata
                                OPTIONS FROM  ls_options
                                MESSAGES INTO lt_messages.
 
      IF  lt_messages IS  NOT INITIAL.
        LOOP AT lt_messages ASSIGNING <fs_message>.
          MESSAGE   ID  <fs_message>-msgid
                  TYPE  <fs_message>-msgtyp
                NUMBER  <fs_message>-msgnr
                  WITH  <fs_message>-msgv1  <fs_message>-msgv2
                        <fs_message>-msgv3  <fs_message>-msgv4
                  INTO  sy-msgli.
 
 
 
          IF  <fs_message>-msgtyp CA  'AXE'.
            lf_error  = abap_true.
          ENDIF.
        ENDLOOP.
      ENDIF.
 
      IF  lf_error  = abap_true.
        MESSAGE e030  WITH  lv_vbeln  INTO  sy-msgli.
      ELSE.
        MESSAGE s027  WITH  lv_vbeln  INTO  sy-msgli.
 
      ENDIF.
    ENDIF.
Параметры: