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

Getting data from work area data

ratana_pouy
Participant
0 Likes
1,123

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
Read only

xiaosanyu
Participant
0 Likes
1,062
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
Read only

xiaosanyu
Participant
0 Likes
1,063
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).
Read only

0 Likes
1,062

Valid only from ABAP 7.52 with HANA.

Read only

Sandra_Rossi
Active Contributor
0 Likes
1,062

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.

Read only

matt
Active Contributor
0 Likes
1,062

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

Do an INNER join with ONE select statement.