2008 Jan 12 4:25 AM
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
2008 Jan 12 4:49 AM
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
2008 Jan 12 4:49 AM
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,
2008 Jan 12 5:02 AM
data available in both table yar, condition also right.
what could be the reason.
2008 Jan 12 6:02 AM
2008 Jan 12 6:17 AM
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.
2008 Jan 12 7:25 AM
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
2008 Jan 12 8:58 AM
2008 Jan 12 9:59 AM
hay just debug and chick ,that your getting problem in data fetching or some where else.
I dont think u r getting problem in select statement.
Regards
Prajwal K.