Dear Friends
I am trying to run the bapi 'BAPI_QUOTATION_CREATEFROMDATA2' and 'BAPI_TRANSACTION_COMMIT' in proper sequence as recommended by SAP.
I am entering the minimum data recommended by SAP help on this BAPI.
When I run the above senario manually from transaction SE37 and selecting
from the menu Function Module -> Test -> Test Sequence,
everything works fine and this also creates a quote and when I check, it
is adding lots of extra related data.
However, when I call the same two functions from another program (SE38),
even though I am entering the same Data, I get different behaviour and
also the quote is not getting created. When I check the ls_return value,
it says that 'sold-to-party' is missing. I don't know why this problem
doesn't arise when I run the BAPI manually from SE37.
I would appreciate if you can please give me any feedback or some expert comments.
Please see the SE38 program that I am using to test these two BAPIs.
==========================================================
&----
*& Report ZQUOTECREATE_TEST
*&
&----
*&
*&
&----
report zquotecreate_test.
data: ls_quotation_header_in type bapisdhd1,
ls_behave_when_error type bapiflag-bapiflag,
ls_quotation_partners like bapiparnr occurs 1 with header line,
ls_return like bapiret2 occurs 1 with header line.
ls_quotation_header_in-distr_chan = '12'.
ls_quotation_header_in-division = '00'.
ls_quotation_header_in-sales_org = '1000'.
ls_quotation_header_in-doc_type = 'AG'.
ls_behave_when_error = 'P'.
ls_quotation_partners-partn_role = 'SP'.
ls_quotation_partners-partn_numb = '1012'.
call function 'BAPI_QUOTATION_CREATEFROMDATA2'
exporting
quotation_header_in = ls_quotation_header_in
BEHAVE_WHEN_ERROR = ls_BEHAVE_WHEN_ERROR
importing
salesdocument = ls_salesdocument
tables
return = ls_return
quotation_partners = ls_quotation_partners
. .
call function 'BAPI_TRANSACTION_COMMIT'
exporting
wait = ' '
IMPORTING
RETURN =
.