Ver Mensaje Individual
  #2  
Viejo 10/04/09, 03:59:17
Avatar de Jonathan Barrio Rodriguez
Jonathan Barrio Rodriguez Jonathan Barrio Rodriguez is offline
Senior Member
 
Fecha de Ingreso: oct 2007
Localización: MADRID
Mensajes: 199
****, Carlitos, Carlitos, pues vas ******, ******.

Ese fué mi primer proyecto en sap y la verdad me costó el salir de la empresa. Pero no voy a desmoralizarte, que se puede hacer.

Para conseguir las columnas dinámicas tienes que meter en un loop la declaración de las columnas del ALV.:

loop at I_BSEG_RESULTADOS.

i_tab_alv-name_field = "CLIENTE".
i_tab_alv-value_field = itab_datos-kunnr.

move corresponding i_tab_alv to fieldcat.
append fieldcat.

endloop.

Y para conseguir los valores...
te pasaré este trozo de código qué espero te sea útil:

* DESCRIBE FIELD I_BSEG_RESULTADOS TYPE D_TYP COMPONENTS D_COMPONENTES.
*DO D_COMPONENTES TIMES.
* ASSIGN COMPONENT SY-INDEX OF STRUCTURE I_BSEG_RESULTADOS TO <F1>.
* READ TABLE I_BSEG_RESULTADOS index sy-index.
* ASSIGN COMPONENT I_BSEG_PRUEBAS-ZZBAD OF STRUCTURE I_BSEG_WA TO <F2>.
* IF SY-SUBRC eq 0.
* <F1> = <f2>.
* endif.
* enddo.

Igual es un poco complicadillo, escribe si necesitas ayuda.

Saludos.
__________________
Barrio Rodriguez, Jonathan.
_____________________________________
"No sigas a quien haya encontrado la verdad sino a quien la busque"