Skip to Content
author's profile photo
Former Member

Function Module - 2

Hello again,

I have not really solved the problem I had a couple of hours ago. Maybe someone can help me to understand why this program does not work.

REPORT Z_TEST_FUNKTIONSMODUL.

DATA: it_order TYPE STANDARD TABLE OF VPKVBAKTTYP.

DATA: wa_order TYPE VBAK.

wa_order-vbeln = '5100000'.

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.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

6 Answers

  • Oct 03, 2005 at 11:57 AM

    Hi Linn,

    Please change the program as follows and try.

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

    DATA: wa_order TYPE /SAPNEA/MR3_ORDER_HEADER.

    wa_order-SALESDOCUMENT = '0005100000'.

    Cheers

    Vinod

    Message was edited by: Vinod C

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Oct 03, 2005 at 12:01 PM

    Try this

    DATA: it_order TYPE STANDARD TABLE OF /SAPNEA/MR3_ORDER_ITEM

    .

    DATA: wa_order TYPE /SAPNEA/MR3_ORDER_HEADER.

    wa_order-salesdocument = '5100000'.

    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.

    if sy-subrc ne 0.

    ENDIF.

    Make sure sales order no 5100000 exists in your system.

    Verify in VA03.

    Cheers

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      if sy-subrc ne 0.

      ENDIF.

      What in word does that mean? I want a message for example "not an ordernumber" if 51.... does not exist.

  • author's profile photo
    Former Member
    Oct 03, 2005 at 12:07 PM

    You can go to transaction VA03 to look up your sales document number.

    Sudha

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Oct 03, 2005 at 12:18 PM

    Hi,

    THe return parameter will contain the error message if there is any problem with the FM execution.

    Can u find out what is the error message, so that we can investiage further.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Thanks for your answear.

      Can I write something like this?

      Data: wa_result LIKE LINE OF it_order.

      LOOP AT it_order INTO wa_result.

      WRITE: test-POSNR_VA

      ENDLOOP.

  • author's profile photo
    Former Member
    Oct 03, 2005 at 12:45 PM

    IT_RETURN TYPE BAPIRET2.

    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 = IT_RETURN

    TABLES

    POT_ORDER_ITEM = it_order.

    Are u telling me that IT_RETURN is empty?

    Please confirm.

    If not, read the contents of structure IT_RETURN and let us know.

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Oct 03, 2005 at 01:15 PM

    Well,

    If the code that u have posted is the code of the entire report, then if even if u execute it and if it is successfull u will never know.

    First read the contens of parameter RETURN into a work area. See if it has message type 'E'. That means there has been an error.

    You can simply write that error message using field RETURN-MESSAGE.

    If not then the execution is successfull and u can read the contents of IT_ORDER by looping.

    Loop at IT_ORDER.

    Write : IT_ORDER.

    Endloop.

    First assign WA_RETURN TYPE BAPIRET2 to RETURN parameter of FM. then read it if it has message type 'E'.

    i.e WA_RETURN-TYPE eq 'E'.

    Then if it is error just display it or loop at the table and display its contents.

    Add comment
    10|10000 characters needed characters exceeded