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

Error in method...pls correct

Former Member
0 Likes
467

The following code is giving an error "T_EKPO is not an internal table".

Please help me do the correction in the code.

METHOD ZIF_EX_TEST_BADI2~GET_TEST_BADI2.

  TYPES: BEGIN OF TY_PO,
            EBELN TYPE EBELN,
            EBELP TYPE EKPO-EBELP,
            MENGE TYPE EKPO-MENGE,
            END OF TY_PO.

  DATA: WA_PO TYPE TY_PO.
*  DATA:  T_EKPO TYPE STANDARD TABLE OF EKPO INITIAL SIZE 0 .
  CLEAR WA_PO.

*  DATA: sum type ekpo-menge.

  SELECT   EBELN
           EBELP
           MENGE
           INTO TABLE T_EKPO
           FROM EKPO
           WHERE ebeln in s_ebeln.

 LOOP AT T_EKPO INTO WA_PO.
   at new ebeln.
    sum = sum + WA_PO-MENGE.
   endat.
    CLEAR WA_PO.
 ENDLOOP.

ENDMETHOD.

3 REPLIES 3
Read only

former_member195383
Active Contributor
0 Likes
433

TYPES: BEGIN OF TY_PO,

EBELN TYPE EBELN,

EBELP TYPE EKPO-EBELP,

MENGE TYPE EKPO-MENGE,

END OF TY_PO.

DATA: WA_PO TYPE EKPO.

DATA: T_EKPO TYPE STANDARD TABLE OF EKPO INITIAL SIZE 0 .

CLEAR WA_PO.

DATA: sum type ekpo-menge.

SELECT EBELN

EBELP

MENGE

INTO TABLE T_EKPO

FROM EKPO

WHERE ebeln in s_ebeln.

LOOP AT T_EKPO INTO WA_PO.

at new ebeln.

sum = sum + WA_PO-MENGE.

endat.

CLEAR WA_PO.

ENDLOOP.

the above works fine...change the declaration of workarea as stated abv in BOLD

Read only

Former Member
0 Likes
433

Hi,

If your are using the interface of a standard BADI.

we can see in Importing paraemters I_EKPO type EKPO.

delcare the Table type in the TYPES tab of this interface when your implementing.

TYPES:

tt_EKPO type table of EKPO.

In the METHOD use it as-

DATA:

WA_EKPO type EKPO,

IT_EKPO type TT_EKPO.

Now use the LOOP and ENDLOOP.

Reward if helpful.

Best Wishes,

Chandralekha

Read only

Former Member
0 Likes
433

Hey Rudra,

There is no change still. its throuwing the same error.

Here is the report which is calling this method, maybe its of use in correcting the eror.

REPORT  ZREP_TEST_BADI2.
* class declaration
CLASS CL_EXITHANDLER DEFINITION LOAD.
TABLES: EKPO.

DATA: WA_EKPO TYPE EKPO,
T_EKPO TYPE standard TABLE OF EKPO WITH KEY EBELN.

*Initialise the object of the interface.
DATA: EXIT_REF TYPE REF TO ZCL_IM_TEST_BADI2_IMP,
EXIT_REF1 TYPE REF TO ZIF_EX_TEST_BADI2.

SELECTION-SCREEN BEGIN OF BLOCK B1.
SELECT-OPTIONS: S_EBELN FOR EKPO-EBELN.
SELECTION-SCREEN END OF BLOCK B1.


WRITE:/ 'PO Number', 30 'Quantity', 60 'Line Item'.
ULINE.

*LOOP AT IT_EKPO INTO WA_EKPO.
*  WRITE:/ WA_EKPO-EBELN, 30 WA_EKPO-MENGE, 60 WA_EKPO-EBELP.
*ENDLOOP.

*START-OF-SELECTION.
CALL METHOD CL_EXITHANDLER=>GET_INSTANCE
  CHANGING
    INSTANCE = EXIT_REF.

CALL METHOD EXIT_REF->GET_TEST_BADI2
  EXPORTING
    EBELN   = S_EBELN
  IMPORTING
    MENGE   = MENGE
    T_EKPO = T_EKPO
    sum = sum.

LOOP AT T_EKPO INTO WA_EKPO.
  WRITE:/ WA_EKPO-EBELN, 30 WA_EKPO-MENGE, 60 WA_EKPO-EBELP.
  AT NEW S_EBELN.
    WRITE:/ SUM.
  ENDAT.
ENDLOOP.