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

how to fetch value

Former Member
0 Likes
1,051

Hi,

I need a small help in fetching data from a table here i'm giving u code plz refer that and give me any suggestion

DATA: BEGIN OF IT_PAYR OCCURS 0,
      PUBHKT LIKE PAYR-UBHKT,
      PHBKID LIKE PAYR-HBKID,
      ZBUKR LIKE PAYR-ZBUKR,
    END OF IT_PAYR.

DATA: BEGIN OF IT_T012T OCCURS 0,
      OHBKID LIKE T012T-HBKID,
      OBUKRS LIKE T012T-BUKRS,
      TEXT1  LIKE T012T-TEXT1,
      END OF IT_T012T.
* added for output display of bank number, outgoing number, date

SELECT HBKID ubhkt zbukr FROM PAYR INTO CORRESPONDING FIELDS OF TABLE
IT_PAYR
       WHERE UBHKT = P_OHKONT
       AND   ZBUKR = P_BUKRS.

LOOP AT IT_payr.

*IF IT_PAYR-zbukr = IT_T012T-obukrs.

SELECT TEXT1
       FROM T012T INTO CORRESPONDING FIELDS OF TABLE IT_T012T
       WHERE HBKID = IT_PAYR-PUBHKT.
*ENDIF.


ENDLOOP.

Now my problem is

get the value of bseg-hkont which i had already fetched previously and put that value in payr-ubhkt now i have to fetch the related payr-hbkid data and put that value in t012t-hbkid now can u give me any solution how fetch these data

Regards

Pavan

Message was edited by:

pavan praveen

Hi,

I need a small help in fetching data from a table here i'm giving u code plz refer that and give me any suggestion

DATA: BEGIN OF IT_PAYR OCCURS 0,
      PUBHKT LIKE PAYR-UBHKT,
      PHBKID LIKE PAYR-HBKID,
      ZBUKR LIKE PAYR-ZBUKR,
    END OF IT_PAYR.

DATA: BEGIN OF IT_T012T OCCURS 0,
      OHBKID LIKE T012T-HBKID,
      OBUKRS LIKE T012T-BUKRS,
      TEXT1  LIKE T012T-TEXT1,
      END OF IT_T012T.
* added for output display of bank number, outgoing number, date

SELECT HBKID ubhkt zbukr FROM PAYR INTO CORRESPONDING FIELDS OF TABLE
IT_PAYR
       WHERE UBHKT = P_OHKONT
       AND   ZBUKR = P_BUKRS.

LOOP AT IT_payr.

*IF IT_PAYR-zbukr = IT_T012T-obukrs.

SELECT TEXT1
       FROM T012T INTO CORRESPONDING FIELDS OF TABLE IT_T012T
       WHERE HBKID = IT_PAYR-PUBHKT.
*ENDIF.


ENDLOOP.

Now my problem is

get the value of bseg-hkont which i had already fetched previously and put that value in payr-ubhkt now i have to fetch the related payr-hbkid data and put that value in t012t-hbkid now can u give me any solution how fetch these data

Regards

Pavan

Message was edited by:

pavan praveen

5 REPLIES 5
Read only

Former Member
0 Likes
858

Hi,


DATA: BEGIN OF IT_PAYR OCCURS 0,
      PUBHKT LIKE PAYR-UBHKT,
      PHBKID LIKE PAYR-HBKID,
      ZBUKR LIKE PAYR-ZBUKR,
    END OF IT_PAYR.
 
DATA: BEGIN OF IT_T012T OCCURS 0,
      OHBKID LIKE T012T-HBKID,
      OBUKRS LIKE T012T-BUKRS,
      TEXT1  LIKE T012T-TEXT1,
      END OF IT_T012T.
* added for output display of bank number, outgoing number, date
 
SELECT HBKID ubhkt zbukr FROM PAYR INTO CORRESPONDING FIELDS OF TABLE IT_PAYR
       WHERE UBHKT = P_OHKONT
       AND   ZBUKR = P_BUKRS.
 
* LOOP AT IT_payr.
 
*IF IT_PAYR-zbukr = IT_T012T-obukrs.
 
SELECT TEXT1
       FROM T012T INTO CORRESPONDING FIELDS OF TABLE IT_T012T
       FOR ALL ENTRIES IN IT_payr
       WHERE HBKID = IT_PAYR-PUBHKT.
*ENDIF.
 
 
* ENDLOOP.

Regards

Sudheer

Read only

0 Likes
858

Hi sudheer

Thanks for ur reply.

Actually the data of hbkid is not coming in it_payr-phbkid so from where it can select the data from next select statement ??? so i want whether is there any mistake in my 1st select statement if NO then why it was not fetching data

Regards

Pavan

Read only

Former Member
0 Likes
858

Hi,

instead of these last lines ,

LOOP AT IT_payr.
 
*IF IT_PAYR-zbukr = IT_T012T-obukrs.
 
SELECT TEXT1
       FROM T012T INTO CORRESPONDING FIELDS OF TABLE IT_T012T
       WHERE HBKID = IT_PAYR-PUBHKT.
*ENDIF.
 
 
ENDLOOP.

write following command


SELECT TEXT1
       FROM T012T INTO CORRESPONDING FIELDS OF TABLE IT_T012T
FOR ALL ENTRIES IN TABLE IT_PAYR
       WHERE HBKID = IT_PAYR-PUBHKT.

it will work......

Message was edited by:

Jogdand M B

Read only

Former Member
0 Likes
858

Hi

I don't suggest to use the BSEG Table to fetch the data

Better to take the /fetch the data from BSIK and BSAK(vendor) or BSIS and BSAS(GL Account) in this case better use BSIS and BSAS table

Link between PAYR and these accounting tables are:

PAYR table fields BSEG(or BSIS or BSAS Fields)

UBHKT HKONT

VBLNR BELNR

GJAHR GJAHR

use the link of above fields and fetch data

and accordingly for PAYR-HBKID fields fetch the descriptions from T012T

and use.

Reward points if useful

Regards

Anji

Read only

0 Likes
858

Dear all,

Thanks for ur precious reply i had got the solution by my own i had replaced "into table of " by "into corresponding fields of "

here is the same code which i had executed


** added for output display of bank number, outgoing number, date

SELECT HBKID ubhkt zbukr FROM PAYR INTO TABLE
IT_PAYR
       WHERE UBHKT = P_OHKONT
       AND   ZBUKR = P_BUKRS.

LOOP AT IT_payr.

*IF IT_PAYR-zbukr = IT_T012T-obukrs.

SELECT TEXT1
       FROM T012T INTO TABLE IT_T012T
       WHERE HBKID = IT_PAYR-PUBHKT.
*ENDIF.


ENDLOOP.

anyway thanks for ur help i'm giving all of u very helpfull answer

Regards

Pavan