Application Development 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: 

Getting data from work area data

ratana_pouy
Participant
0 Kudos
344

Hi,

i am trying to get data from standard table based on data in work area or internal table.

   DATA: s_aufnr  TYPE aufm-aufnr,
          tmp_aufm TYPE aufm-aufnr.
    SELECT DISTINCT aufnr FROM @ct_ioopcomp AS zct_ioopcomp INTO @tmp_aufm.
      SELECT * FROM aufm INTO TABLE @DATA(zaufm) WHERE aufnr IN @ct_ioopcomp-aufnr.
    ENDSELECT.

Distintct a field from internal table "ct_ioopcomp" into "tmp_aufm" then using these data to grab from standard table "AUFM". but it doesn't work.

Please kindly advise.

Thanks,

RTN

1 ACCEPTED SOLUTION

xiaosanyu
Participant
0 Kudos
283
SELECT DISTINCT aufnr FROM @ct_ioopcomp AS zct_ioopcomp INTO TABLE @DATA(LT_AUFNR).
SELECT A~* FROM aufm AS A JOIN  @LT_AUFNR AS B ON A~AUFNR = B~AUFNR INTO TABLE @DATA(LT_AUFM).
4 REPLIES 4

xiaosanyu
Participant
0 Kudos
284
SELECT DISTINCT aufnr FROM @ct_ioopcomp AS zct_ioopcomp INTO TABLE @DATA(LT_AUFNR).
SELECT A~* FROM aufm AS A JOIN  @LT_AUFNR AS B ON A~AUFNR = B~AUFNR INTO TABLE @DATA(LT_AUFM).

0 Kudos
283

Valid only from ABAP 7.52 with HANA.

Sandra_Rossi
Active Contributor
0 Kudos
283

It's generally wrong to ask a question just saying that "it doesn't work" without giving further details. Instead you should say that you have a syntax error with given message at given line, etc.

matt
Active Contributor
0 Kudos
283

ct_ioopcomp isn't a range, so you can't use IN with it.

Do an INNER join with ONE select statement.