#1
|
|||
|
|||
Problema field-symbols, es posible ????
Hola me gustaría saber si es posible con field-symbols asignarle un valor a la variable que apunta, es decir que si un una variable contine el nombre
'G_ZCIC_MIN_OPER-WEEKEND01' que se lo asigno a un field symbol quiero que el valor que tenga ese campo real por ejemplo sea 'X' o cualquier valor que yo le diga. Eso es posible???? . No sé si me explico...... este es el ejemplo que yo estoy intentando montar. data: campo1(22) type c value 'G_ZCIC_MIN_OPER-ICONXX', campo2(21) type c value 'G_ZCIC_MIN_OPER-DIAXX', campo3(25) type c value 'G_ZCIC_MIN_OPER-WEEKENDXX', l_dato(30) type c, l_contador type i, l_x(1) type c. "Chequeamos que no sea sábado ó domingo el día, si es así no generamos registro. DATA: v_daynr TYPE hrvsched-daynr, v_daytxt LIKE HRVSCHED-DAYTXT. CALL FUNCTION 'RH_GET_DATE_DAYNAME' EXPORTING langu = sy-langu date = p_fecha calid = 'ES' IMPORTING daynr = v_daynr DAYTXT = v_daytxt EXCEPTIONS no_langu = 1 no_date = 2 no_daytxt_for_langu = 3 invalid_date = 4 OTHERS = 5. if v_daynr eq 6 or v_daynr eq 7. move p_fecha+6(2) to campo3+23(2). assign (campo3) to <f3>. <f3> = l_x. endif. Gracia por leer este mensaje y un saludo. |
#2
|
||||
|
||||
Si, es correcto pero primero tienes q definir el field symbol y la variable l_x como el campo3, para q no halla errores, esto es:
field-symbols: <f3> like campo3. data: l_x like campo3. corregir linea: assign (campo3) to <f3>. por assign campo3 to <f3>. Pruebalo! l |
#3
|
|||
|
|||
Hola compañero gracias por la ayuda pero no hay manera...
Mi código es el siguiente: field-symbols: <f1> type any, <f2> type any, <f3> type any. data: campo1(22) type c value 'G_ZCIC_MIN_OPER-ICONXX', campo2(21) type c value 'G_ZCIC_MIN_OPER-DIAXX', campo3(25) type c value 'G_ZCIC_MIN_OPER-WEEKENDXX', l_dato(30) type c, l_contador type i, l_x(25) type c value 'X'. DATA: v_daynr TYPE hrvsched-daynr, v_daytxt LIKE HRVSCHED-DAYTXT. CALL FUNCTION 'RH_GET_DATE_DAYNAME' EXPORTING langu = sy-langu date = p_fecha calid = 'ES' IMPORTING daynr = v_daynr DAYTXT = v_daytxt EXCEPTIONS no_langu = 1 no_date = 2 no_daytxt_for_langu = 3 invalid_date = 4 OTHERS = 5. if v_daynr eq 6 or v_daynr eq 7. move p_fecha+6(2) to campo3+23(2). assign campo3 to <f3>. <f3> = l_x. endif. Pero no hay manera, en resumen con los field-symbols lo que quiere que por ejemplo asigno el valor de campo3 vale 'G_ZCIC_MIN_OPER-WEEKEND01' que es el nombre del campo de la tabla lo asigno al field symbol por lo tanto debería apuntar al valor de la variable y luego quiero asignar un valor a esa variable pero lo único que pasa es que campo 3 valga "X" y <f3> valga "X" pero en la cabera de la tabla G_ZCIC_MIN_OPER-WEEKEND01 no cambio de valor. Alguna idea ????? Saludos. |
#4
|
|||
|
|||
El problema que estas teniendo en que intentas acceder a un campo de una estructura y se hace diferente
Voy a suponer que quieres acceder a la variable G_ZCIC_MIN_OPER-WEEKEND03 que quiere decir que quiero acceder al campo WEEKEND03 de la estructura G_ZCIC_MIN_OPER, tambien voy a suponer que la estructura G_ZCIC_MIN_OPER es del tipo ZTY_S_TIPOESTRUCTURA field-symbols: <f1> type any, <f2> type any, <f3> type any. data: campo1(22) type c value 'G_ZCIC_MIN_OPER-ICONXX', campo2(21) type c value 'G_ZCIC_MIN_OPER-DIAXX', campo3(25), l_dato(30) type c, l_contador type i, l_x(25) type c value 'X'. concatenate 'G_ZCIC_MIN_OPER-WEEKEND' '03' into campo3. assign component (campo3) of structure ZTY_S_TIPOESTRUCTURA to <f3>. |
#5
|
|||
|
|||
Muchas gracias.
Saludos |
Herramientas | Buscar en Tema |
Desplegado | |
|
|