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

Normal select statement

Former Member
0 Likes
1,316

Hi All,

Iam currently encounting a simple select statement problem. Iam using the below code retrieve data into a internal table, but not able to do so.

tables : iflot, iflotx.

data : l_func_loc like iflot-tplnr.

DATA : L_iflot LIKE IFLOT OCCURS 0 WITH HEADER LINE.

l_func_loc = 'AB01.04.25.01-TRH03'.

select * FROM IFLOT into TABLE l_iflot WHERE TPLNR = l_func_loc.

if sy-subrc = 0.

read table l_iflot index 1.

write : l_iflot-submt.

endif.

This normal statement does not work. but when i search in the table iflot using se16 i have one record for tplnr = 'AB01.04.25.01-TRH03'.

Please help me to solve this problem.

Thanks,

Raj

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,203

Hi All,

No solution still now. The solutions given did not work. Can anyone help in this.

but when i use the below statement all records can be retrieved.

select * FROM IFLOT into TABLE l_ITOB WHERE TPLNR ne ' '.

if sy-subrc = 0.

read table l_itob index 1.

write : l_itob-submt.

endif.

when i retrieve the record for tplnr = 'AB01.04.25.01-TRH03' using se16 in table iflot, the output for tpnlr field seems to be '?0100000000000002070' .

can anyone tell me why.

Thanks,

Rajesh.

Edited by: Rajesh KUmar on Aug 6, 2008 6:56 AM

9 REPLIES 9
Read only

Former Member
0 Likes
1,203

use conversion exit and then try

Function module CONVERSION_EXIT_TPLNR_INPUT


TABLES : iflot, iflotx.
DATA : l_func_loc LIKE iflot-tplnr.
DATA : l_iflot LIKE iflot OCCURS 0 WITH HEADER LINE.
l_func_loc = ' ' . "give the value of location
CALL FUNCTION 'CONVERSION_EXIT_TPLNR_INPUT'
  EXPORTING
    input                      = l_func_loc
*   I_FLG_CHECK_INTERNAL       = 'X'
 IMPORTING
   OUTPUT                     = l_func_loc
* EXCEPTIONS
*   NOT_FOUND                  = 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.

SELECT * FROM iflot INTO CORRESPONDING FIELDS OF TABLE l_iflot WHERE tplnr = l_func_loc.
IF sy-subrc = 0.
  READ TABLE l_iflot INDEX 1.
  WRITE : l_iflot-submt.
ENDIF.

Edited by: mrugesh phatak on Aug 6, 2008 6:03 AM

Read only

Former Member
0 Likes
1,203

Hi,

try this...

ables : iflot, iflotx.

data : l_func_loc like iflot-tplnr.

DATA : L_iflot LIKE IFLOT OCCURS 0 WITH HEADER LINE.

select * FROM IFLOT into TABLE l_iflot WHERE TPLNR = 'AB01.04.25.01-TRH03'.

if sy-subrc = 0.

read table l_iflot index 1.

write : l_iflot-submt.

endif.

Read only

former_member541575
Participant
0 Likes
1,203

hi rajesh

pls change the where clause like --> "WHERE iflot-TPLNR = l_func_loc."

Read only

Former Member
0 Likes
1,203

Check the value 'AB01.04.25.01-TRH03' you are passing to l_func_loc .As it is of type CHAR if there is any lowercase charactor or space select statement will not work.

Read only

Former Member
0 Likes
1,204

Hi All,

No solution still now. The solutions given did not work. Can anyone help in this.

but when i use the below statement all records can be retrieved.

select * FROM IFLOT into TABLE l_ITOB WHERE TPLNR ne ' '.

if sy-subrc = 0.

read table l_itob index 1.

write : l_itob-submt.

endif.

when i retrieve the record for tplnr = 'AB01.04.25.01-TRH03' using se16 in table iflot, the output for tpnlr field seems to be '?0100000000000002070' .

can anyone tell me why.

Thanks,

Rajesh.

Edited by: Rajesh KUmar on Aug 6, 2008 6:56 AM

Read only

0 Likes
1,203

Hi Rajesh KUmar,

The code which I have written above is working fine.

Just set a break point on select statement & see if you are getting values in your internal table.

In my server Report is coming blank because there is no value maintained for 'submt' field

just check if the same case is there at your end.

you said

 
when i retrieve the record for tplnr = 'AB01.04.25.01-TRH03' using se16 in table iflot, the output for tpnlr field seems to be '?0100000000000002070' . 

this is because the the field 'tplnr' is having a Convers. Routine TPLNR

if u check in FM -> CONVERSION_EXIT_TPLNR_OUTPUT

input 0100000000000002070

u will get output as AB01.04.25.01-TRH03

to check i ffield is having a Convers. Routine

1.go to ur table in se11

2.double click on data element

3.open the Domain TPLNR

4.In definition tab u will get Convers. Routine TPLNR

if u still face a problem do reply

Edited by: mrugesh phatak on Aug 6, 2008 7:26 AM

Read only

Former Member
0 Likes
1,203

Hi

Check with 'LIKE' or CP

select * FROM IFLOT into TABLE l_iflot WHERE TPLNR like l_func_loc.

select * FROM IFLOT into TABLE l_iflot WHERE TPLNR CP l_func_loc.

regards

padma

Read only

Former Member
0 Likes
1,203

Us ethis way.

select * FROM IFLOT into TABLE l_iflot WHERE TPLNR EQ l_func_loc.

rgds

rajesh

Read only

Former Member
0 Likes
1,203

Thanks to everyone for your comments.

Thanks Phatak.

Raj.