MUNDOSAP

MUNDOSAP (foro/index.php)
-   Programación ABAP IV (foro/forumdisplay.php?f=4)
-   -   Mis primeras lineas de un ALV (foro/showthread.php?t=62385)

Dany24 24/04/12 21:20:36

Mis primeras lineas de un ALV
 
Hola, gracias por el apoyo esta algo complicado, pero nada imposible... estuve haciendo un ALV con ayuda de una buena persona de aqui mas o menos me guie... y llevo esto, ojala me puedan decir donde esta el error solo es mostrar los datos... gracias y linda semana a todos:

*&---------------------------------------------------------------------*
*& Report Z_REPORT
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

report z_report.

include z_report_top.
include z_report_rut.

start-of-selection.
perform selecciona_informacion.
if z_report[] is not initial.
perform report.
else.
endif.


*&---------------------------------------------------------------------*
*& Include Z_REPORT_TOP
*&--------------------------------------------------------------------*

TYPE-POOLS: slis.

form genera_titulos .

data: I_fieldcat type slis_fieldcat_vbrk.
data w_fieldcat like line of I_fieldcat.

TABLES: vbrk.

TYPES: BEGIN OF report,
vbeln TYPE vbeln,
fkart TYPE fkart,
fktyp TYPE fktyp,
vbtyp TYPE vbtyp,
waers TYPE waerk,
vkorg type vkorg,
vtweg type vtweg,
kalsm type kalms,
knumv type knumv,
vsbed type vsbed.
types end of 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 Z_REPORT_RUT
*&---------------------------------------------------------------------*
form procesa.
select VBELN FKART FKTYP VBTYP WAERK VKORG VTWEG KALSM KNUMV VSBED
into table vbkr
from z_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.

Ah i me manda un error en esta parte... I_fieldcat

Dany24 25/04/12 09:37:26

Si alguien me pudiera explicar si esta bien lo que hice o esta mal se los agradeceria chicos, jejejeje gracias... quiero ver si entendi y porque me sale ese mensaje de error en i_fielcat... :P

hugoa77 25/04/12 13:11:26

la verdad que veo varios problemas en el código (a mi parecer...)
cual es el mensaje de error que te da? copialo completo para poder ayudarte...
slds,

Conchis 25/04/12 13:43:49

Hola,

Este es parte de código que utilizo y a mi me funciona.

TYPE-POOLS: slis.

DATA : gt_fieldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE,
gs_layout TYPE slis_layout_alv.

gt_fieldcat-fieldname = 'VBELN'.
gt_fieldcat-ref_fieldname = 'VBELN'.
gt_fieldcat-reptext_ddic = 'FACTURA'.
gt_fieldcat-seltext_l = 'FACTURA'.
gt_fieldcat-seltext_m = 'FACTURA'.
gt_fieldcat-seltext_s = 'FACTURA'.
gt_fieldcat-ddictxt(1) = 'L'.
gt_fieldcat-ref_tabname = 'VBRK'.
APPEND gt_fieldcat .
CLEAR gt_fieldcat.

Saludos.

Dany24 25/04/12 14:09:54

Hola... :D
 

Hola Hugito, mira le doy guardar y luego activar y me manda error y dice
Error en sintaxis
Descripción Linea Clase
Include Z_REPORT_TOP 10 (botón rojo)
"I_FIELDCAT" is not an internal table
Include Z_REPORT_TOP 7 (BOTÓN AMARILLO)
There should only be definitions in the TOP include (or nested includes
within it). This means that all kinds of implementation (CLASS...
IMPLEMENTATION, not meaningful. is not meaningful.

*&---------------------------------------------------------------------*
*& Report Z_REPORT
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

report z_report.

include z_report_top.
include z_report_rut.

start-of-selection.
perform selecciona_informacion.
if z_report[] is not initial.
perform report.
else.
endif.

Dany24 25/04/12 14:16:11


Hola si como le comentaba a Hugo, le doy en guardar y luego activar pero me sale error y bueno es una prueba pero me guié con el ejemplo que me mandaste y de otros programas de los consultores, pero son woow mounstruos de programas... me refiero que los admiro woow tanto codigo ojala pronto pueda estar haciendo algo como ustedes... el mensaje es este...


Error en sintaxis
Descripción Linea Clase
Include Z_REPORT_TOP 10 (botón rojo)
"I_FIELDCAT" is not an internal table
Include Z_REPORT_TOP 7 (BOTÓN AMARILLO)
There should only be definitions in the TOP include (or nested includes
within it). This means that all kinds of implementation (CLASS...
IMPLEMENTATION, not meaningful. is not meaningful.

*&---------------------------------------------------------------------*
*& Report Z_REPORT
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

report z_report.

include z_report_top.
include z_report_rut.

start-of-selection.
perform selecciona_informacion.
if z_report[] is not initial.
perform report.
else.
endif.

Mauricio Hidalgo 25/04/12 14:33:13

Respecto del mensaje original.

Tienes declarado l_fieldcat como

data: l_fieldcat type slis_fieldcat_alv

deberia ser

data: l_fieldcat type table of slis_fieldcat_alv

Saludos

Dany24 25/04/12 14:50:48

Gracias
 

Gracias que amable eres Mau... lo checo... lindo dia. :p

hugoa77 25/04/12 15:10:14

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

Dany24 25/04/12 15:22:19

:d
 
Gracias que lindo eres y que amable por ayudarme... lo checare en este momento... :D :p


Husos Horarios son GMT. La hora en este momento es 18:10:18.

www.mundosap.com 2006 - Spain
software crm, crm on demand, software call center, crm act, crm solutions, crm gratis, crm web