Application Development 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: 

Function module

Former Member
0 Kudos

Anybody how know why my program does not work?

REPORT Z_TEST_FUNKTIONSMODUL .

DATA wa_order TYPE VBAK. "orderheader

DATA it_order TYPE VPKVBAKTTYP. "create intern table from table type

CALL FUNCTION '/SAPNEA/SMAPI_ORDER_GETDETAIL'

EXPORTING

PI_ORDER_HEADER = wa_order

  • PI_PARVW =

  • PI_PRICE_CONDITION1 = 'PR00'

  • PI_PRICE_CONDITION2 =

  • PI_PRICE_CONDITION3 =

  • PI_TAX_CONDITION =

  • PI_UNIT_SPLIT = 50

  • PI_TEXT_ID = '0001'

  • PI_LANGUAGE = SY-LANGU

  • IMPORTING

  • PO_ORDER_HEADER =

  • RETURN =

TABLES

POT_ORDER_ITEM = it_order.

12 REPLIES 12

Former Member
0 Kudos

Hi Linn,

Do you have any data inside wa_order?

Regards,

Ville

0 Kudos

No....

I am quite new on ABAP. Shell I use a select?

0 Kudos

Actually I do not really understand what the function module do... Any idea?

athavanraja
Active Contributor
0 Kudos

wa_order should be of type /SAPNEA/MR3_ORDER_HEADER

it_order should be of type /SAPNEA/MR3_ORDER_ITEM

Regards

Raja

0 Kudos

Hi Linn,

Modify your code to look something like this:

DATA: wa_order TYPE /SAPNEA/MR3_ORDER_HEADER.
DATA: it_order TYPE STANDARD TABLE OF /SAPNEA/MR3_ORDER_ITEM.

wa_order-SALESDOCUMENT = 'HERE_YOU_SHOULD_PUT_SALES_DOCUMENT_NUMBER'.

CALL FUNCTION '/SAPNEA/SMAPI_ORDER_GETDETAIL'
EXPORTING
PI_ORDER_HEADER = wa_order
* PI_PARVW =
* PI_PRICE_CONDITION1 = 'PR00'
* PI_PRICE_CONDITION2 =
* PI_PRICE_CONDITION3 =
* PI_TAX_CONDITION =
* PI_UNIT_SPLIT = 50
* PI_TEXT_ID = '0001'
* PI_LANGUAGE = SY-LANGU
* IMPORTING
* PO_ORDER_HEADER =
* RETURN =
TABLES
POT_ORDER_ITEM = it_order.

Note that you must pass some value to the function module to get some values back. So in above example you must pass some data to the workarea like sales document number.

Regards,

Ville

0 Kudos

Is sales document number "vbeln" in table "vbak" or how do I find the document number?

0 Kudos

Hi Linn,

Sales document number is VBELN in VBAK like you already assumed.

Regards,

Ville

0 Kudos

Hi Linn,

Test this code:

DATA: wa_order TYPE /SAPNEA/MR3_ORDER_HEADER.
DATA: it_order TYPE STANDARD TABLE OF /SAPNEA/MR3_ORDER_ITEM.

PARAMETERS pa_order TYPE vbak-vbeln.

wa_order-SALESDOCUMENT = pa_order.
 
CALL FUNCTION '/SAPNEA/SMAPI_ORDER_GETDETAIL'
EXPORTING
PI_ORDER_HEADER = wa_order
* PI_PARVW =
* PI_PRICE_CONDITION1 = 'PR00'
* PI_PRICE_CONDITION2 =
* PI_PRICE_CONDITION3 =
* PI_TAX_CONDITION =
* PI_UNIT_SPLIT = 50
* PI_TEXT_ID = '0001'
* PI_LANGUAGE = SY-LANGU
* IMPORTING
* PO_ORDER_HEADER =
* RETURN =
TABLES
POT_ORDER_ITEM = it_order.

Regards,

Ville

0 Kudos

Hi Linn,

If you found any of these answers useful please close the post and reward points.

Regards,

Ville

Former Member
0 Kudos

Linn,

Sounds like the function module will get the Order details if you pass the right values to the parameter wa_order.

However, in the code you have given, you are not passing in any values in wa_order so its not going to return any values.

Please fill the variable wa_order with the order no. etc and it should give you the details in the table it_order.

Regards,

Ravi

Note : please reward points if this helpful.

0 Kudos

Thanks for helping me. Do you mean something like this?

PARAMETERS pa_order TYPE I. “table fiels

DATA it_order TYPE VPKVBAKTTYP. "create intern table from table type

CALL FUNCTION '/SAPNEA/SMAPI_ORDER_GETDETAIL'

EXPORTING

PI_ORDER_HEADER = pa_order

  • PI_PARVW =

  • PI_PRICE_CONDITION1 = 'PR00'

  • PI_PRICE_CONDITION2 =

  • PI_PRICE_CONDITION3 =

  • PI_TAX_CONDITION =

  • PI_UNIT_SPLIT = 50

  • PI_TEXT_ID = '0001'

  • PI_LANGUAGE = SY-LANGU

  • IMPORTING

  • PO_ORDER_HEADER =

  • RETURN =

TABLES

POT_ORDER_ITEM = it_order.

Former Member
0 Kudos

If you have an order number with you, you can try something like this.

Select * from vbak into corresponding fields of wa_order where vbeln = (order number).

Now pass the wa_order to the function module.

Regards,

Ravi