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: 

Empty Internal Table

Former Member
0 Kudos

append lines of itab to ntab.

sort ntab by belnr.

Hi all,

can u plz tell me that in foll. code why ntab is showing all values but not gtab ..?

gtab is showing blank i.e. no records in it..

plzzz

thankx in advance....

delete adjacent duplicates from ntab comparing belnr.

CALL FUNCTION 'HR_IT_SHOW_ANY_TABLE_ON_ALV'

TABLES

table = ntab.

select buzei bschl belnr gsber hkont zuonr kostl dmbtr sgtxt

into corresponding fields of gtab

CALL FUNCTION 'HR_IT_SHOW_ANY_TABLE_ON_ALV'

TABLES

table = gtab.

from bseg

where belnr = ntab-belnr.

append gtab.

endselect.

1 ACCEPTED SOLUTION

0 Kudos

Use for all entries statement

Regards

Farzan

Edited by: Farzan Mohamed on Sep 17, 2008 6:47 AM

9 REPLIES 9

0 Kudos

Use for all entries statement

Regards

Farzan

Edited by: Farzan Mohamed on Sep 17, 2008 6:47 AM

0 Kudos

no its still showing blank table..

0 Kudos

Is there any values in BSEG for the BELNR s in ntab... Please check going to se16

Regards

Farzan

0 Kudos

ntab is showing all the required data but gtab is still empty...

0 Kudos

Hi Nilesh,

Sorry i missed the TABLE keyword in my query, my query will work if you use INTO CORRESPONDING FIELDS OF TABLE gtab.

Regards

Karthik D

0 Kudos

That is what I mentioned in the first reply

Regards

Farzan

Former Member
0 Kudos

Hi Nilesh,

Rewrite the Select query as below;

SELECT buzei bschl belnr gsber hkont zuonr kostl dmbtr sgtxt
INTO CORRESPONDING FIELDS OF gtab FROM bseg
FOR ALL ENTRIES IN ntab 
WHERE belnr = ntab-belnr.

Now this will fetch data from the database provided that ntab contains some records.

Regards

Karthik D

uwe_schieferstein
Active Contributor
0 Kudos

Hello Nilesh

I do not really understand your coding but perhaps you wanted to do the following:

IF ( ntab[] IS INITIAL ).
ELSE.
  SELECT buzei bschl belnr gsber hkont zuonr kostl dmbtr sgtxt
    INTO CORRESPONDING FIELDS OF TABLE gtab                    " << TABLE !!!
    FROM bseg
    FOR ALL ENTRIES IN ntab 
    WHERE belnr = ntab-belnr.
ENDIF.

I assume you have defined you itab's using header lines. Thus, this is another nice example how header lines spoil any ABAP coding.

If my coding solution is correct then the syntax check would have resulted in an error. GTAB would have been interpreted as work area (i.e. the header line) and therefore the syntax should be SELECT ... ENDSELECT.

Regards

Uwe

Former Member
0 Kudos

ok