Skip to Content
0

No Component exist with the name EBELN

Jun 01, 2017 at 06:27 AM

449

avatar image

I am creating a Interactive Report with the get cursor but the error occurs 'no compenent exists with 'ebeln', I have declared the internal table also.

I think some silly mistake is there in select query using outer join.

TYPES: BEGIN OF wat,
LIFNR TYPE LFA1-LIFNR,
NAME1 TYPE LFA1-NAME1,
EBELN TYPE EKKO-EBELN,
END OF wat.


DATA: itab TYPE SORTED TABLE OF wat
WITH NON-UNIQUE KEY LIFNR,
wa_wat type wat.


DATA : IT_EKKO TYPE TABLE OF EKKO,
WA_EKKO TYPE EKKO,
IT_EKPO TYPE TABLE OF EKPO,
WA_EKPO TYPE EKPO,
IT_LFA1 TYPE TABLE OF LFA1,
WA_LFA1 TYPE LFA1.
DATA : FNAM(30), FVAL(50).

SELECT-OPTIONS : S_EBELN FOR WA_EKKO-EBELN.

INITIALIZATION.

AT SELECTION-SCREEN.
PERFORM VALIDATE_INPUT.

START-OF-SELECTION.
PERFORM GET_DATA.
PERFORM DISPLAY_DATA.

TOP-OF-PAGE.
PERFORM DISPLAY_TOPOFPAGE.

AT LINE-SELECTION.
PERFORM DISPLAY_SECONDARYLIST.

TOP-OF-PAGE DURING LINE-SELECTION.
PERFORM LINE_TOPOFPAGE.
FORM VALIDATE_INPUT .

IF S_EBELN IS INITIAL.
MESSAGE 'Enter Purchasing Document Number' TYPE 'E'.
ENDIF.
ENDFORM. " VALIDATE_INPUT

FORM GET_DATA .
SELECT s~LIFNR s~NAME1 p~EBELN
INTO CORRESPONDING FIELDS OF TABLE itab
FROM LFA1 AS s
LEFT OUTER JOIN EKKO AS p ON s~EBELN = p~EBELN.
ENDFORM. " GET_DATA

FORM DISPLAY_DATA .
LOOP AT itab INTO WA_wat.
WRITE:/ WA_LFA1-LIFNR, WA_LFA1-NAME1, WA_EKKO-EBELN.
ENDLOOP.
ENDFORM. " DISPLAY_DATA

FORM DISPLAY_SECONDARYLIST .
GET CURSOR FIELD FNAM VALUE FVAL.
CONDENSE FNAM.
CONDENSE FVAL.
IF FNAM = 'WA_LFA1-lifnr'.
SELECT SINGLE * FROM LFA1 INTO WA_LFA1 WHERE LIFNR = FVAL .
WRITE:/ WA_LFA1-lifnr, WA_LFA1-NAME1, WA_LFA1-ORT01, WA_LFA1-STRAS, WA_LFA1-ERNAM, WA_LFA1-KUNNR, WA_LFA1-SPRAS.

ELSEIF FNAM = 'WA_EKKO-EBELN'.
SELECT * FROM EKKO INTO TABLE IT_EKKO UP TO 50 ROWS WHERE EBELN = FVAL.
LOOP AT IT_EKKO INTO WA_EKKO.
WRITE:/ WA_EKKO-EBELN, WA_EKKO-BUKRS, WA_EKKO-BSART , WA_EKKO-ERNAM , WA_EKKO-LIFNR.
ENDLOOP.
ENDIF.


ENDFORM. " DISPLAY_SECONDARYLIST
FORM DISPLAY_TOPOFPAGE .
WRITE:/ 'Vendor Details' COLOR 3.
ENDFORM. " DISPLAY_TOPOFPAGE
FORM LINE_TOPOFPAGE .
IF FNAM = 'WA_LFA1-LIFNR'.
WRITE:/ 'Vndor details ', WA_LFA1-LIFNR COLOR 5.
ELSEIF FNAM = 'WA_EKKO-EBELN'.
WRITE:/ 'Purchasing Document Details ', WA_EKKO-EBELN COLOR 5.
ENDIF.
ENDFORM. " LINE_TOPOFPAGE

10 |10000 characters needed characters left characters exceeded

Please only post the relevant part of the code. In this case, it is only the data definition of itab (which is terrible name for an internal table), and the form get_data. When you post code, please use the "code" button in the question editor, so that formatting is retained and your question is easy to read.

0
Further commenting has been locked.
* Please Login or Register to Answer, Follow or Comment.

4 Answers

Best Answer
Evgeny Gubenko Jun 01, 2017 at 06:53 AM
0

Hi!

This is because you have no such field (EBELN) in LFA1 table. May be you need to set like this:

LEFT OUTER JOIN EKKO AS p ON s~LIFNR = p~LIFNR "all POs related to this customer

Also you can check EKPA table

Hope it's helpful

Evgeny

Show 1 Share
10 |10000 characters needed characters left characters exceeded

This is the correct answer, and I'm marking it as such, and closing the question. If you have further questions, please post a new question.

0
Further commenting has been locked.
Jürgen L
Jun 01, 2017 at 06:49 AM
1

sometimes it helps to translate coding into real spoken language

You are actually trying to join a vendor master with a purchasing document based on the purchasing document number.

Wouldn't it make a little more sense to do the join on the vendor number instead?

Share
10 |10000 characters needed characters left characters exceeded
Rohan D'Souza Jun 01, 2017 at 06:29 AM
0

FORM GET_DATA .

SELECT s~LIFNR s~NAME1 p~EBELN
INTO CORRESPONDING FIELDS OF TABLE itab
FROM LFA1 AS s
LEFT OUTER JOIN EKKO AS p ON s~EBELN = p~EBELN. " THE ERROR IS SHOWING ON THIS LINE<NO COMPONENT WITH NAME EBELN>
ENDFORM. " GET_DATA

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Just out of interest, why are you defining specific aliases ?

Using p and s and any other type of alias increases the difficulty in maintaining the code at a later date because (although this is a simple case) you have to figure out and remember what p and s are.

Why not use the table name ? It's there and it's free to use:

Select Lfa1~Lifnr Lfa1~Name1 
       Ekko~Ebeln
  Into Corresponding Fields Of Table Itab
  From Lfa1
  Left Outer Join Ekko On Lfa1~Ebeln = Ekko~Ebeln.

The only time you need to make up an alias is when you are doing a self-join:

Select y2~seq y1~charg yfiber~fid
       y1~printed lqua~lgpla
  into table tb_bins
  from yfiberf as y1
 inner join yfiberf as y2 on y2~seq = y1~seq
 inner join yfiber  on yfiber~charg = y1~charg and
                       yfiber~werks = y1~werks 
 inner join lqua    on lqua~lgnum   = y2~lgnum and
                       lqua~matnr   = y2~matnr and
                       lqua~werks   = y2~werks and
                       lqua~charg   = y2~charg
  where y1~werks = w_werks and
        y1~lgnum = w_lgnum and
        y1~charg = w_charg.

(in fact the only time you need an alias is when the tables contain fields of the same name but it's better to include them for understandings sake)

In the example above, Y1 and Y2 are the same table - yFibref.

1
Further commenting has been locked.
Rohan D'Souza Jun 01, 2017 at 07:47 AM
0

Thank You Jürgen and Evgeny but I want the output of the primary report in the format

Vendor No Vendor Name Purchase Order No

V-101 V-100ABC 4500000001

V-102 V-101PQR 4500000002

V-103 V-102XYZ 4500000003

Can you help please?

Show 1 Share
10 |10000 characters needed characters left characters exceeded

from 3 tables LFA1, EKKO AND EKPO.

0
Further commenting has been locked.