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

Error in reading -help me pls

Former Member
0 Likes
899

Hi Experts

One of my ztable, am trying to read data using 'N' transaction,

the value exists but its not reading.

but when i add '*' (star) with the end of the data only, it reads correctly.

Whats the reason for not reading the data when i give exactly.

Wheather data type could be the problem.

SELECT a~ZTNAM

a~CTLNO

a~VBELN

b~CTLNO

b~PRDAT

INTO CORRESPONDING FIELDS OF TABLE ITAB

FROM ZLIST as a

INNER JOIN ZCTLK as b

ON aCTLNO = bCTLNO

WHERE a~ZTNAM = ZTEST.

it returns sy-subrc = 4, even data available in this condition.

Thanks in advance.

Regards

Rajaram

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
878

Hi

May be there is no same data in both the table or your “where” condition is wrong. Chick that.

For inner join u should have same data in both table,

Hi Experts

One of my ztable, am trying to read data using 'N' transaction,

the value exists but its not reading.

but when i add '*' (star) with the end of the data only, it reads correctly.

Whats the reason for not reading the data when i give exactly.

Wheather data type could be the problem.

SELECT a~ZTNAM

a~CTLNO

a~VBELN

b~CTLNO

b~PRDAT

INTO CORRESPONDING FIELDS OF TABLE ITAB

FROM ZLIST as a

INNER JOIN ZCTLK as b

ON aCTLNO = bCTLNO

WHERE a~ZTNAM = ZTEST.

it returns sy-subrc = 4, even data available in this condition.

Thanks in advance.

Regards

Rajaram

7 REPLIES 7
Read only

Former Member
0 Likes
879

Hi

May be there is no same data in both the table or your “where” condition is wrong. Chick that.

For inner join u should have same data in both table,

Read only

0 Likes
878

data available in both table yar, condition also right.

what could be the reason.

Read only

0 Likes
878

post u r full code, let my try.

Regards

Prajwal K.

Read only

0 Likes
878

Please find my full code and do needful.

REPORT ZTEST_REPORT.

TABLES : ZLIST,ZCTLK,vbrk.

TYPE-POOLS : SLIS.

DATA : BEGIN OF ITAB OCCURS 0,

PRDAT LIKE ZCTLK-PRDAT,

CTLNO LIKE ZCTLK-CTLNO,

CTLKNO LIKE ZLIST-CTLNO,

ZTNAM LIKE ZLIST-ZTNAM,

VBELN LIKE ZLIST-VBELN,

END OF ITAB.

DATA : i_repid TYPE sy-repid,

gs_layout TYPE slis_layout_alv,

gt_fcat TYPE slis_t_fieldcat_alv,

gt_user_command TYPE slis_formname VALUE 'USER_COMMAND',

gs_variant LIKE disvariant,

ls_fcat LIKE LINE OF gt_fcat.

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

SELECT-OPTIONS : ZDATE FOR vbrk-FKDAT,

ZTEST FOR ZLIST-ZTNAM.

SELECTION-SCREEN END OF BLOCK B1.

SELECT a~ZTNAM

a~CTLNO

a~VBELN

b~CTLNO

b~PRDAT

INTO CORRESPONDING FIELDS OF TABLE ITAB

FROM ZLIST as a

INNER JOIN ZCTLK as b

ON aCTLNO = bCTLNO

WHERE a~ZTNAM = ZTEST.

PERFORM fieldcat.

i_repid = sy-repid.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = i_repid

  • i_callback_user_command = 'USER_COMMAND'

is_layout = gs_layout

it_fieldcat = gt_fcat

i_save = 'A'

  • is_variant = gs_variant

TABLES

t_outtab = itab

EXCEPTIONS

program_error = 1

OTHERS = 2.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

FORM fieldcat .

MOVE sy-repid TO i_repid.

ls_fcat-tabname = 'ITAB'.

ls_fcat-decimals_out = 2.

ls_fcat-fieldname = 'PRDAT'.

ls_fcat-seltext_l = 'Report Date'.

ls_fcat-seltext_m = 'Report Date'.

ls_fcat-seltext_s = 'Report Date'.

ls_fcat-outputlen = 10.

APPEND ls_fcat TO gt_fcat.

ls_fcat-fieldname = 'ZTNAM'.

ls_fcat-seltext_l = 'Test'.

ls_fcat-seltext_m = 'Test'.

ls_fcat-seltext_s = 'Test'.

ls_fcat-outputlen = 15.

APPEND ls_fcat TO gt_fcat.

ls_fcat-fieldname = 'CTLNO'.

ls_fcat-seltext_l = 'Test No'.

ls_fcat-seltext_m = 'Test No'.

ls_fcat-seltext_s = 'Test No'.

ls_fcat-outputlen = 15.

APPEND ls_fcat TO gt_fcat.

ls_fcat-fieldname = 'VBELN'.

ls_fcat-seltext_l = 'Sales Order'.

ls_fcat-seltext_m = 'Sales Order'.

ls_fcat-seltext_s = 'Sales Order'.

ls_fcat-outputlen = 10.

APPEND ls_fcat TO gt_fcat.

ENDFORM.

Read only

0 Likes
878

SELECT a~ZTNAM

a~CTLNO

a~VBELN

b~PRDAT

INTO CORRESPONDING FIELDS OF TABLE ITAB

FROM ZLIST as a

INNER JOIN ZCTLK as b

ON aCTLNO = bCTLNO

WHERE a~ZTNAM in ZTEST.

use this code. you have mentioned bCTLNO which is not required & WHERE aZTNAM in ZTEST. since ztest is seletion option use IN.

regards

Prajwal K.

Edited by: prajwal k on Jan 12, 2008 8:26 AM

Edited by: prajwal k on Jan 12, 2008 8:54 AM

Read only

0 Likes
878

still its not working yar, give me other way.

Read only

0 Likes
878

hay just debug and chick ,that your getting problem in data fetching or some where else.

I don’t think u r getting problem in select statement.

Regards

Prajwal K.