MUNDOSAP

MUNDOSAP (foro/index.php)
-   Formularios - SAPScript - Smartforms (foro/forumdisplay.php?f=5)
-   -   Acceder a una Tabla Interna dentro de un Smartforms (foro/showthread.php?t=35849)

mitosap 24/03/10 23:04:48

Acceder a una Tabla Interna dentro de un Smartforms
 
Hola a todos.

En definiciones globales (Inicializacion) he creado una tabla resumida que tiene los productos resumidos de una factura generada por VF04 (como son varias entregas de una dia, hay productos repetidos). Logre resumir la tabla interna del MAIN-datos (zgs_it_gen INTO gs_it_gen), solo que al tratar de ir de esta tabla gs_it_gen a otra tabla resumida por producto con sus valores totalizados (T_MARAX) no se como hacerlo.

INICIALIZACION (Datos Globales)
DATA: BEGIN OF t_mara OCCURS 0,
matnr LIKE mara-matnr, " Nro Material
sec_factura LIKE mara-sec_factura, " Secuencia Factura
END OF t_mara.

DATA: BEGIN OF t_maraw OCCURS 0,
material like mara-matnr,
bil_number(10),
item_number(6),
valor(13) type p decimals 2,
END OF t_maraw.

DATA: BEGIN OF t_marax OCCURS 0,
material like mara-matnr,
bil_number(10),
item_number(6),
valor(13) type p decimals 2,
END OF t_marax.

*
break jaarauz.
*Aqui creo una tabla por producto y otras columnas de enlace (bil_number, itm_number)
Loop at IS_BIL_INVOICE-IT_GEN into GS_IT_GEN.

move gs_it_gen-material to t_maraw-material.

move gs_it_gen-bil_number to t_maraw-bil_number.

move gs_it_gen-itm_number to t_maraw-item_number.
collect t_maraw.
Endloop.
****>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Sort t_maraw by material.
*Aqui por cada material obtengo el valor para sumarizarlo despues.
LOOP AT t_maraw.
Read table is_bil_invoice-it_kond INTO GS_IT_KOND_W with key
bil_number = t_maraw-bil_number
itm_number = t_maraw-item_number
binary search.
If sy-subrc eq 0.
t_maraw-valor = GS_IT_KOND_W-kwert.
Else.
t_maraw-valor = 0.
Endif.
Modify t_maraw.
Endloop.
******>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Sort t_maraw by material.
*Aqui luego hago el resumen por producto.
Loop at t_maraw.
move-corresponding t_maraw to t_marax.
move 0 to t_marax-bil_number.
move 0 to t_marax-item_number.
collect t_marax.
Endloop.
Sort t_marax by material.
*Aqui hago resumen por producto en la tabla del MAIN (zgs_it_gen)
Loop at IS_BIL_INVOICE-IT_GEN into GS_IT_GEN.
Read table t_mara with key matnr = gs_it_gen-material binary search.
If sy-subrc ne 0. Clear t_mara. Endif.
gs_it_gen-FPLTR = t_mara-sec_factura.
*
Read table t_maraw with key material = gs_it_gen-material binary search.
If sy-subrc eq 0.
move t_maraw-item_number to gs_it_gen-itm_number.
Else.
move 0 to gs_it_gen-itm_number.
Endif.
*
collect gs_it_gen into zgs_it_gen.
Endloop.
*****>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
MAIN (AreaPrincipal)
****>>>>>
*Justo aqui quiero tomar el valor de esa tabla resumen
Read table t_marax with key material = GS_IT_gen-material
binary search.
If sy-subrc eq 0.
w_kwert = zsde_marax-valor.
ENDif.

El error que me envia es: @8O@ READ_KOND_DATA Field "T_MARAX" is unknown. It is neither in one of the specified tables nor defined by a "DATA" statement. .
El tema es que no se como debo declarla (t_marax).

Gracias por su ayuda, necesito sacar esto adelante con la ayuda de uds.

temaljose 25/03/10 15:43:10

buenos dias, amigo, tienes que definirlas en definiciones globales, pero primero crea en tipos los types de la tablas, ejemplo:
types: begin of t_maraw,
matnr LIKE mara-matnr, " Nro Material
sec_factura LIKE mara-sec_factura, " Secuencia Factura
end of t_maraw.
luego en la pestaņa de deatos glob. haces esto:
Nombre de variante Tipificacion tipo ref.
TI_MARAW TYPE TABLE OF T_MARAW
ES_MARAW TYPE T_MARAW

LUEGO CUANDO REALICES EL CODIGO LAS COLOCAS EN PARAMETROS DE ENTRADA Y DE SALIDA, DEPENDIENDO PARA QUE LA USES
SALUDOS

mitosap 25/03/10 19:39:30

Gracias amigo, todo bien como me indicastes, solo que al ejecutar la VF03, para visualizar el reporte de factura (smartforms), el archivo t_marax esta en blanco. Lo que hice dentro del smartrofms, fue lo siguiente:


DEFINICIONES GLOBALES

Pestaņa TYPES:
types: BEGIN OF ti_maraw,
material(18),
bil_number(10),
item_number(6),
valor(13) type p decimals 2.
types END OF ti_maraw.

Pestaņa DATOS GLOB.:
Nombre Var Tipificacion Tipo Ref.
========= ========== ========
t_marax TYPE TABLE OF ti_maraw
es_marax TYPE ti_maraw.

Pestaņa Inicializacion:
Parametro Entrada (No indico nada)
Parametro Salida (No indico nada)


DATA: BEGIN OF t_marax OCCURS 0,
material like mara-matnr,
bil_number(10),
item_number(6),
valor(13) type p decimals 2,
END OF t_marax.

::::::Se hace un resumen por producto con sus valores totales.
Loop at t_maraw.
move-corresponding t_maraw to t_marax.
move 0 to t_marax-bil_number.
move 0 to t_marax-item_number.
collect t_marax.
Endloop.
Sort t_marax by material.
::::::

AREA PRINCIPAL (MAIN):
Parametro Entrada (t_marax, es_marax)
Parametro Salida (t_marax)

***Curiosamente aqui la tabla esta vacia y no se porque, le hice un debug y es creada y cargada con datos en el Deficiones Globales.
Read table t_marax INTO es_marax with key material = GS_IT_gen-material
binary search.
If sy-subrc eq 0.
w_kwert = es_marax-valor.
ENDif.
****>>>
Me parece que tengo una confucion enorme con los parametros de entrada y salida y recurro a tu experiencia para que me ayudes. Considero que estoy a un pasito de lograr el objetivo.
Gracias de antemano.


Husos Horarios son GMT. La hora en este momento es 04:20:36.

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