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

Query + code

Former Member
0 Likes
1,042

Dear all,

I want to select value in one table, with the value I got from the query

EX:

3 fields on my table F1(P0001-GSBER), F2(P0001-BTRTL), F3.

I extract with query F1 and F2 and I want to display F3.

Can you pls Help me

Tell me if i'm not clear.

Thx

11 REPLIES 11
Read only

Former Member
0 Likes
1,012

You may want to try a subquery. Put your cursor on a select statement and press F1 (Help). Subquery (in 4.7) is one of the options.

rob

Read only

0 Likes
1,012

Thx Rob but i'm not using query a lot. Can you tell me step by step

sq01...

Thx

Read only

0 Likes
1,012

I use 4.6

Read only

0 Likes
1,012

The help on subquery is in the same spot in the 4.6C help.

Without knowing more detail about your requirements, it's hard to provide more information.

Rob

Read only

0 Likes
1,012

I'll trie to be clear,

I had to make a report with Area, sub-Area. I had to display an other information depending to Area and sub-Area.

This information is store in a table.

Structure of that one is Area, Sub-Area and the famous data.

Where should I go to find subquery?

Thw rob

Read only

0 Likes
1,012

What's the third table?

Rob

Read only

0 Likes
1,012

It's a table I created with 3 fields:

-Area

-Sub-Area

-Room

Read only

0 Likes
1,012

Are you talking about Adhoc query /Infoset ?

If yes Goto->SQ02.. Then click extras->Create. a pop-up will come asking additional fields/additional table etc.. Choose field and code it . Don’t forget to give the sequence of field . give sequence of field accordingly .

FYI

http://www.sappoint.com/abap/ab4query.pdf

Hope this’ll give you idea!!

<b>Pl... award the points.</b>

Good luck

Thanks

Saquib Khan

"Some are wise and some are otherwise"

Read only

0 Likes
1,012

OK - you may not need the subquery. See if this helps:


REPORT ztest NO STANDARD PAGE HEADING LINE-SIZE 255
  MESSAGE-ID 00.

TABLES pa0001, ztab.

SELECT-OPTIONS: s_gsber FOR pa0001-gsber,
                s_btrtl FOR pa0001-btrtl.

DATA: BEGIN OF itab OCCURS 0,
        gsber LIKE pa0001-gsber,
        btrtl LIKE pa0001-btrtl,
      END   OF itab.

DATA: BEGIN OF itab1 OCCURS 0,
        gsber LIKE pa0001-gsber,
        btrtl LIKE pa0001-btrtl,
        room  LIKE ztab-room,
      END   OF itab1.

SELECT gsber btrtl
  FROM pa0001
  INTO TABLE itab
  WHERE gsber IN s_gsber
  AND   btrtl IN s_btrtl.

CHECK NOT itab[] IS INITIAL.

SELECT gsber btrtl room
  FROM ztab
  INTO TABLE itab1
  FOR ALL ENTRIES IN itab
  WHERE gsber = itab-gsber
  AND   btrtl = itab-btrtl.

Rob

Read only

0 Likes
1,012

Where should I put that code?

Read only

0 Likes
1,012

That's entirely up to your requirements. Without them, I really can't say. What I've written is a complete program that uses select-options to try to mimic what you are trying to do. You will have to adapt the code to fit your situation.

Rob