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

Selecting Data

Former Member
0 Likes
1,729

Hi Experts,

i am selecting the data from table PAYR to display the cheque payment details.

in the HBKID(5) -house bank key is there.

i need to display bank name.

for that i found a std table T012... if u display the entries it displays the bank name

but that field is not there in table.

i also tried from table bnka. but it is not selecting data because of lenth difference i.e.. bankl(15) and hbkid(5).

can you please anyone help me in this regard.

Edited by: anurag.radha on Sep 21, 2011 10:23 AM

1 ACCEPTED SOLUTION
Read only

deepak_dhamat
Active Contributor
0 Likes
1,552

Hi ,

Please check in T012 there displays Bank key and its details but it will not show text1 field , because text1 field is taken from This table T012T .

so for taking bank details name you have to pass bank key to "T012T"

and get details .

Always remeber that for master tables when it does not show description field it means there add "T" at last and will give description table .

regards

Deepak.

11 REPLIES 11
Read only

Former Member
0 Likes
1,552

Hi,

First map the table PAYR-HBKID = T012-HBKID after fetching the data map the tables

T012-BANKS = BNKA-BANKS like that join the tables after that place the common data into one internal table,

Regards,

muralii.

Read only

0 Likes
1,552

Hi murali...

LOOP AT it_payr INTO wa_payr.

MOVE-CORRESPONDING wa_payr TO wa_final1.

*Move Bank name to final work area

payr-hbkid = t012-hbkid.

select single bankl banka from bnka into (wa_final1-bankl, wa_final1-banka) where bankl = wa_payr-hbkid.

t012-banks = bnka-banks.

APPEND wa_final1 TO it_final1.

clear wa_final1.

endloop.

this is the code i have written.

but it's not working.. do i need do change the code ?

Read only

0 Likes
1,552

Hi,

Try this.



DATA: it_payr  TYPE TABLE OF payr,
      wa_payr  LIKE LINE OF it_payr,
      it_t012t TYPE TABLE OF t012t,
      wa_t012t LIKE LINE OF it_t012t.

* Suppose you have retrieved the data from table PAYR into IT_PAYR.

IF sy-subrc = 0.
  SELECT *
    FROM t012t
    INTO TABLE it_t012t
    FOR ALL ENTRIES IN it_payr
    WHERE spras EQ sy-langu
    AND   bukrs EQ it_payr-zbukr
    AND   hbkid EQ it_payr-hbkid.

  LOOP AT it_payr INTO wa_payr.
    MOVE-CORRESPONDING wa_payr TO wa_final.

    READ TABLE it_t012t INTO wa_t012t WITH KEY hbkid = wa_final-hbkid.
    IF sy-subrc = 0.
      wa_final-text1 = wa_t012t-text1.  " This contains the Bank Name.
    ENDIF.

    APPEND wa_final TO it_final.
    CLEAR: wa_payr, wa_final.
  ENDLOOP.
ENDIF.

Regards,

Danish.

Read only

0 Likes
1,552

hi ,

LOOP AT it_payr INTO wa_payr.
MOVE-CORRESPONDING wa_payr TO wa_final1.
*Move Bank name to final work area
payr-hbkid = t012-hbkid.  " From  where  you are getting  " t012-hbkid" 
select single bankl banka from bnka into (wa_final1-bankl, wa_final1-banka) where bankl = wa_payr-hbkid.
t012-banks = bnka-banks. " HEre again you are modifyin  t012-banks   what is purpose  .

APPEND wa_final1 TO it_final1.
clear wa_final1.
endloop.

Try this below code but you need to have bank key and company code to pass .

LOOP AT it_payr INTO wa_payr.
MOVE-CORRESPONDING wa_payr TO wa_final1.

select single bankl banka from bnka into (wa_final1-bankl, wa_final1-banka) where bankl = wa_payr-hbkid.
t012-banks = bnka-banks. " HEre again you are modifyin  t012-banks   what is purpose  .

select  single * from t012 
where bukrs = "company code'
and     hbkid = wa_payr-hbkid .

if sy-subrc = 0 .

select single * from  t012t 
where spras ='EN'.
bukrs = "company code'
and     hbkid = t012-hbkid .

if sy-subrc = 0 .


wa_final1-bank_name = t012t-text1 .



APPEND wa_final1 TO it_final1.
clear wa_final1.
endloop.

regards

Deepak.

Read only

0 Likes
1,552

hI Dinesh,

Thank you for reply.

but when i am executing this it throughs an error that

" when u use for all entries bukrs and it_payr-bukrs must have same type and same length"

Read only

0 Likes
1,552

HI Dinesh,

Problem solved

by using the code....

loop at it_payr into wa_payr.

move-corresponding wa_payr to wa-final.

select single text1 from t012t into wa_final-bname where hbkid = wa_payr-hbkid

AND SPRAS EQ 'EN'.

append wa_final to it_final.

clear : wa_final, wa_payr.

endloop.

Dinesh@ : Your code help me to strike this piece of code.

Thnak You so much.

Edited by: anurag.radha on Sep 21, 2011 12:16 PM

Read only

0 Likes
1,552

Thnak you Deepak.

Issue solved

Read only

Former Member
0 Likes
1,552

check the table T012T. If you want to find table name, just press F1 in text field to display the table and filed name.

rgds

vijay

Read only

Former Member
0 Likes
1,552

Hi,

House Bank Key and House Bank Name are 2 different fields.

After you select the records from table PAYR, make use of FOR ALL ENTRIES syntax and select the records from text table T012T. This table will give you all house bank names. Don't forget to filter this text table with the language key. i.e. EN for English.

Also, before you make use of FOR ALL ENTRIES, do make a sy-subrc check after fetching records from PAYR table.

Regards,

Danish.

Read only

deepak_dhamat
Active Contributor
0 Likes
1,553

Hi ,

Please check in T012 there displays Bank key and its details but it will not show text1 field , because text1 field is taken from This table T012T .

so for taking bank details name you have to pass bank key to "T012T"

and get details .

Always remeber that for master tables when it does not show description field it means there add "T" at last and will give description table .

regards

Deepak.

Read only

Former Member
0 Likes
1,552

Issue Solved.

Thank you to all.