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

To Fetch Data from table

Former Member
0 Likes
1,605

Hi All,

I have to fetch data from t005u for the filed bezei.

based on conditions given below

1) pass kna1-land1 and kna1-regio to t005u-land1 and t005u-bland

and then i want to pass this to an alv filed.

thanks in advance

jay

Hi All,

I have to fetch data from t005u for the filed bezei.

based on conditions given below

1) pass kna1-land1 and kna1-regio to t005u-land1 and t005u-bland

and then i want to pass this to an alv filed.

thanks in advance

jay

6 REPLIES 6
Read only

Former Member
0 Likes
1,361

Hi Jay,

why do you need to move to t005u table? get the data from kna1 and move directly to ALV output table.

Satish

Read only

Former Member
0 Likes
1,361

Hi

Write a select statement to the table T005U

if not it_kna1[] is initial.

select single bezei from t005u into v_bezei

where land1 = it_kna1-land1 and

bland = it_kna1-region and

spras = sy-langu.

if sy-subrc = 0.

it_final-bezei = v_bezei. " where it_final is the ALV output internal table

endif.

endif.

Regards

Anji

Read only

0 Likes
1,361

Hi anji,

i entered the code like this

IF NOT it_kna1[] IS INITIAL.

data: v_bezei type t005u-bezei.

SELECT SINGLE bezei FROM t005u INTO v_bezei

WHERE land1 = it_kna1-land1 AND

bland = it_kna1-regio AND

spras = sy-langu.

there is a data in table but it is not coming into variable.

pls can explain litle bit more

Read only

Former Member
0 Likes
1,361

Hi Jay,

I u already have kan1 fields..

then ..

select land1 bland bezei from table t005u into itab where land1 =kana1-..

and..

if u have any final table then

loop at t_final.

read itab.

tfinal-field = itab-buzei.

endloop.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = w_repid

is_layout = gs_layout

it_fieldcat = t_fieldcatalog[]

it_sort = w_sort

i_save = 'A'

it_events = gt_events[]

TABLES

t_outtab = t_final

EXCEPTIONS

program_error = 1

OTHERS = 2.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

Read only

Former Member
0 Likes
1,361

hi jay,

try this code.

select t005u~bezei

kna1~land1

kna1~regio

into table <itab>

from t005u join kna1

on t005u-land1 eq kna1-land1 and

t005u-bland eq kna1-regio

where <condition with selection-screen Parameters>

After fetching the data build the field catelog using <itab> and

pass it in the function module REUSE_ALV_GRID_DISPLAY.

<b><i>Reward points if useful</i></b>

Chandra

Message was edited by:

Chandrasekhar Velpula

Read only

Former Member
0 Likes
1,361

select land1 regio from kna1

into (l_land1,l_regio)

where kunnr EQ p_kunnr.

if sy-subrc EQ 0.

select bezei from t005u

into l_bezei

where SPRAS EQ sy-langu and

land1 EQ l_land1 and

bland EQ l_regio.

endif.

*reward if solved*