2013 Oct 22 9:13 AM
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
2013 Oct 22 9:25 AM
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.
2013 Oct 22 9:29 AM
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.