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 with type staement in internal table

Former Member
0 Likes
829

Hi,

I am working with type statement first time , find belo wmy code but with this code after excuting data is not coming in the table IT_BSAK, what is the problem with this code.

******************

REPORT ZMS_TDS_DETAILS.

TABLES : BSAK,BKPF,LFA1,LFB1.

TYPES :

BEGIN OF TP_BSAK,

bukrs TYPE bsak-bukrs,

lifnr TYPE bsak-lifnr,

augdt TYPE bsak-augdt,

augbl TYPE bsak-augbl,

zuonr TYPE bsak-zuonr,

gjahr TYPE bsak-gjahr,

belnr TYPE bsak-belnr,

buzei TYPE bsak-buzei,

budat TYPE bsak-budat,

bldat TYPE bsak-bldat,

cpudt TYPE bsak-cpudt,

waers TYPE bsak-waers,

xblnr TYPE bsak-xblnr,

blart TYPE bsak-blart,

monat TYPE bsak-monat,

dmbtr TYPE bsak-dmbtr,

wrbtr TYPE bsak-wrbtr,

sgtxt TYPE bsak-sgtxt,

rebzg TYPE bsak-rebzg,

qsskz TYPE bsak-qsskz,

END OF TP_BSAK.

DATA : IT_BSAK TYPE STANDARD TABLE OF TP_BSAK.

DATA : WA_BSAK TYPE TP_BSAK.

SELECTION-SCREEN : BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

SELECT-OPTIONS : S_LIFNR FOR BSAK-LIFNR,

S_BUDAT FOR BSAK-BUDAT OBLIGATORY,

S_GJAHR FOR BSAK-GJAHR NO INTERVALS NO-EXTENSION OBLIGATORY,

S_BUKRS FOR BSAK-BUKRS NO INTERVALS NO-EXTENSION OBLIGATORY.

SELECTION-SCREEN END OF BLOCK B1.

SELECT bukrs lifnr augdt augbl zuonr gjahr belnr buzei budat bldat cpudt waers xblnr blart monat dmbtr wrbtr sgtxt rebzg qsskz

from BSAK INTO TABLE IT_BSAK where LIFNR IN S_LIFNR

AND BUDAT IN S_BUDAT

AND GJAHR EQ S_GJAHR

AND BUKRS EQ S_BUKRS.

BREAK-POINT.

****************************************

regards,

zafar

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
780

SELECT bukrs lifnr augdt augbl zuonr gjahr belnr buzei budat bldat cpudt waers xblnr blart monat dmbtr wrbtr sgtxt rebzg qsskz

from BSAK INTO TABLE IT_BSAK where LIFNR IN S_LIFNR

AND BUDAT IN S_BUDAT

AND GJAHR IN S_GJAHR

AND BUKRS IN S_BUKRS.

Use IN not EQ for select options.

Ganga

6 REPLIES 6
Read only

Former Member
0 Likes
780

Hi,

I think there is no problem with your code.

Please check in the table whether the data exists for your selection criteria.

Thanks,

Sudheer

Read only

Former Member
0 Likes
780

hi,

you give the condition in the select query

>

> SELECT bukrs lifnr augdt augbl zuonr gjahr belnr buzei budat bldat cpudt waers xblnr blart monat dmbtr wrbtr sgtxt rebzg qsskz

> from BSAK INTO TABLE IT_BSAK where LIFNR IN S_LIFNR

> AND BUDAT IN S_BUDAT

> AND GJAHR EQ S_GJAHR

> AND BUKRS EQ S_BUKRS.

>

>

> zafar

give the same value in the table BSAK and see value is coming or not i think what the value you are passing is not match with the table values.

Hope this helps

Regards

Ritesh

Read only

Former Member
0 Likes
781

SELECT bukrs lifnr augdt augbl zuonr gjahr belnr buzei budat bldat cpudt waers xblnr blart monat dmbtr wrbtr sgtxt rebzg qsskz

from BSAK INTO TABLE IT_BSAK where LIFNR IN S_LIFNR

AND BUDAT IN S_BUDAT

AND GJAHR IN S_GJAHR

AND BUKRS IN S_BUKRS.

Use IN not EQ for select options.

Ganga

Read only

Former Member
0 Likes
780

Hi,

You are using select-options in where condition, so always use 'IN' to compare.

SELECT bukrs lifnr augdt augbl zuonr gjahr belnr buzei budat bldat cpudt waers xblnr blart monat dmbtr wrbtr sgtxt rebzg qsskz
from BSAK INTO TABLE IT_BSAK where LIFNR IN S_LIFNR
AND BUDAT IN S_BUDAT
AND GJAHR IN S_GJAHR
AND BUKRS IN S_BUKRS.

Thanks,

Archana

Read only

Former Member
0 Likes
780

Dear Zafar,

Your internal table declaration is correct. the only change which you need to make in select query is

SELECT bukrs lifnr augdt augbl zuonr gjahr belnr buzei budat bldat cpudt waers xblnr blart monat dmbtr wrbtr sgtxt rebzg qsskz

from BSAK INTO TABLE IT_BSAK where LIFNR IN S_LIFNR

AND BUDAT IN S_BUDAT

AND GJAHR IN S_GJAHR (Use IN operator rather than EQ)

AND BUKRS IN S_BUKRS. (Use IN operator rather than EQ)*

Hope this will solve your problem.

Read only

Former Member
0 Likes
780

Hi,

I am also very new with types, so i tried executing ur code. For me it showed an error that the internal table doesnot contain a header. i tried giving WITH HEADER LINE in the declaration

(data: it_bsak type standard table of tp_bsak with header line).

this is working for me. I tried without the where condition.

hope it works for u