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

internal tables

Former Member
0 Likes
786

tables: sbook,spfli.

data: begin of itab occurs 0 ,

carrid like sbook-carrid,

connid like sbook-connid,

fldate like sbook-carrid,

bookid like sbook-bookid,

carrid1 like spfli-carrid,

connid1 like spfli-connid,

cityfrom like spfli-cityfrom,

countryfr like spfli-countryfr,

distance like spfli-distance,

end of itab.

parameter: a like sbook-carrid.

select connid fldate bookid from sbook into table itab where

carrid = 'a'.

loop at itab.

write: / itab-connid.

endloop.

on executing i am getting error. please help me.

7 REPLIES 7
Read only

Former Member
0 Likes
766

No Quotes for variables

select connid fldate bookid from sbook into table itab where

carrid = a.

Read only

0 Likes
766

no it didnt worked its showing error in select query

Read only

Former Member
0 Likes
766

Hi,

Change the sequence of the fields mentioned in the select statement, it should match the internal table declaration..Or change the internal table declaration according to the field selection.

select carrid connid fldate bookid from sbook

Thanks

Naren

Read only

Former Member
0 Likes
766

Hi,

This is probably of a structure mismatch. Make use of 'Corresponding' fields --> into corresponding fields of table itab and then check it out.

Thanks.

Read only

Former Member
0 Likes
766

Hi,

you need to add : Corresponding Fields Of

select connid fldate bookid from sbook into corresponding fields of table itab where

carrid = 'a'.

Regards

Sandeep Reddy

Read only

Former Member
0 Likes
766

here you go


TABLES: sbook,spfli.
DATA:
  BEGIN OF itab OCCURS 0 ,
    carrid LIKE sbook-carrid,
    connid LIKE sbook-connid,
    fldate LIKE sbook-fldate,  " This changed
    bookid LIKE sbook-bookid,
    carrid1 LIKE spfli-carrid,
    connid1 LIKE spfli-connid,
    cityfrom LIKE spfli-cityfrom,
    countryfr LIKE spfli-countryfr,
    distance LIKE spfli-distance,
  END OF itab.

PARAMETER: a LIKE sbook-carrid.

SELECT connid fldate bookid    " Select was rewritten because you were selecting fields that were not in position 1 and 2 of the itab
  INTO CORRESPONDING FIELDS OF TABLE itab
  FROM sbook
  WHERE carrid = a.

LOOP AT itab.
  WRITE: / itab-connid.
ENDLOOP.

Read only

Former Member
0 Likes
766

HI

u r writing mistake in select statement

just check this once

u need to check the condition based on the parameters value not the feild value .

tables : sbook.

data : begin of it_itab occurs 0,

carrid like sbook-carrid,

connid like sbook-connid,

fldate like sbook-fldate,

bookid like sbook-bookid,

end of it_itab.

parameters : p_carrid like sbook-carrid.

select carrid connid fldate bookid from sbook into table it_itab where carrid = p_carrid.

loop at it_itab.

write 😕 it_itab-carrid,

it_itab-connid.

endloop.