‎2014 Oct 09 8:14 AM
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.
‎2014 Oct 09 8:18 AM
Hi Cem,
This FM is only to committing database changes only, not for printing purpose.
Thanks
Raju C D
‎2014 Oct 09 9:03 AM
hi raju,
that is what confuses me. i couldnt understand how it is printed in the code.
thank you for your answer.
regards.
cem.
‎2014 Oct 09 9:06 AM
Hi ,
Some bapis does not need commit maybe its one of those will work without commit too.
‎2014 Oct 09 9:13 AM
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
‎2014 Oct 09 9:42 AM
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.
‎2014 Oct 09 10:16 AM
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
‎2014 Oct 09 10:22 AM
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
‎2014 Oct 09 9:15 AM