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

BAPI_ENTRYSHEET_CREATE Error SE149 Service quantity exceeds quantity in purchase order

$
0
0

Hello

 

I'm having a problem using BAPI_ENTRYSHEET_CREATE using a purchase order with purchase contract (outline agreement) items for creating a service entry sheet acceptance. I use BAPI_PO_GETDETAIL for copying the PO structures into the BAPI_ENTRYSHEET_CREATE structures but I keep getting the error "SE149 Service XXXX: quantity A exceeds quantity B in purchase order".

 

I tried to create the service entry sheet through tx. ML81N and it works fine. Here's my code:

 

 

  <DATA declarations omitted, same as BAPI's>

 

  CALL FUNCTION 'BAPI_PO_GETDETAIL'

    EXPORTING

      purchaseorder    = i_ebeln

      items            = 'X'

      services         = 'X'

    IMPORTING

      po_header        = ls_pohdr

    TABLES

      po_items         = lt_poitem

      po_item_services = lt_posrv

      return           = lt_poret.

 

* PO items

  LOOP AT lt_poitem INTO ls_poitem.

 

 

    ls_hdr-pckg_no = ls_poitem-pckg_no.

    ls_hdr-short_text = 'Automatic Acceptance'.

    ls_hdr-po_number = ls_poitem-po_number.

    ls_hdr-po_item = ls_poitem-po_item.

    ls_hdr-doc_date = sy-datum.

    ls_hdr-post_date = sy-datum.

    ls_hdr-acceptance = 'X'.

 

 

*   Main service lines

    LOOP AT lt_posrv INTO ls_posrv WHERE pckg_no = ls_poitem-pckg_no AND

                                         outl_ind = 'X'.

 

      MOVE-CORRESPONDING ls_posrv TO ls_srv.

      APPEND ls_srv TO lt_srv.

 

*     Secondary service lines

      LOOP AT lt_posrv2 INTO ls_posrv2 WHERE pckg_no = ls_posrv-subpckg_no.

        MOVE-CORRESPONDING ls_posrv2 TO ls_srv.

        APPEND ls_srv TO lt_srv.

      ENDLOOP.

 

    ENDLOOP.

 

    CALL FUNCTION 'BAPI_ENTRYSHEET_CREATE'

      EXPORTING

        entrysheetheader   = ls_hdr

      IMPORTING

        entrysheet         = ld_entrysheet

      TABLES

        return             = lt_ret

        entrysheetservices = lt_srv.

 

  ENDLOOP.

 

********

 

  Regards,


Viewing all articles
Browse latest Browse all 8332

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>