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

'BAPI_QUOTATION_CREATEFROMDATA2' behaves different while called from SE38

Former Member
0 Likes
2,016

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 =

.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,554

Hi Ram,

ls_quotation_partners-partn_numb = '1012'.

Before passing partner no to ls_quotation_partners, use conevrsion function module 'CONVERSION_EXIT_ALPHA_INPUT' and then pass the converted value to ls_quotation_partners .

Regards,

Anil

9 REPLIES 9
Read only

Former Member
0 Likes
1,554

Dear friends

I figured out the conversion problem involving 'QT' and 'AG'.

There is this flag 'CONVERT' which doesn't affect while running manually but while calling from SE38, I have to turn it on by putting a value 'X" and so the AG-QT issue is resolved

So if you can please respond to the other problem with error 'Please enter sold-to-party or ship-to-party', I would appreciate.

Again with the same test data, the above error message doesn't show up while running the BAPI manually from SE37 and QUOTE gets created successfully. However, when the same BAPI is called from SE38 program I get the above error message and QUOTE doesnt get created.

Read only

0 Likes
1,554

Hi Ram Prasad,

just fill is_quotation_header_inx.

ls_quotation_header_in*x*-distr_chan = 'X'.
ls_quotation_header_in*x*-division = 'X'.
ls_quotation_header_in*x*-sales_org = 'X'.
ls_quotation_header_in*x*-doc_type = 'X'.

Hope it helps,

Pratik Vora

Read only

0 Likes
1,554

Pratik

Thanks for the response. I tried your suggestion by putting the following

ls_quotation_header_inx-updateflag = 'I'.

ls_quotation_header_inx-doc_type = 'X'.

ls_quotation_header_inx-sales_org = 'X'.

ls_quotation_header_inx-distr_chan = 'X'.

ls_quotation_header_inx-division = 'X'.

But, still I get the same error message.

Any other suggestions or feedback will be appreciated.

Tks

Ram

Read only

0 Likes
1,554

hi ram prasad,

QUOTATION_PARTNERS is internal table,

so you have to declare it as a internal table

data: IS_QUOTATION_PARTNERS TABLE OF QUOTATION_PARTNERS with header line..

Then after filling values for parteners,

 append IS_QUOTATION_PARTNERS.

then just pass it to function module.

Hope it will resolve your problem.

Regards,

Pratik Vora

Read only

0 Likes
1,554

Hi Pratik

First of all thanks for your response.

Yes, I have defined the internal table. I didn't paste the whole program since it will be too long and thought people may not be interested in going thro' the whole program :-).

I will try other suggestions and see if that helps.

Thanks again.

Ram

Read only

0 Likes
1,554

Hi Ram Prasad,

If you have resolved your query, Kindly share it with us, that what was the problem & how have you solved it??

Regards,

Pratik Vora

Read only

0 Likes
1,554

Pratik

Thanks for all the suggestions. I have tried them but unfortunately that hasn't helped, but good thing is that I am learning new things. I will wait and see if anybody else has any other comments or suggestions. I am also trying other sources to resolve this issue and once I get this resolved, I wil definitely share with forum members.

Thanks again.

Ram

Read only

Former Member
0 Likes
1,555

Hi Ram,

ls_quotation_partners-partn_numb = '1012'.

Before passing partner no to ls_quotation_partners, use conevrsion function module 'CONVERSION_EXIT_ALPHA_INPUT' and then pass the converted value to ls_quotation_partners .

Regards,

Anil

Read only

Former Member
0 Likes
1,554

Values for some of the mandatory fields were missing while calling the BAPI and once I sent all the values needed, it worked.