#1
|
|||
|
|||
Extraer caracteres de campo
Buen Día.
tengo una duda en un reporte que estoy generando. lo que quiero es validar en el where el valor del awkey pero solo los primeros 10 caracteres le e intentado de varias formas pero no me funciona. espero me puedan ayudar. no tengo mucho en esto de ABAP VALOR AWKEY 49000224982009 SELECT belnr awkey INTO TABLE i_bkpf FROM bkpf FOR ALL ENTRIES IN i_mkpf WHERE *substring* EQ i_mkpf-mblnr. |
#2
|
|||
|
|||
Pues por lo que he estado leyendo me parece que no se puede hacer directamente en la sql. Mira el punto 4.
1. in open sql you can only reference tables that are managed by/in the “ABAP dictionary” 1. open sql does not support dml statements like create table. 2. open sql does not support “advanced” sql statements like truncate, merge, rollup. 3. in open sql you can’t use aggregate functions like sum,avg. 4. open sql does not support most column functions like substr, concat (||) and “case expression” in both the select and where clauses. 5. open sql does not allow you to write predicates ( where conditions) between more than one colum … so you can’t write the following condition: where t1.col1 <> t1.col2 6. open sql does not allow you to write predicates ( where conditions) on columns of a table joined with left (or right ) join. So you can’t write the following sql: select … from t1 left join t2 where t2.col = ‘x’ Así que me temo, que no te quedará más remedio que recorrer todos los registros que te traidas y comprobar ahí si cumplen con la condición o no. Un saludo. |
#3
|
|||
|
|||
Sí que se puede, usando el LIKE, aunque ya no se podría hacer un FOR ALL ENTRIES.
loop at i_mkpf. *vl_awkey será un concatenación de lo que hay en i_mkpf-mblnr y del *caracter %, ejemplo: i_mkpf-mblnr = 4900022498, vl_awkey = 4900022498% SELECT belnr awkey appending TABLE i_bkpf FROM bkpf WHERE AWKEY LIKE vl_awkey. endloop. |
#4
|
|||
|
|||
Si, me parece que la mejor opción es reemplazar el for all entries por un loop y te vas fijando cada uno de los registros.
|
Herramientas | Buscar en Tema |
Desplegado | |
|
|