Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 7856

Billing quantity issue in case of BAPI_BILLINGDOC_CREATEMULTIPLE

$
0
0

Hello Folks,


 

We have a ‘z’ transaction where we are using BAPI ‘BAPI_BILLINGDOC_CREATEMULTIPLE’ to create Billing Document. However the billing quantity updated in the billing document is ‘0.00’ in the case of document being created using the ‘z’ transaction whereas the correct quantity is updated from the transaction ‘VF01’.


 

If I change the configuration in VTFL, of billing quantity from ‘B Delivery quantity less invoiced quantity’ to ‘G Cumulative batch quantity minus invoiced quantity’ then the quantity updated from ‘z’ transaction appears correct while the quantity gets doubled in case of ‘VF01’ ie. quantity is updated in both the batches and invoiced item.


 

Here is the code snippet I have used in my ‘z’ transaction to create the billing document:


 

LOOP AT gt_item_inv_coll INTO gs_item_inv_coll.

    REFRESH : gt_billing.

    CLEAR : gv_line_item. gv_line_item = '0'.

 

    LOOP AT gt_item INTO gs_item WHERE vbeln_del  = gs_item_inv_coll-vbeln_del .

*  IF GS_ITEM-STO_SO_IND = 'STO'.

      gv_line_item  = gv_line_item + 10.

      gs_billing-ordbilltyp = 'ZSTO'.

      gs_billing-ref_doc    = gs_item-vbeln_del.

      gs_billing-ref_item   = gv_line_item.  " GS_ITEM-EBELP.

      gs_billing-doc_number = gs_item-ebeln.

      gs_billing-itm_number = gs_item-ebelp.

 

      gs_billing-ref_doc_ca = 'J'.

      gs_billing-material   = gs_item-matnr.

      gs_billing-plant      = gs_item-reswk.

 

      APPEND gs_billing TO gt_billing .

      CLEAR gs_billing.

 

    ENDLOOP.

 

    REFRESH : gt_bapiret_bill.

    CALL FUNCTION 'BAPI_BILLINGDOC_CREATEMULTIPLE'

      TABLES

        billingdatain = gt_billing

        return        = gt_bapiret_bill

        success       = gt_success.

 

    READ TABLE gt_bapiret_bill INTO gs_bapiret_bill WITH KEY type = 'E'.

    IF sy-subrc <> 0.

      READ TABLE gt_success INTO  gs_success INDEX 1.

      IF sy-subrc = 0.

        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

          EXPORTING

            wait = 'X'.

        REFRESH : gt_billing.

 

        LOOP AT gt_item INTO gs_item WHERE vbeln_del  = gs_item_inv_coll-vbeln_del .

          gs_item-vbeln_bil = gs_success-bill_doc.

          MODIFY gt_item FROM gs_item.

*           save data to ztable - zmm_weigh_bridge

          PERFORM save_data.

          READ TABLE gt_item INTO gs_item WITH KEY sel = 'X'.

          IF sy-subrc = 0.

            MESSAGE s168(ztr) WITH gs_success-bill_doc gs_item-vbeln_del.

          ENDIF.

        ENDLOOP.

        CLEAR gs_item.

      ENDIF.

    ENDIF.

*    ENDIF.

 

  ENDLOOP.

 

I humbly request you to provide me with possible solution(s).

 

Thanks & Regards,

Archie


Viewing all articles
Browse latest Browse all 7856

Trending Articles



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