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

FUnction Module

Former Member
0 Likes
455

Hi Guys,

I have been asked to create one function module in which I will pass the sales document number and it should return two tables i_vbak and i_vbap, the i_vbak should have header information of that particular sales oreder and i_vbap should have all item information of that sales order. Can anyone of you please help me how can I get this , as I haven't creatd any FM till now. so any help will be highly appreciated.

Thanks,

Rajeev !!!

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
442

The first thing to do is to read the [help file.|http://help.sap.com/saphelp_47x200/helpdata/EN/9f/db988735c111d1829f0000e829fbfe/frameset.htm]

Rob

5 REPLIES 5
Read only

Former Member
0 Likes
443

The first thing to do is to read the [help file.|http://help.sap.com/saphelp_47x200/helpdata/EN/9f/db988735c111d1829f0000e829fbfe/frameset.htm]

Rob

Read only

0 Likes
442

Thanks for the reply Rob, I have gone through the file. What I have done as of now is I have created one function module and have passed one Import parameter as Vbeln and two tables as i_vbak and i_vbap. I think till now I am doing good. Now I need to write something in source code, so it will be great if you can tell me what should be written in the source code for my particular scenario.

Thanks,

Rajeev

Read only

0 Likes
442

Just a couple of SELECTs against the two tables. You probably also want to raise an exception if nothing is found.

Rob

Read only

0 Likes
442

Hi Rob,

This is what I have written and I think this one is working perfectly fine,

select * from vbak into table data_vbak where vbeln = vbeln.

select * from vbap into table data_vbap where vbeln = vbeln.

and now I have two questions:

1. I want to raise an exception if the document is found, so can you please tell me how can I get this.

2. In case if I just want to return one table that has got both the header and item details rather than returning two diff. tables, so please tell me how can i get this,

Thanks,

Rajeev !!!

Read only

0 Likes
442

1. Raise an exception for found or not found?

2. They have different structures - you should return two tables, not one.

Rob