Application Development 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: 

Error in select statement

former_member328875
Participant
0 Kudos
134

Hi experts,

In ESKN table Packno type numc 10 and  in Essr table LBLNI type char 10

when I use the following select select statement then error 'PACKNO and  it_essr-lblni must have the same type and same lenth' occurs.

SELECT * FROM eskn INTO TABLE it_eskn FOR ALL ENTRIES IN it_essr WHERE packno = it_essr-lblni.

What is the alternative of this one or how to rectify this error please tell me.

regards,

Saquib

2 REPLIES 2

hemanth_kumar21
Contributor
0 Kudos
100

Hi Saquib Khan,

Please change data type of lblni to packno.

when we are comparing any fields, the data type of the both fields should match.

So, please create one more temporary internal table with the field lblni type packno.
And move the data to that temproray internal table.
Now use this temproray internal table in the select query of eskn

Below is the code for the same.

  DATA: it_eskn TYPE STANDARD TABLE OF eskn,
      it_essr TYPE STANDARD TABLE OF essr,
      is_essr TYPE essr.

TYPES: BEGIN OF lty_essr_temp,
        lblni TYPE packno,
        END OF lty_essr_temp.

DATA: lt_essr_temp TYPE STANDARD TABLE OF lty_essr_temp,
      ls_essr_temp TYPE lty_essr_temp.

IF it_essr IS NOT INITIAL.
  LOOP AT it_essr INTO is_essr.
    ls_essr_temp-lblni  = is_essr-lblni.
    APPEND ls_essr_temp TO lt_essr_temp.
    CLEAR: ls_essr_temp.
  ENDLOOP.
  SELECT * FROM eskn INTO TABLE it_eskn
                     FOR ALL ENTRIES IN lt_essr_temp
                     WHERE packno = lt_essr_temp-lblni.
ENDIF.

former_member184569
Active Contributor
0 Kudos
100

Either change the datatype of lnlni to numc(10) or use conversion exits.

Before the select statement, use conversion exit for all values of lblni.

Use FM CONVERSION_EXIT_ALPHA_INPUT and then pass the output of this in the select statement.