cancel
Showing results for 
Search instead for 
Did you mean: 

table selections

Former Member
0 Kudos

Hi experts,

I have two tables QALS & QAVE with PRUEFLOS as common field.In my selection screen I have one parameter for QALS-ART & one select-option for QAVE-VDATUM.

What is the better way to write select statement.Do i need to write join?User can select any one the options...

PARAMETERS:P_ART LIKE QMEL-ART.

SELECT-OPTIONS:S_VDATUM FOR QAVE-VDATUM.

Reward guaranteed

cheers

kaki

Accepted Solutions (0)

Answers (6)

Answers (6)

former_member181962
Active Contributor
0 Kudos

Hi Kaki,

You cannot use the View because it doesn't have the field VDATUM.

Better to use the inner join option.

Regards,

Ravi

Former Member
0 Kudos

Hi ,

My suggestion is write a join on two tables

like but be careful when user doesn't enter

values in parameter P_ART .

For example

Better to build ranges for this parameter option

p_art.

Regards

Amole

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

It doesn't appear that VDATUM is part of the view. So you will not be able to use it. If it was there in the view, you could do something like this.



report zrich_0003.

tables: qave.
data: iQALSVE_V1 type table of QALSVE_V1  with header line.


PARAMETERS:      P_ART LIKE Qals-ART.
SELECT-OPTIONS:S_VDATUM FOR qave-VDATUM.


select * into corresponding fields of table iQALSVE_V1
          from QALSVE_V1
                  where art = p_art
                    and vdatum in s_vdatum.

I would suggest doing a INNER JOIN.

REgards,

Rich Heilman

Former Member
0 Kudos

Hi KAki,

I am not sure what is your question Inspection lot no : PRUEFLOS in in bothe tabbles QALS and QAVE.

Inspection type QAVE-ART in generally mainteined in table TQ30 and in table QAVE there is a check table is maintained.

your selctions will work.

If possible use Function module : 'READ_NOTIFICATION'

This will fetch you comple data for inspection lots.

CALL FUNCTION 'READ_NOTIFICATION'

EXPORTING

QMNUM = WA_VIQMEL-QMNUM

I_VIQMEL = WA_VIQMEL

IV_AKTYP = 'A'

TABLES

IVIQMFE = IWQMFE

IVIQMMA = IWQMMA

IVIQMSM = IWQMSM

IVIQMUR = IWQMUR

TRIWO020TAB = G_RIWO020TAB

EXCEPTIONS

INVALID_NUMBER = 1

OTHERS = 2.

Lanka

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

If the fields that you need are present, I would suggest using the view QALSVE_V1. If not then a inner join will do just fine.

Regards,

Rich Heilman

Former Member
0 Kudos

Hi Rich,

Could you pls tell me how to use view?

Kaki

Former Member
0 Kudos

Hi again,

1. simple.

2. select * from QALSVE_V1

where .... conditions

3. This view QALSVE_V1

contains ur two tables

joined with common fields.

regards,

amit m.

Former Member
0 Kudos

Hi Kaki,

1. User can select any one the options...

One option is that

we can use IF to check what is entered

and accordingly write TWO Different SQls.

2. But my personal opinion is ,

it is better to write Sql using JOIN

for the two tables,

so that in future,

if the requirement is that

the use CAN ENTER IN BOTH Fields,

then we don't have to worry about it !

regards,

amit m.

Former Member
0 Kudos

Hi Kaki,

You can write a join.

select <fields>

from QALS JOIN QAVE

ON QALSPRUEFLOS = QAVEPRUEFLOS

INTO TABLE ITAB

WHERE QALS~ART = P_ART AND

QAVE~VDATUM IN S_VDATUM.