ABAP GN_DELIVERY_CREATE 报错 VL 561

GN_DELIVERY_CREATE 去创建内向交货单的时候。

报错 VL 561 Essential transfer parameters are missing in record

表示一些必输字段没输入

诸如一些,物料号。单位。等一些字段

输入之后即可

  DATA: ls_return TYPE bapireturn.
  DATA: lt_return TYPE STANDARD TABLE OF bapireturn.
  DATA: lt_item TYPE STANDARD TABLE OF bbp_inbd_d.
  DATA: lv_message TYPE string.
  DATA: lv_message_all TYPE string.
  DATA: ls_vbsk     LIKE  vbsk,
        es_vbsk     LIKE  vbsk,
        lt_spe_vbfs TYPE TABLE OF  /spe/vbfs,
        ls_spe_vbfs TYPE /spe/vbfs,
        lt_komdlgn  TYPE TABLE OF komdlgn,
        ls_komdlgn  TYPE komdlgn,
        lt_vbfs     TYPE TABLE OF vbfs,
        ls_vbfs     TYPE vbfs,
        lt_vbls     TYPE TABLE OF vbls,
        ls_vbls     TYPE vbls.
  DATA: l_nrnr      TYPE inri-nrrangenr.
  DATA: ls_tvsa     TYPE tvsa.

*head 
    ls_vbsk-mandt = sy-mandt.
    ls_vbsk-ernam = sy-uname.
    ls_vbsk-erdat = sy-datum.
    ls_vbsk-uzeit = sy-uzeit.
    ls_vbsk-smart = 'L'.

    SELECT SINGLE * INTO ls_tvsa
      FROM tvsa WHERE smart = ls_vbsk-smart.

    CALL FUNCTION 'NUMBER_GET_NEXT'
      EXPORTING
        nr_range_nr = l_nrnr
        object      = 'RV_SAMMG'
      IMPORTING
        number      = ls_vbsk-sammg
      EXCEPTIONS
        OTHERS      = 1.

    l_nrnr = ls_tvsa-numki.

*清空变量
    CLEAR:lt_komdlgn,lt_spe_vbfs,lt_vbfs,ls_vbfs,lt_vbls,ls_vbls.


*item
 CLEAR:ls_komdlgn,l_nrnr,ls_tvsa.

      ls_komdlgn-lfart        = 'ZEL'.
      ls_komdlgn-vgtyp        = 'V'.
      ls_komdlgn-kzazu        = 'X'.
      ls_komdlgn-lfdat        = gs_inbound-lfdat.
      ls_komdlgn-wadat        = gs_inbound-wadat_ist.
      ls_komdlgn-vstel        = 'NL10'.
      ls_komdlgn-vgbel        = gs_inbound-ebeln.
      ls_komdlgn-vgpos        = gs_inbound-ebelp.
      ls_komdlgn-lifnr        = gs_inbound-lifnr.
      ls_komdlgn-lfimg        = gs_inbound-lfimg.
      "ls_komdlgn-vgpos = 10.
      ls_komdlgn-matnr        = gs_inbound-matnr.
      ls_komdlgn-matwa        = gs_inbound-matnr.
      ls_komdlgn-werks        = gs_inbound-werks.
      ls_komdlgn-lgort        = gs_inbound-lgort.
      ls_komdlgn-vrkme        = gs_inbound-meins.
      ls_komdlgn-meins        = gs_inbound-meins.
      ls_komdlgn-lifex        = gs_inbound-verur.
      ls_komdlgn-verur        = gs_inbound-verur.
      "ls_komdlgn-lifexpos     = gs_inbound-ebelp.
      ls_komdlgn-bolnr     = gs_inbound-bolnr.
      ls_komdlgn-vornu     = gs_inbound-vornu.


      ls_komdlgn-zz_etoporto  = gs_inbound-zz_etoporto.
      ls_komdlgn-zz_etdport   = gs_inbound-zz_etdport.
      ls_komdlgn-zz_atdport   = gs_inbound-zz_atdport.
      ls_komdlgn-zz_etaport   = gs_inbound-zz_etaport.
      ls_komdlgn-zz_ataport   = gs_inbound-zz_ataport.
      ls_komdlgn-zz_disport   = gs_inbound-zz_disport.
      ls_komdlgn-zz_empret    = gs_inbound-zz_empret.
      SELECT SINGLE inco1, inco2
      INTO ( @ls_komdlgn-inco1,@ls_komdlgn-inco2 ) FROM lfm1
       WHERE lifnr =  @gs_inbound-lifnr
         AND ekorg = 'P001'.

      APPEND ls_komdlgn TO lt_komdlgn.



CALL FUNCTION 'GN_DELIVERY_CREATE'
      EXPORTING
        vbsk_i      = ls_vbsk
      IMPORTING
        vbsk_e      = ls_vbsk
*       ET_SPLITPROT                        =
*       ET_VBADR    =
*       ET_VBPA     =
      TABLES
        xkomdlgn    = lt_komdlgn
        xvbfs       = lt_vbfs
        xvbls       = lt_vbls
        et_spe_vbfs = lt_spe_vbfs
      EXCEPTIONS
        OTHERS      = 1.
    LOOP AT lt_spe_vbfs  INTO ls_spe_vbfs WHERE msgty CA  'EAX'.

      MESSAGE ID ls_spe_vbfs-msgid TYPE ls_spe_vbfs-msgty
          NUMBER ls_spe_vbfs-msgno
          INTO lv_message
          WITH ls_spe_vbfs-msgv1 ls_spe_vbfs-msgv2
               ls_spe_vbfs-msgv3 ls_spe_vbfs-msgv4.

      IF lv_message_all IS INITIAL.
        lv_message_all = lv_message.
      ELSE.
        CONCATENATE lv_message_all lv_message INTO lv_message_all SEPARATED BY ';'.
      ENDIF.
    ENDLOOP.
    IF lv_message_all IS  INITIAL .
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        EXPORTING
          wait = 'X'.
      READ TABLE lt_vbls INTO ls_vbls INDEX 1.


    ELSE.


    ENDIF.


你可能感兴趣的:(abap,SAP)