Application Development and Automation 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: 
Read only

Problem with 'bapi_transaction_commit'

f_cemunal
Participant
0 Likes
1,009

Hello,

i am having difficulties understanding  fm bapi_transaction_commit. i slightly know what bapi is but this fm is used to print material movement  and i need to get 2 prints instead of one but i couldnt understand how this fm prints.

hope you can help me.

regards.

cem.

8 REPLIES 8
Read only

rajucd81
Participant
0 Likes
966

Hi Cem,

This FM is only to committing database changes only, not for printing purpose.

Thanks

Raju C D

Read only

0 Likes
966

hi raju,

that is what confuses me. i couldnt understand how it is printed in the code.

thank you for your answer.

regards.

cem.

Read only

asim_isik
Active Participant
0 Likes
966

Hi ,

Some bapis does not need commit maybe its one of those will work without commit too.

Read only

krishna_k19
Contributor
0 Likes
966

Hi Cem ,

    Can you post your code , then we can analyze it .

In some function modules / BAPI's in built commit statement will be there and at the same time in that only they might written the write statement also , so please share your code.

Regards,

Krishna

Read only

0 Likes
966

case r_ucomm.


when 'SEVKIYAT'                                                  .

       clear lv_mblnr.

       select single mblnr into lv_mblnr from zsevk

           where formno = gv_formno.

       if lv_mblnr is not initial.

         message e008(zps).

         clear sy-ucomm.

       else.

         perform sevkiyat.

       endif.

form  sevkiyat.

   data lv_k type char1.

   header-pstng_date = ekko-aedat                                   .

   header-doc_date   = lv_bldat                                   .

   " header-ref_doc_no = lv_lfsnr                                   .

   header-pr_uname   = sy-uname                                   .

   header-header_txt = mkpf-bktxt.

   goodsmvt_code_tmp = '04'                                       .

   clear:item,item[],lv_k.

   loop at it_satir.

     if lv_k is initial.

       if it_satir-islendi = 'X'.

         message w005(zps) with it_satir-mblnr.

         exit.

       endif.

       lv_k = 'X'.

     endif.

     item-move_type  = '301'                                        .

     item-plant      = gv_werksg                                    .

     item-stge_loc   = gv_lgortg                                    .

     item-move_plant = t001w-werks                                  .

     item-move_stloc = t001l-lgort                                  .

     item-material   = it_satir-matnr                               .

     item-move_mat   = it_satir-matnr                               .

     item-entry_qnt  = it_satir-miktar                              .

     item-entry_uom  = it_satir-meins                               .

     append item                                                    .

   endloop.

   check item is not initial.

   call function 'BAPI_GOODSMVT_CREATE'

     exporting

       goodsmvt_header  = header

       goodsmvt_code    = goodsmvt_code_tmp

     importing

       goodsmvt_headret = headret

     tables

       goodsmvt_item    = item

       return           = return.

   clear:it_log,it_log[].

   if return[] is initial  .

     call function 'BAPI_TRANSACTION_COMMIT' .

     message id     'M7'

             type   'S'

             number '060'

             with   headret-mat_doc

                    headret-doc_year  .

     it_log-belge headret-mat_doc.

     append it_log .

     loop at it_satir.

       update zsevk set islendi = 'X'

                        mblnr   = it_log-belge

         where formno = gv_formno.

     endloop.

*    refresh it_satir.

   else.

     loop at return.

       it_log-i_type = return-type.

       it_log-belge  = ''.

       it_log-hata   = return-message.

       append it_log.

     endloop.

     message w006(zps).

   endif.

endform.                    " SEVKIYAT

here is my code above. this codes prints material movement. my requirement is to print 2 pages at one time but i couldnt understand how this code prints.

thank you all.

Read only

0 Likes
966

The output is generated by the BAPI_GOODSMVT_CREATE and the COMMIT is just to ensure the database is updated.

Is there no Spool created which you can possibly change and have more than 1 print. Is this something which you want to do everytime somebody uses your program?

Also check the below notes...426554,  Q12 in 520583, 522591

Regards

Read only

0 Likes
966

Hi,

Commit is used to update the material document created from the FM to the database.

Are you using any forms for printing?

Regards,

K.S

Read only

Former Member
0 Likes
966

hello Cem,

By using BAPI_TRANSACTION_COMMIT  ther is reflection of changes directly at database level,

So cn u tell me wat is ur exat requirement..

to clear confusion of bapi_transaction_commit u cn go through below link

.

thnx n regards,

Jeet