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

select statement

Former Member
0 Likes
1,263

Hi forum,

Pls correct the following statement.

select zwels bukrs from lfb1 into corresponding fields of table itab2 for all entries in itab1

where lifnr in s_lifnr and bukrs in s_bukrs and zwels in s_zwels .

thanks & regards,

mallika

1 ACCEPTED SOLUTION
Read only

former_member632991
Active Contributor
0 Likes
1,203

HI

This statement does not corres pond to for all entries

because in where condition u have not taken from table ITAB1.

Regards,

Sonika

10 REPLIES 10
Read only

former_member632991
Active Contributor
0 Likes
1,204

HI

This statement does not corres pond to for all entries

because in where condition u have not taken from table ITAB1.

Regards,

Sonika

Read only

0 Likes
1,203

REPORT ZVEN_LISTING_TRAIL no standard page heading line-count 65(3) line-size 300.

TYPE-POOLS: SLIS.

DATA: it_fldcat TYPE slis_t_fieldcat_alv. "Intenal table to maintain fieldcatalog

DATA: wa_fldcat TYPE slis_fieldcat_alv. "Workarea to maintain fieldcatalog

DATA : it_sort TYPE slis_t_sortinfo_alv. "Internal table for Sorting

DATA : wa_sort TYPE slis_sortinfo_alv. "Workarea to hold sort information

DATA: it_events TYPE slis_t_event,

wa_events TYPE slis_alv_event.

TABLES : LFA1, PAYR , LFB1, BNKA, LFBK.

DATA : BEGIN OF ITAB1 OCCURS 0,

NAME1 LIKE LFA1-NAME1,

LIFNR LIKE LFA1-LIFNR,

ADRNR LIKE LFA1-ADRNR,

TELF1 LIKE LFA1-TELF1,

ORT01 LIKE LFA1-ORT01,

LAND1 LIKE LFA1-LAND1,

ERDAT LIKE LFA1-ERDAT,

ERNAM LIKE LFA1-ERNAM,

KTOKK LIKE LFA1-KTOKK,

END OF ITAB1.

DATA: BEGIN OF ITAB2 OCCURS 0,

ZWELS LIKE LFB1-ZWELS,

BUKRS LIKE LFB1-BUKRS,

END OF ITAB2.

DATA: BEGIN OF ITAB3 OCCURS 0,

BANKA LIKE BNKA-BANKA,

END OF ITAB3.

DATA : BEGIN OF ITAB4 OCCURS 0,

RZAWE LIKE PAYR-RZAWE,

ZBUKR LIKE PAYR-ZBUKR,

END OF ITAB4.

DATA : BEGIN OF ITAB5 OCCURS 0,

BANKN LIKE LFBK-BANKN,

BANKL LIKE LFBK-BANKL,

END OF ITAB5.

DATA : BEGIN OF ITAB6 OCCURS 0,

NAME1 LIKE itab1-NAME1,

LIFNR LIKE itab1-LIFNR,

ADRNR LIKE itab1-ADRNR,

ZWELS LIKE itab2-ZWELS,

BUKRS LIKE itab2-BUKRS,

TELF1 LIKE itab1-TELF1,

BANKA LIKE itab3-BANKA,

RZAWE LIKE itab4-RZAWE,

ZBUKR LIKE itab4-ZBUKR,

ORT01 LIKE itab1-ORT01,

LAND1 LIKE itab1-LAND1,

ERDAT LIKE itab1-ERDAT,

ERNAM LIKE itab1-ERNAM,

KTOKK LIKE itab1-KTOKK,

BANKN LIKE itab5-BANKN,

BANKL LIKE itab5-BANKL,

END OF ITAB6.

select-options:

s_lifnr for lfa1-lifnr,

s_bukrs for lfb1-bukrs,

s_LAND1 for LFA1-LAND1,

S_ZWELS for LFB1-ZWELS.

select NAME1 LIFNR ADRNR TELF1 ORT01 LAND1 ERDAT ERNAM KTOKK from LFA1 into corresponding fields of table itab1 where

lifnr in s_lifnr and land1 in s_land1.

if itab1 is initial.

select zwels bukrs from lfb1 into corresponding fields of itab2 for all entries in itab1 where lifnr in s_lifnr and bukrs in s_bukrs, land1 in s_land1 and zwels in s_zwels.

endif.

Read only

0 Likes
1,203

Hi,

This is my program...pls correct the select statement...

Thanks,

Mallika

Read only

0 Likes
1,203

if not itab1[] is initial.

select zwels bukrs from lfb1

into corresponding fields of itab2

for all entries in itab1

where lifnr = itab1-lifnr

and bukrs in s_bukrs

and land1 = itab1-land1

and zwels in s_zwels.

endif.

Read only

0 Likes
1,203

Hi,

just do this correction,

select zwels bukrs from lfb1 into corresponding fields of itab2 for all entries in itab1 where lifnr = itab1-lifnr and bukrs in s_bukrs, land1 in s_land1 and zwels in s_zwels.

And plz dont use into corresponding fields of table.

As it takes comparitively long time to execute.

instead use,

select zwels bukrs from lfb1 into table itab2 for all entries in itab1 where lifnr = itab1-lifnr and bukrs in s_bukrs, land1 = itab1-land1 and zwels in s_zwels.

Edited by: jagannathan krishnan on Dec 31, 2007 8:58 AM

Edited by: jagannathan krishnan on Dec 31, 2007 10:35 AM

Edited by: jagannathan krishnan on Dec 31, 2007 10:37 AM

Read only

former_member386202
Active Contributor
0 Likes
1,203

Hi,

Do like this

select zwels bukrs from lfb1 into corresponding fields of table itab2

for all entries in itab1

where field from lfb1 EQ field from itab2

and lifnr in s_lifnr

and bukrs in s_bukrs

and zwels in s_zwels .

Regards,

Prashant

Read only

Former Member
0 Likes
1,203

Hi Malika

I am correcting the code what u have written:-

select zwels bukrs from lfb1

into corresponding fields of itab2

for all entries in itab1

where lifnr = itab1-lifnr

and bukrs in s_bukrs

and land1 = itab1-land1

and zwels in s_zwels.

Error:- You cannt use where lifnr in, this you can use with when you have declared as a select-options.

Reward pts if help.

Regards

Deepanker

Read only

Former Member
0 Likes
1,203

Hi,

If your problem has not been solved yet then post the declaration of itab1 and itab2.

Regards

debjani

Read only

Former Member
0 Likes
1,203

Hi,

As Is:

select zwels bukrs from lfb1 into corresponding fields of table itab2 for all entries in itab1

where lifnr in s_lifnr and bukrs in s_bukrs and zwels in s_zwels .

To Be:

if not ITAB1[] is initial.

select zwels

bukrs

from lfb1 into corresponding fields of table itab2

for all entries in itab1

where <itab2-fieldname> = <itab1-fieldname>

and lifnr in s_lifnr

and bukrs in s_bukrs

and zwels in s_zwels .

endif.

Note:

ITAB1 field name should be compared with the ITAB2 field name.

- Selvapandian Arunachalam

Read only

Former Member
0 Likes
1,203

select zwels

bukrs

from lfb1

into corresponding fields of table itab2

for all entries in itab1

where lifnr = itab1-lifnr

and lifnr in s_lifnr

and bukrs in s_bukrs

and zwels in s_zwels .