Skip to Content
author's profile photo Former Member
Former Member

Error in program of join two tables

I have written following code:

TABLES: lfa1, lfbk.

TYPES: BEGIN OF str1_lfa1_lfbk,

lifnr LIKE lfa1-lifnr,

sortl LIKE lfa1-sortl,

pstlz LIKE lfa1-pstlz,

ort01 LIKE lfa1-ort01,

name1 LIKE lfbk-bankn,

stras LIKE lfbk-banks,

adrnr LIKE lfbk-bankl,

END OF str1_lfa1_lfbk.

DATA: wa1_lfa1_lfbk TYPE str1_lfa1_lfbk,

it1_lfa1_lfbk TYPE STANDARD TABLE OF str1_lfa1_lfbk.

SELECT-OPTIONS: s_lifnr FOR lfa1-lifnr DEFAULT 1.

SELECT a~lifnr

a~sortl

a~pstlz

a~ort01

b~bankn

b~banks

b~bankl

INTO wa1_lfa1_lfbk

FROM lfa1 AS a INNER JOIN lfbk AS b

ON alifnr = blifnr

WHERE a~lifnr IN s_lifnr.

APPEND wa1_lfa1_lfbk TO it1_lfa1_lfbk.

ENDSELECT.

LOOP AT it1_lfa1_lfbk INTO wa1_lfa1_lfbk.

ULINE.

WRITE: /5 wa1_lfa1_lfbk-lifnr,

20 wa1_lfa1_lfbk-sortl,

35 wa1_lfa1_lfbk-pstlz,

50 wa1_lfa1_lfbk-ort01.

SKIP.

WRITE: /5 text-001 wa1_lfa1_lfbk-bankn,

/5 text-002 wa1_lfa1_lfbk-banks,

/5 text-003 wa1_lfa1_lfbk-bankl.

ENDLOOP.

and getting following error:

Unable to interpret "WA1_LFA1_LFBK-BANKN". Possible causes of error:

Incorrect spelling or comma error.

plz help me i m new in ABAP

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

9 Answers

  • Posted on Sep 20, 2007 at 09:31 AM

    BANKN is not defined in you're structure so therefor unknown

    kind regards

    arthur

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 20, 2007 at 09:31 AM

    Because your declaration is this

    name1 LIKE lfbk-bankn,

    and you write the result using this

    WRITE: /5 text-001 wa1_lfa1_lfbk-bankn,

    try changing your write code to this

    WRITE: /5 text-001 wa1_lfa1_lfbk-name1,

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 20, 2007 at 09:35 AM

    hi rakesh,

    use bankn instead of name1 in the declaration of str1_lfa1_lfbk.

    its better prog technique to put the same name as SAP defined.

    use internal table in select stmt after into clause.

    remove Endselect, coz performance wise it is not good.

    and then loop athe int table to print the output.

    <b>Reward points if useful</b>

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 20, 2007 at 09:36 AM

    Hi,

    u have to define BANKN field in ur structure.Deifne it and chek it will work..

    TYPES: BEGIN OF str1_lfa1_lfbk,

    lifnr LIKE lfa1-lifnr,

    sortl LIKE lfa1-sortl,

    pstlz LIKE lfa1-pstlz,

    ort01 LIKE lfa1-ort01,

    name1 LIKE lfbk-bankn,

    stras LIKE lfbk-banks,

    adrnr LIKE lfbk-bankl,

    banfn like........<specify the type>

    END OF str1_lfa1_lfbk.

    Regards,

    Nagaraj

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 20, 2007 at 09:39 AM

    hi,

    change ur code like this.

    LOOP AT it1_lfa1_lfbk INTO wa1_lfa1_lfbk.

    ULINE.

    WRITE: /5 wa1_lfa1_lfbk-lifnr,

    20 wa1_lfa1_lfbk-sortl,

    35 wa1_lfa1_lfbk-pstlz,

    50 wa1_lfa1_lfbk-ort01.

    SKIP.

    <b> WRITE: /5 text-001,wa1_lfa1_lfbk-name1,

    /5 text-002, wa1_lfa1_lfbk-stras,

    /5 text-003, wa1_lfa1_lfbk-adrnr.</b>

    ENDLOOP.

    Hope it will b useful.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 20, 2007 at 09:46 AM

    TABLES: lfa1, lfbk.

    TYPES: BEGIN OF str1_lfa1_lfbk,

    lifnr LIKE lfa1-lifnr,

    sortl LIKE lfa1-sortl,

    pstlz LIKE lfa1-pstlz,

    ort01 LIKE lfa1-ort01,

    name1 LIKE lfbk-bankn,

    stras LIKE lfbk-banks,

    adrnr LIKE lfbk-bankl,

    END OF str1_lfa1_lfbk.

    DATA: wa1_lfa1_lfbk TYPE str1_lfa1_lfbk,

    it1_lfa1_lfbk TYPE STANDARD TABLE OF str1_lfa1_lfbk.

    SELECT-OPTIONS: s_lifnr FOR lfa1-lifnr DEFAULT 1.

    SELECT a~lifnr

    a~sortl

    a~pstlz

    a~ort01

    b~bankn

    b~banks

    b~bankl

    INTO wa1_lfa1_lfbk

    FROM lfa1 AS a INNER JOIN lfbk AS b

    ON alifnr = blifnr

    WHERE a~lifnr IN s_lifnr.

    APPEND wa1_lfa1_lfbk TO it1_lfa1_lfbk.

    ENDSELECT.

    LOOP AT it1_lfa1_lfbk INTO wa1_lfa1_lfbk.

    ULINE.

    WRITE: /5 wa1_lfa1_lfbk-lifnr,

    20 wa1_lfa1_lfbk-sortl,

    35 wa1_lfa1_lfbk-pstlz,

    50 wa1_lfa1_lfbk-ort01.

    SKIP.

    //************Changes made here********

    WRITE: /5 text-001,wa1_lfa1_lfbk-name1,

    /5 text-002 ,wa1_lfa1_lfbk-stras,

    /5 text-003 ,wa1_lfa1_lfbk-adrnr.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 20, 2007 at 09:52 AM

    Hi,

    use code as below :

    TABLES: lfa1, lfbk.

    TYPES: BEGIN OF str1_lfa1_lfbk,

    lifnr LIKE lfa1-lifnr,

    sortl LIKE lfa1-sortl,

    pstlz LIKE lfa1-pstlz,

    ort01 LIKE lfa1-ort01,

    bankn LIKE lfbk-bankn,

    banks LIKE lfbk-banks,

    bankl LIKE lfbk-bankl,

    END OF str1_lfa1_lfbk.

    DATA: wa1_lfa1_lfbk TYPE str1_lfa1_lfbk,

    it1_lfa1_lfbk TYPE STANDARD TABLE OF str1_lfa1_lfbk.

    SELECT-OPTIONS: s_lifnr FOR lfa1-lifnr DEFAULT 1.

    SELECT a~lifnr

    a~sortl

    a~pstlz

    a~ort01

    b~bankn

    b~banks

    b~bankl

    INTO wa1_lfa1_lfbk

    FROM lfa1 AS a INNER JOIN lfbk AS b

    ON alifnr = blifnr

    WHERE a~lifnr IN s_lifnr.

    APPEND wa1_lfa1_lfbk TO it1_lfa1_lfbk.

    ENDSELECT.

    LOOP AT it1_lfa1_lfbk INTO wa1_lfa1_lfbk.

    ULINE.

    WRITE: /5 wa1_lfa1_lfbk-lifnr,

    20 wa1_lfa1_lfbk-sortl,

    35 wa1_lfa1_lfbk-pstlz,

    50 wa1_lfa1_lfbk-ort01.

    SKIP.

    WRITE: /5 text-001, wa1_lfa1_lfbk-bankn,

    /5 text-002, wa1_lfa1_lfbk-banks,

    /5 text-003, wa1_lfa1_lfbk-bankl.

    ENDLOOP.

    Reward points, if helpful,

    Sandeep Kaushik

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 20, 2007 at 09:56 AM

    try this.<b> PROBLEM RESOLVED</b>

    TABLES: lfa1, lfbk.

    TYPES: BEGIN OF str1_lfa1_lfbk,

    lifnr LIKE lfa1-lifnr,

    sortl LIKE lfa1-sortl,

    pstlz LIKE lfa1-pstlz,

    ort01 LIKE lfa1-ort01,

    name1 LIKE lfbk-bankn,

    stras LIKE lfbk-banks,

    adrnr LIKE lfbk-bankl,

    END OF str1_lfa1_lfbk.

    DATA: wa1_lfa1_lfbk TYPE str1_lfa1_lfbk,

    it1_lfa1_lfbk TYPE STANDARD TABLE OF str1_lfa1_lfbk.

    SELECT-OPTIONS: s_lifnr FOR lfa1-lifnr DEFAULT 1.

    SELECT a~lifnr

    a~sortl

    a~pstlz

    a~ort01

    b~bankn

    b~banks

    b~bankl

    INTO wa1_lfa1_lfbk

    FROM lfa1 AS a INNER JOIN lfbk AS b

    ON alifnr = blifnr

    WHERE a~lifnr IN s_lifnr.

    APPEND wa1_lfa1_lfbk TO it1_lfa1_lfbk.

    ENDSELECT.

    LOOP AT it1_lfa1_lfbk INTO wa1_lfa1_lfbk.

    ULINE.

    WRITE: /5 wa1_lfa1_lfbk-lifnr,

    20 wa1_lfa1_lfbk-sortl,

    35 wa1_lfa1_lfbk-pstlz,

    50 wa1_lfa1_lfbk-ort01.

    SKIP.

    WRITE: /5 text-001, wa1_lfa1_lfbk-name1,

    /5 text-002, wa1_lfa1_lfbk-stras,

    /5 text-003, wa1_lfa1_lfbk-adrnr.

    ENDLOOP.

    reward if useful.

    Amit Singla

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 20, 2007 at 10:52 AM

    hi rakesh,

    go through this code , it will surely works.

    TABLES: lfa1, lfbk.

    TYPES: BEGIN OF str1_lfa1_lfbk,

    lifnr LIKE lfa1-lifnr,

    sortl LIKE lfa1-sortl,

    pstlz LIKE lfa1-pstlz,

    ort01 LIKE lfa1-ort01,

    name1 LIKE lfbk-bankn,

    stras LIKE lfbk-banks,

    adrnr LIKE lfbk-bankl,

    END OF str1_lfa1_lfbk.

    DATA: wa1_lfa1_lfbk TYPE str1_lfa1_lfbk,

    it1_lfa1_lfbk TYPE STANDARD TABLE OF str1_lfa1_lfbk.

    SELECT-OPTIONS: s_lifnr FOR lfa1-lifnr DEFAULT 1.

    SELECT a~lifnr

    a~sortl

    a~pstlz

    a~ort01

    b~bankn

    b~banks

    b~bankl

    INTO wa1_lfa1_lfbk

    FROM lfa1 AS a INNER JOIN lfbk AS b

    ON alifnr = blifnr

    WHERE a~lifnr IN s_lifnr.

    APPEND wa1_lfa1_lfbk TO it1_lfa1_lfbk.

    ENDSELECT.

    LOOP AT it1_lfa1_lfbk INTO wa1_lfa1_lfbk.

    ULINE.

    WRITE: /5 wa1_lfa1_lfbk-lifnr,

    20 wa1_lfa1_lfbk-sortl,

    35 wa1_lfa1_lfbk-pstlz,

    50 wa1_lfa1_lfbk-ort01.

    SKIP.

    WRITE: /5 text-001, wa1_lfa1_lfbk-name1,

    /5 text-002, wa1_lfa1_lfbk-stras,

    /5 text-003, wa1_lfa1_lfbk-adrnr.

    ENDLOOP.

    <b>rewards points if helpfull.</b>

    with regards,

    radhika kolluru.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.