Quantcast
Channel: SCN : All Content - ABAP Development
Viewing all articles
Browse latest Browse all 8332

BAPI_GOODSMVT_CREATE error

$
0
0

Hi

I am trying to do transfer posting using   BAPI_GOODSMVT_CREATE. I am getting the below error:

Deficit of BA Restr.-use 1 KG : 00241 1300 1301 14AG03606X

I used the below code:

 

   DATA : BEGINOF lt_sernr OCCURS0,
           sernr LIKE equi-sernr,
         ENDOF lt_sernr.
DATA:t_gm_sernr LIKE bapi2017_gm_serialnumber OCCURS0WITHHEADERLINE.
DATA:p_matnr type matnr VALUE'00241',
     p_charg type charg VALUE'14AG03606X',
     p_werks type werks VALUE'1300',
     p_lgort type lgort VALUE'1301'.

  DATA: l_header " Material Document Header Data
           LIKE bapi2017_gm_head_01,
        l_code   " Assign code to transaction for BAPI goods movement
           LIKE bapi2017_gm_code,
        l_headret " BAPI Output Header Structure
           LIKE bapi2017_gm_head_ret,
        l_docno   " Number of material document
           LIKE bapi2017_gm_head_ret-mat_doc,
        l_year    " Material doc. year
           LIKE bapi2017_gm_head_ret-doc_year,
        l_item LIKE bapi2017_gm_serialnumber-matdoc_itm.
* Internal tables *
DATA:  t_gm_items                    " Items to be submitted in BAPI
          LIKE bapi2017_gm_item_create OCCURS0WITHHEADERLINE,

       t_gm_return                   " Return structure from BAPI call
          LIKE bapiret2 OCCURS0WITHHEADERLINE.

l_code = '04'.

SELECT equi~sernr
INTOTABLE lt_sernr
FROM equi
INNER JOIN marc ON
marc~matnr = equi~matnr
INNER JOIN eqbs ON
eqbs~equnr = equi~equnr
WHERE equi~matnr = p_matnr AND
      equi~charge  = p_charg AND
      marc~werks = p_werks AND
      equi~s_eqbs = 'X'AND
      eqbs~b_werk = p_werks  AND
      eqbs~b_lager = p_lgort AND
     ( eqbs~lbbsa = '01'OR
       eqbs~lbbsa = '08' ).

LOOPAT lt_sernr.
  t_gm_sernr-matdoc_itm = ''.
  t_gm_sernr-serialno = lt_sernr-sernr.
  APPEND t_gm_sernr.
ENDLOOP.

  l_header-pstng_date = sy-datum.
  l_header-doc_date   = sy-datum.

    t_gm_items-material     = '00241'.
    t_gm_items-plant        = '1300'.
    t_gm_items-stge_loc     = '1301'.
    t_gm_items-batch        = '14AG03606X'.
    t_gm_items-entry_uom    = 'KG'.
    t_gm_items-move_mat     = '00241'.
    t_gm_items-move_plant   = '1300'.
    t_gm_items-move_stloc   = '1301'..
    t_gm_items-move_batch   = '14AG03606X'.

* Movement 344
    t_gm_items-move_type    = '344'.
     t_gm_items-entry_qnt    = '1'.
    APPEND t_gm_items.


CALLFUNCTION'BAPI_GOODSMVT_CREATE'
  EXPORTING
    goodsmvt_header             = l_header
    goodsmvt_code               = l_code
*       TESTRUN                     = ' '
  IMPORTING
    goodsmvt_headret            = l_headret
    materialdocument            = l_docno
    matdocumentyear             = l_year
  TABLES
    goodsmvt_item               = t_gm_items
    goodsmvt_serialnumber       = t_gm_sernr                "SR49070+
    return                      = t_gm_return.

IF t_gm_return[] ISINITIAL.

  CALLFUNCTION'BAPI_TRANSACTION_COMMIT'
    EXPORTING
      wait = 'X'.
endif.

 

Can you guide, whats that i am doing wrong

I used MB1B , its successful.


Viewing all articles
Browse latest Browse all 8332

Trending Articles