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

Create SALES ORDER: BAPI_SALESORDER_CREATEFROMDAT2

Former Member
0 Likes
1,929

hI !!!

i'm working in the version 4.6 B

When i test the bapi: BAPI_SALESORDER_CREATEFROMDAT2 in transaction SE37 this execute successful but when,

i execute the same bapi with the same parameters in code abap this generate the

message:

E V1 312 Sales document type PS is not defined

I don't know why in test mode don`t generate a message

and when a run this since abap code, generate an error.

Someone know what are happening ?

Best Regards

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,124

Hi Noemi,

Don't listen to Subramanian V! It is in fact highly likely that a test of a function module in SE37 works and then does not work when called in ABAP. The culprit is almost always the fact that in SE37 SAP automatically converts what you type in into internal format (for example customer number 0000003370, when you type in 3370 - ok listen to Subramanian V on this point).

In your case, when you type in sales document type PS, SAP is converting that to the internal version of this document type. If you check table TVAKT, you can see all the conversions from internal types to external types (by language).

Hope that helps.

Cheers,

Brad

4 REPLIES 4
Read only

Former Member
0 Likes
1,124

Hi Noemi,

It is highly unlikely that it would work in SE37, but would not work in an ABAP program. However I suggest a few things:

a) Make sure you have done proper conversion while passing data, for eg. if a particular value you enter in SE37 as 20034, you might have to enter it as 000000200034 in your ABAP program.

b) Please check once again whether all your input data is correct and exactly matches with Test data

If above solution does not work, you might post your code here.

Regards,

Subramanian V.

Read only

Former Member
0 Likes
1,125

Hi Noemi,

Don't listen to Subramanian V! It is in fact highly likely that a test of a function module in SE37 works and then does not work when called in ABAP. The culprit is almost always the fact that in SE37 SAP automatically converts what you type in into internal format (for example customer number 0000003370, when you type in 3370 - ok listen to Subramanian V on this point).

In your case, when you type in sales document type PS, SAP is converting that to the internal version of this document type. If you check table TVAKT, you can see all the conversions from internal types to external types (by language).

Hope that helps.

Cheers,

Brad

Read only

0 Likes
1,124

You need to pass the internal value of the sales document type .

<u><b>How do i find the internal values?</b></u>

go to the domain of sales document type which is AUART.

you can find a field called conversion routine which will hold 2 FMs. One to convert from external to internal and the other from internal to external (these values reside in table TAUUM - this table is for sales document type conversion). You should use these FMs to convert the value to internal format and pass it to the BAPI.

<u><b>Why it worked in SE37?</b></u>

Here SAP takes care of the conversion automatically.

Regards

Raja

Read only

0 Likes
1,124

.......

Subramanian, Brad and Raja.

Thanks for your suggestions its were useful, with

these i can resolve my problem.

!!! Best Regards !!!

  • Raja

I used the se37 to test bapis, is more easy and fast !!

and you can save data like variant, and you can simulate the real execution without write any code abap,

and re-process the times that you need,

when you know what fields you need you write your abap code faster.

Thanks !!!

Message was edited by: Noemi Huerta