cancel
Showing results for 
Search instead for 
Did you mean: 

Why data is not fetching?

Former Member
0 Kudos

Hi Guys,

Can you please look into the below code and tell me why data is not fetching from ANLA table even though there are 20 records?

This is the program

TABLES: anla.

TYPES: BEGIN OF ty_anla,
        bukrs TYPE bukrs,
        anln1 TYPE anln1,
        anln2 TYPE anln2,
        anlkl TYPE anlkl,
        ord43 TYPE ord43,
        ord44 TYPE ord44,
        anlue TYPE anlue,
       END OF ty_anla.

 DATA: git_anla TYPE TABLE OF ty_anla.

SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME.
SELECT-OPTIONS: s_anln1 FOR anla-anln1,
                s_anln2 FOR anla-anln2.
PARAMETERS:     p_anlkl TYPE anla-anlkl,
                p_bukrs TYPE anla-bukrs OBLIGATORY,
                p_ord43 TYPE anla-ord43 ,
                p_ord44 TYPE anla-ord44 ,
                p_anlue TYPE anla-anlue .
SELECTION-SCREEN: END OF BLOCK b1.

  SELECT bukrs anln1 anln2 anlkl ord43 ord44 anlue
   FROM anla INTO TABLE  git_anla
    WHERE bukrs = p_bukrs
      AND anln1 IN s_anln1
      AND anln2 IN s_anln2
      AND anlkl = p_anlkl
      AND ord43 = p_ord43
      AND ord44 = p_ord44
      AND anlue = p_anlue.

Thanks in advance,

Satish

Accepted Solutions (1)

Accepted Solutions (1)

JozsefSzikszai
Active Contributor
0 Kudos

hi Satish,

what do you enter on the selection screen? Is that combination really exists in table ANLA?

ec

Former Member
0 Kudos

Hi Eric,

I am just passing Company code value

I went to the table and when i see the contents with that company code, 20 records are there.

Thanks,

Satish

JozsefSzikszai
Active Contributor
0 Kudos

yes, that is the problem: if there are paramters on the selection screen and you don't give any value, the system wants to select the fields from ANLA without any value as well. For example you don't give any value for p_ord43 and the system tries to select the lines from anla where ord43 is empty.

Define these parameters as select option (and change the WHERE clause accordingly) or make them mandatory.

Former Member
0 Kudos

Thanks Eric.... I have changed all the parameters to Select-options except company code it is working now.

Thanks,

Satish

Former Member
0 Kudos

codeTABLES: anla.

TYPES: BEGIN OF ty_anla,

bukrs TYPE bukrs,

anln1 TYPE anln1,

anln2 TYPE anln2,

anlkl TYPE anlkl,

ord43 TYPE ord43,

ord44 TYPE ord44,

anlue TYPE anlue,

END OF ty_anla.

DATA: git_anla TYPE TABLE OF ty_anla.

SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME.

SELECT-OPTIONS: s_anln1 FOR anla-anln1,

s_anln2 FOR anla-anln2.

PARAMETERS: p_anlkl TYPE anla-anlkl,

p_bukrs TYPE anla-bukrs OBLIGATORY,

p_ord43 TYPE anla-ord43 ,

p_ord44 TYPE anla-ord44 ,

p_anlue TYPE anla-anlue .

SELECTION-SCREEN: END OF BLOCK b1.

SELECT bukrs anln1 anln2 anlkl ord43 ord44 anlue

FROM anla INTO TABLE git_anla

WHERE bukrs = p_bukrs

AND anln1 IN s_anln1

AND anln2 IN s_anln2

AND anlkl = p_anlkl

AND ord43 = p_ord43

AND ord44 = p_ord44

AND anlue = p_anlue.[/code]

Satish can you please say what was the change in the above code that worked. Thanks

Answers (4)

Answers (4)

Former Member
0 Kudos

Cause the field ANLKL (ASSET CLASS) Allways has value into ANLA

if you left the P_ANLKL blank you will never get records.

changed the P_ANLKL as select-option or maked obligatory

andreas_mann3
Active Contributor
0 Kudos

better use sel-options for anla-anlue

A.

Former Member
0 Kudos

No use even after changing it as select-option...

No Use after keeping start-of-selection.

Thanks,

Satish

Former Member
0 Kudos

use start-of-selection before select stmt.(just a try)

Sandeep_Kumar
Advisor
Advisor
0 Kudos

Hi satish,

I tried this and works fien for me.

But one thing , pass company code with 4 chars e.g for 1 -->0001

Rgds,

Sandeep

Former Member
0 Kudos

Thanks sundeep,

I am passing Company Code, but still i am not getting data into internal table.

Thanks,

Satish