Ver Mensaje Individual
  #9  
Viejo 25/04/12, 15:10:14
Avatar de hugoa77
hugoa77 hugoa77 is offline
Senior Member
 
Fecha de Ingreso: may 2010
Mensajes: 130
hasta lo que escribiste ahora... tu codigo deberia quedar mas o menos asi...
REPORT YTEST.
include ytest_top.
include ytest_rut.

start-of-selection.
perform procesa.
perform report .
if it_report is not initial.
perform report.
else.
endif.

*&---------------------------------------------------------------------*
*& Include YTEST_TOP
*&---------------------------------------------------------------------*
TYPE-POOLS: slis.

*form genera_titulos .

data: I_fieldcat type slis_t_fieldcat_alv WITH HEADER LINE.
data w_fieldcat like line of I_fieldcat.

TABLES: vbrk.

TYPES: BEGIN OF t_report,
vbeln TYPE vbeln,
fkart TYPE fkart,
fktyp TYPE fktyp,
vbtyp TYPE vbtyp,
waers TYPE waerk,
vkorg type vkorg,
vtweg type vtweg,
kalsm type kalsm,
knumv type knumv,
vsbed type vsbed.
types end of t_report.
data it_report type standard table of t_report.
data w_report like line of it_report.

*data vbrk like line of vbrk.

*&---------------------------------------------------------------------*
*& Include YTEST_RUT
*&---------------------------------------------------------------------*
form procesa.
select VBELN FKART FKTYP VBTYP WAERK VKORG VTWEG KALSM KNUMV VSBED
from vbrk
into table it_report.
endform.


Form report.
data: l_fieldcat type slis_fieldcat_alv.
data w_fieldcat like line of i_fieldcat.

loop at i_fieldcat into w_fieldcat.
case w_fieldcat-fieldname.

when 'VBELN'.
w_fieldcat-reptext_ddic = 'FACTURA'.
when 'FKART'.
w_fieldcat-reptext_ddic = 'CLASE FACTURA'.
when 'FKTYP'.
w_fieldcat-reptext_ddic = 'TIPO FACTURA'.
when 'VBTYP'.
w_fieldcat-reptext_ddic = 'TIPO DOC.COM.'.
when 'WAERK'.
w_fieldcat-reptext_ddic = 'MONEDA DOC.'.
when 'VKORG'.
w_fieldcat-reptext_ddic = 'ORGANIZ.VENTAS'.
when 'VTWEG'.
w_fieldcat-reptext_ddic = 'CANAL DISTRIB.'.
when 'KALSM'.
w_fieldcat-reptext_ddic = 'ESQUEMA CALCULO'.
when 'KNUMV'.
w_fieldcat-reptext_ddic = 'CONDICION DOC'.
when 'VSBED'.
w_fieldcat-reptext_ddic = 'CONDIC.EXPED.'.

ENDCASE.

modify i_fieldcat from w_fieldcat.
endloop.
ENDFORM.

donde armas el catologo del ALV tendrias que tener mas o menos esta estructura:
i_fieldcat-seltext_l = ''. nombre del campo
i_fieldcat-fieldname = ''. campo de tu tabla interna "it_report"
i_fieldcat-outputlen = ''. opcional
i_fieldcat-just = ''. opcional
i_fieldcat-tabname = ''. tabla interna. en tu caso "it_report"
append i_fieldcat. clear i_fieldcat.

esto haces por cada campo que quieras mostrar en el ALV.

bueno... espero te sirva..
fijate que comente algunas lineas en otras cambie algunos datos de lugar y esas cosas... compara el tu codigo con el que te envío para que puedas ver las diferencias y saber lo que estaba mal...
slds
Responder Con Cita