#7
|
|||
|
|||
Si no te entiendo mal, lo que necesitas es una tabla en que tengas:
material descripción cantidad importe. Sólo que vas a tener que hacerlo para varias opciones de movimientos. Si las condiciones de los movimientos sabes cuáles son, es decir, que te dicen que tienes que mostrarlo siempre para el 561 y 562 por una lado y para el 501 502 101 102 por otro puedes hacer algo así. data: r_movimientos type range of mseg-bwart, wa_movimiento like line of r_movimientos, indice type i. types: begin of movimiento_type, matnr type mseg-matnr, maktx type makt-maktx, menge type mseg-menge, dmbtr type mseg-dmbtr, end of movimiento_type, t_movimientos_type type table of movimiento_type. data: t_movimientos type t_movimientos_type with HEADER LINE, t_movimientos1 type t_movimientos_type with HEADER LINE, t_movimientos2 type t_movimientos_type with HEADER LINE. do 2 times. indice = sy-index. if indice = 1. wa_movimiento-sign = 'I'. wa_movimiento-option = 'EQ'. wa_movimiento-low = '561'. append wa_movimiento to r_movimientos. wa_movimiento-low = '562'. append wa_movimiento to r_movimientos. elseif sy-index = 2. refresh r_movimientos. wa_movimiento-sign = 'I'. wa_movimiento-option = 'EQ'. wa_movimiento-low = '501'. append wa_movimiento to r_movimientos. wa_movimiento-low = '502'. append wa_movimiento to r_movimientos. wa_movimiento-low = '101'. append wa_movimiento to r_movimientos. wa_movimiento-low = '102'. append wa_movimiento to r_movimientos. endif. SELECT mseg~matnr makt~maktx sum( mseg~menge ) sum( mseg~dmbtr ) FROM mkpf inner join mseg on mkpf~mblnr = mseg~mblnr and mkpf~mjahr = mseg~mjahr inner join makt on mseg~matnr = makt~matnr and makt~spras = sy-langu INTO CORRESPONDING FIELDS OF TABLE t_movimientos WHERE mseg~bwart IN r_movimientos and budat between '20100101' and '20100131' GROUP BY mseg~matnr makt~maktx. if indice = 1. t_movimientos1[] = t_movimientos[]. elseif indice = 2. t_movimientos2[] = t_movimientos[]. endif. enddo. Es otra forma. Si fuesen muchos rangos de movimientos el if sería una chapuza y se podría buscar otra forma, pero para dos puede funcionar. Un saludo. |
Herramientas | Buscar en Tema |
Desplegado | |
|
|