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

FM K_ORDER_READ direct execution and program execution result different

jeet_bhattacharjee
Participant
0 Likes
1,948

Hi Gurus,

I am trying to fetch the details of a production order using FM K_ORDER_READ passing the production order number only in my program.

CALL FUNCTION 'K_ORDER_READ'

     EXPORTING

       aufnr     = i_aufnr

     IMPORTING

       i_aufkv   = l_aufkv

       erloese   = l_erloese

     EXCEPTIONS

       not_found = 01.


The aufkv structure returned (l_aufkv) does not have the sales order number (KDAUF) and the item number (KDPOS) filled when the program is executed, but if I directly execute the FM from SE37 with the same input the result is different, the sales order number mapped is correctly fetched.


Really at loss for a possible explanation for the above behavior.  Please help!!


Regards,

Jeet

1 ACCEPTED SOLUTION
Read only

ThangaPrakash
Active Contributor
0 Likes
1,864

Hello Jeet,

Try to pass the value NO_BUFFER = 'X' in the exporting parameter of the function module and check whether it works.

CALL FUNCTION 'K_ORDER_READ'

     EXPORTING

       aufnr     = i_aufnr

       NO_BUFFER = 'X'

     IMPORTING

       i_aufkv   = l_aufkv

       erloese   = l_erloese

     EXCEPTIONS

       not_found = 01.


Regards,

Thanga

8 REPLIES 8
Read only

jeet_bhattacharjee
Participant
0 Likes
1,864

I hope my question is clear enough. Does anyone have any idea on how to solve this problem???

Read only

0 Likes
1,864

Jeet...just check if the input i_aufnr you are passing to FM through program has leading zeroes or not.

Raghav

Read only

0 Likes
1,864

Hi Raghavendra,

I have used conversion exits before passing the order number to this FM, so leading zeroes is out of question.

Regards,

Jeet

Read only

ThangaPrakash
Active Contributor
0 Likes
1,865

Hello Jeet,

Try to pass the value NO_BUFFER = 'X' in the exporting parameter of the function module and check whether it works.

CALL FUNCTION 'K_ORDER_READ'

     EXPORTING

       aufnr     = i_aufnr

       NO_BUFFER = 'X'

     IMPORTING

       i_aufkv   = l_aufkv

       erloese   = l_erloese

     EXCEPTIONS

       not_found = 01.


Regards,

Thanga

Read only

ThangaPrakash
Active Contributor
0 Likes
1,864

Use conversion routines before passing the order number to the FM

Read only

ThangaPrakash
Active Contributor
0 Likes
1,864

Hello Jeet,

That's great. Conversion routine worked. Please close the thread if the issue is solved.

Regards,

Thanga

Read only

0 Likes
1,864

Hi Thanga,

Sorry to disappoint you but the issue is not solved, I meant that leading zeroes is not causing the issue. Anyways with some deep debugging I found that the issue is due to buffer (attribute of this fm) containing some values from the previous steps in the program, so your solution to pass No buffer parameter might actually work. But the problem is this fm is called inside another fm WTYSC01_COLLECT_DIP_ITEMS. So I can not change the call to fm k_order_read. I have opened a new thread to continue this discussion with topic WTYSC01_COLLECT_DIP_ITEMS gives DYNAMIC_ITEM_ERROR . Neverthless your answer was really helpful. Thanks!!

regards,

Jeet

Read only

jeet_bhattacharjee
Participant
0 Likes
1,864

The link to the new thread opened is

I am thinking of using an enhancement to modify the code inside fm k_order_read to bypass the buffer entries (of course with a filter so that its hit only for the concerned flow). If any body else has any suggestion please post it in the new thread opened.