Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

BAPI_OUTB_DELIVERY_CREATE_STO Problem

biju_john
Explorer
0 Kudos

hi ,

    i am using BAPI_OUTB_DELIVERY_CREATE_STO for creating Delivery , the BAPI is executuing correctly and the Delivery number is Getting generated . But if go to the transcation VL02N and i give the generated Delivery Number it says it does not exist .

What Could Be the Problem?

Regards

Biju

1 ACCEPTED SOLUTION

biju_john
Explorer
0 Kudos

Hi,

   Yes i have

    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

    now  i added the wait 3 second and tried

   But still the same problem.

Regards

Biju



13 REPLIES 13

nabheetscn
Active Contributor
0 Kudos

Did you do a BAPI_TRANSACTION_COMMIT after the call?

venkateswaran_k
Active Contributor
0 Kudos

Dear Biju,

You need to commit the transaction after the successful execution of BAPI.  Use the following code, which works for me.

     CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

       EXPORTING

         WAIT = 'X'.

     WAIT UP TO 3 SECONDS.

Regards,

Venkat

biju_john
Explorer
0 Kudos

Hi,

   Yes i have

    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

    now  i added the wait 3 second and tried

   But still the same problem.

Regards

Biju



0 Kudos

Can you share your code?

Regards

0 Kudos

The BAPI has a documentation with sample code. Can you please cross check your code and various flags.. Please paste your code.

Former Member
0 Kudos

HI Biju, there could be a perfomance issue with your server, but you can try incrementing the wait seconds , also verify the return table of the BAPI have any messages...

0 Kudos

parameters: vbeln like ekko-ebeln OBLIGATORY memory id bes,

             EBELP like ekpo-EBELP ,

             vstel like tvst-vstel,

             logsys like tbdls-logsys default 'NONE'.

data: lf_vbeln type vbeln_vl,

       lf_num type vbnum,

       ls_deli type bapishpdelivnumb,

       lt_deli type table of bapishpdelivnumb,

       lt_order type table of bapidlvreftosto,

       ls_order type bapidlvreftosto,

       ls_itm type bapidlvitemcreated,

       lt_itm type table of bapidlvitemcreated,

       ls_ext type bapiparex,

       lt_extin type table of bapiparex,

       lt_extout type table of bapiparex,

       ls_ret type bapiret2,

       lt_return type table of bapiret2.

* StockTransItems (here: complete STO)

ls_order-ref_doc = vbeln.

ls_itm-ref_item = EBELP .

append ls_order to lt_order.

* ExtensionIn

ls_ext = 'My additional input'.

append ls_ext to lt_extin.

* Synchronous RFC

call function 'BAPI_OUTB_DELIVERY_CREATE_STO'

    DESTINATION logsys

     EXPORTING

        SHIP_POINT              = vstel

*     DUE_DATE                 =

*     DEBUG_FLG               =

   importing

      delivery                = lf_vbeln

     num_deliveries          = lf_num

   tables

     stock_trans_items       = lt_order

     extension_in            = lt_extin

      deliveries              = lt_deli

     created_items           = lt_itm

     extension_out           = lt_extout

      return                  = lt_return

           .

write: / 'Delivery:', lf_vbeln,

        / 'NumDeliveries:', lf_num,

        / 'Deliveries:'.

loop at lt_deli into ls_deli.

   write ls_deli-deliv_numb.

endloop.

if not lt_itm[] is initial.

   write: / 'CreatedItems:'.

   loop at lt_itm into ls_itm.

     write: / ls_itm-ref_doc,

              ls_itm-ref_item,

              ls_itm-deliv_numb,

              ls_itm-deliv_item,

              ls_itm-material,

              ls_itm-dlv_qty,

              ls_itm-sales_unit,

              ls_itm-sales_unit_iso.

   endloop.

endif.

if not lt_return[] is initial.

   write: / 'Return:'.

   loop at lt_return into ls_ret.

     write: / ls_ret-type, ls_ret-id, ls_ret-number,

              ls_ret-message,

            /.

   endloop.

endif.

if not lt_extout[] is initial.

   write: / 'ExtensionOut:'.

   loop at lt_extout into ls_ext.

     write: / ls_ext.

   endloop.

endif.

* COMMIT WORK

if not lf_vbeln is initial.

   call FUNCTION 'BAPI_TRANSACTION_COMMIT'

       EXPORTING wait = 'X'.

   WAIT UP TO 3 SECONDS.

endif.

0 Kudos

I saw your code,

You paste the following code jsut after your Return statement of BAPI.

if not lf_vbeln is initial.

   call FUNCTION 'BAPI_TRANSACTION_COMMIT'

       EXPORTING wait = 'X'.

   WAIT UP TO 3 SECONDS.

endif.

0 Kudos

Do a commit after the call. Plus please paste debugging screen shot of delivery number generated along with IF_NUM parameter.

0 Kudos

i tried it .but still the same

but when i execute via se37 using test sequence

first i call  BAPI_OUTB_DELIVERY_CREATE_STO and then

BAPI_TRANSACTION_COMMIT

it is working .

0 Kudos

can you please remove the destination and check

0 Kudos

Dear Biju,

1. You may have to debug it at every BAPI end, to confirm the delivery number is generated and commited. ( check the return table for messages ).   It seems there is a performance issue.  You may increate 3 seconds to 6 seconds..

2.  Or use this BAPI instead. BAPI_OUTB_DELIVERY_CREATE_SLS.. The same structure..

0 Kudos

The Problem was with the destination  i was giving NONE

i Removed it and now works fine.

I wonder what Could be the problem with that COZ i believe

whenever i call the BAPI from SAP We will give Destination as NONE