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

Creating orders via SD_SALESDOCUMENT_CREATE

Former Member
0 Likes
2,818

Hello Everyone!

I am using SD_SALESDOCUMENT_CREATE in creating sales documents order type YKE and YKR. I am successful in creating the sales orders, however, when i go in and check the order created, i can see that the order quantity is not being populated. Its value is always 0. I've tried changing the field type of my variable but i am successful.

Any suggestions are greatly appreciated!

Thanks in advance!

Jim

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,564

You need to debug your program and check on your order quantity inside your internal table, confirm whether there is any values inside it.

The most possible problem when your order quantity is not populated will be the order quantity inside your internal table contained no value.

You need to debug your program and check on your order quantity inside your internal table, confirm whether there is any values inside it.

The most possible problem when your order quantity is not populated will be the order quantity inside your internal table contained no value.

17 REPLIES 17
Read only

Former Member
0 Likes
2,565

You need to debug your program and check on your order quantity inside your internal table, confirm whether there is any values inside it.

The most possible problem when your order quantity is not populated will be the order quantity inside your internal table contained no value.

Read only

0 Likes
2,564

I have already debugged it and there is a value passed to the Function Module.

Read only

0 Likes
2,564

can paste the coding here?

I may need to take a look.

Read only

0 Likes
2,564

Here it is.

i_sales_items_in-itm_number = v_item.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = i_tab3-matnr

IMPORTING

output = i_tab3-matnr.

IF sy-subrc <> 0. "#EC *

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

  • DATA: v_kwmeng_tmp LIKE rv45a-kwmeng.

DATA: v_kwmeng_tmp type dzmeng.

MOVE i_tab3-kwmeng TO v_kwmeng_tmp.

i_sales_items_in-material = i_tab3-matnr.

i_sales_items_in-plant = i_tab3-werks.

i_sales_items_in-batch = i_tab3-charg.

i_sales_items_in-target_qty = v_kwmeng_tmp.

  • i_sales_items_in-target_qu = i_tab3-vrkme.

i_sales_items_in-sales_unit = i_tab3-vrkme.

i_sales_items_in-target_val = i_tab3-netpr.

APPEND i_sales_items_in.

CALL FUNCTION 'SD_SALESDOCUMENT_CREATE'

EXPORTING

sales_header_in = v_sales_header_in

IMPORTING

salesdocument_ex = v_salesdocument_ex

TABLES

return = i_return

sales_items_in = i_sales_items_in

sales_partners = i_sales_partners

sales_conditions_in = i_sales_conditions_in "#EC *

sales_text = i_sales_text. "#EC ENHOK

Read only

0 Likes
2,564

Hi Jim

I think you are not populating SALES_HEADER_INX, SALES_ITEMS_INX, SALES_CONDITIONS_INX.

Please try populating the adove structure, tables and

pass to BAPI.

Kind Regards

Eswar

Read only

0 Likes
2,564

As simple as this, i believe that you changed your data type as below:

  • DATA: v_kwmeng_tmp LIKE rv45a-kwmeng.

DATA: v_kwmeng_tmp type dzmeng.

The first declaration where you commented should be working whereas the second 1 wont work.

The reason is if your check on the data type, kwmeng is QUAN and length 15 and dzmeng is QUAN length 13, thats make the different where your order quantity is not working.

Read only

0 Likes
2,564
  • DATA: v_kwmeng_tmp LIKE rv45a-kwmeng.

DATA: v_kwmeng_tmp type dzmeng.

I've already tried using either of the declaration from above but still not successfull in populating the order quantity of the created order.

Read only

0 Likes
2,564

How you declare i_tab3-kwmeng?

You must declare exactly the same data type as v_kwmeng_tmp.

Read only

0 Likes
2,564

The declaration is already the same.

Read only

0 Likes
2,564

Oh gosh!

how about this?

i_sales_items_in-target_qty = v_kwmeng_tmp.

i_sales_items_in-target_qty must also declare the same data type as v_kwmeng_tmp

Read only

0 Likes
2,564

still not working...

I'm getting hopeless with this...

Read only

0 Likes
2,564

Killing problem. lol

You sure your internal table TARGET_QTY got value before passing into the BAPI?

If really got value, I also dont know why already.

Read only

0 Likes
2,564

is the sales_items_in internal table the only table that should be filled-up when using SD_SALESDOCUMENT_CREATE?

i was wondering if there are other tables that need to be filled up...

thanks,

jim

Read only

0 Likes
2,564

Hi Jim

As mentioned in my earlier post, please populate entries for <b>SALES_HEADER_INX, SALES_ITEMS_INX, SALES_CONDITIONS_INX, SALES_SCHEDULES_IN & SALES_SCHEDULES_INX.</b>

By populating the schedule lines, i guess your problem will be resolved. Kindly check the same and let us know if it works.

Kind Regards

Eswar

Read only

0 Likes
2,564

Thanks a lot!!!

Read only

Former Member
0 Likes
2,564

HI Jim

Kindly check if you are passing like '1.000' or '0000...1.000'. I guess both makes difference.

Kind Regards

Eswar

Read only

former_member186741
Active Contributor
0 Likes
2,564

are you passing a valid unit of measure associated with the quantity? eg, KG,EA etc

why is this commented out?

  • i_sales_items_in-target_qu = i_tab3-vrkme.