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

WHY THIS IS NOT WORKING

Former Member
0 Likes
1,201

CAN ANY ONE TELL ME THIS SIMPLE SELECT STATEMENT NOT WORKING PLEASE

DATA IS NOT COMING

TYPES: BEGIN OF TY_ITAB,

F(3) TYPE C,

F1(8) TYPE N,

F2(8) TYPE N,

F3(10) TYPE C,

F4(2) TYPE C,

F5(5) TYPE C,

F6 TYPE zvbill-RATEMULTIPLE,

F7 TYPE zvbill-RATEDIVISOR,

F8(22) TYPE C,

F9(30) TYPE C,

F10 TYPE zvbill-BILLAMOUNT,

F11(30) TYPE C,

F12 TYPE D,

F13(5) TYPE C,

F14(15) TYPE C,

F15(4) TYPE C,

F16(4) TYPE C,

F17 TYPE C,

F18 TYPE D,

END OF TY_ITAB.

DATA: IT_ITAB1 TYPE TY_ITAB OCCURS 1 WITH HEADER LINE.

START-OF-SELECTION.

select SINGLE KUNNR from KNA1 into it_itab1 where KUNNR = '0000020001'.

write:/ it_itab1-f3.

-


in kna1 table 20001 data is there

Edited by: SRI ABAPER on Jun 12, 2008 5:00 PM

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,151

declare your internal table as

TYPES: BEGIN OF TY_ITAB,

KUNNR like KNA1-KUNNR,

F(3) TYPE C,

F1(8) TYPE N,

F2(8) TYPE N,

F3(10) TYPE C,

F4(2) TYPE C,

F5(5) TYPE C,

F6 TYPE zvbill-RATEMULTIPLE,

F7 TYPE zvbill-RATEDIVISOR,

F8(22) TYPE C,

F9(30) TYPE C,

F10 TYPE zvbill-BILLAMOUNT,

F11(30) TYPE C,

F12 TYPE D,

F13(5) TYPE C,

F14(15) TYPE C,

F15(4) TYPE C,

F16(4) TYPE C,

F17 TYPE C,

F18 TYPE D,

END OF TY_ITAB.

CAN ANY ONE TELL ME THIS SIMPLE SELECT STATEMENT NOT WORKING PLEASE

DATA IS NOT COMING

TYPES: BEGIN OF TY_ITAB,

F(3) TYPE C,

F1(8) TYPE N,

F2(8) TYPE N,

F3(10) TYPE C,

F4(2) TYPE C,

F5(5) TYPE C,

F6 TYPE zvbill-RATEMULTIPLE,

F7 TYPE zvbill-RATEDIVISOR,

F8(22) TYPE C,

F9(30) TYPE C,

F10 TYPE zvbill-BILLAMOUNT,

F11(30) TYPE C,

F12 TYPE D,

F13(5) TYPE C,

F14(15) TYPE C,

F15(4) TYPE C,

F16(4) TYPE C,

F17 TYPE C,

F18 TYPE D,

END OF TY_ITAB.

DATA: IT_ITAB1 TYPE TY_ITAB OCCURS 1 WITH HEADER LINE.

START-OF-SELECTION.

select SINGLE KUNNR from KNA1 into it_itab1 where KUNNR = '0000020001'.

write:/ it_itab1-f3.

-


in kna1 table 20001 data is there

Edited by: SRI ABAPER on Jun 12, 2008 5:00 PM

8 REPLIES 8
Read only

Former Member
0 Likes
1,152

declare your internal table as

TYPES: BEGIN OF TY_ITAB,

KUNNR like KNA1-KUNNR,

F(3) TYPE C,

F1(8) TYPE N,

F2(8) TYPE N,

F3(10) TYPE C,

F4(2) TYPE C,

F5(5) TYPE C,

F6 TYPE zvbill-RATEMULTIPLE,

F7 TYPE zvbill-RATEDIVISOR,

F8(22) TYPE C,

F9(30) TYPE C,

F10 TYPE zvbill-BILLAMOUNT,

F11(30) TYPE C,

F12 TYPE D,

F13(5) TYPE C,

F14(15) TYPE C,

F15(4) TYPE C,

F16(4) TYPE C,

F17 TYPE C,

F18 TYPE D,

END OF TY_ITAB.

Read only

valter_oliveira
Active Contributor
0 Likes
1,151

Hello.

Insert kunnr in your type definition, and use a work area:


DATA: ti_itab TYPE STABDARD TABLE OF ty_itab,
      wa_itab TYPE ty_itab.

START-OF-SELECTION.

SELECT SINGLE kunnr FROM kna1
  INTO wa_itab-kunnr 
 WHERE kunnr = '0000020001'.

Regards.

Valter Oliveira.

Read only

Former Member
0 Likes
1,151

Because your select is taking only one field, (KUNNR) and as you have it written, it will try to put it in your first field which is defined as Character for a length of 3. KUNNR is 10

Read only

Former Member
0 Likes
1,151

haha that made me laugh

First you are selecting a single field, and using select single, the best way to do that is just use a variable of the same type kna1-kunnr.

I don't know what that select might do, it probably goes to the fields f and f1 of the header line because kunnr is large.

Then, you are trying to write f3, that is obviously empty

Read only

0 Likes
1,151

hi experts

i want to fill the internal table data to one ztable

z table structure is same like the internal table

thats why i declared like that

Read only

0 Likes
1,151

Are you new into abap?

I have seen your questions and sorry but you have it all wrong. And that style of programing you use can be really dangerous.

If you are working in a real requirement my advice is that you need to find real life help

Read only

0 Likes
1,151

no i am just trying

i have deleted some lines and only important things i have mentioned

Read only

Former Member
0 Likes
1,151

Hi,

TYPES: BEGIN OF TY_ITAB,
  KUNNR LIKE KNA1-KUNNR,
  NAME1 LIKE KNA1-NAME1,
END OF TY_ITAB.
DATA:
  IT_ITAB1 TYPE TY_ITAB OCCURS 0 WITH HEADER LINE.


START-OF-SELECTION.
  SELECT SINGLE *
    FROM KNA1
    INTO CORRESPONDING FIELDS OF IT_ITAB1
   WHERE KUNNR = '0000020001'.

  WRITE:/ IT_ITAB1.

Regards

Adil