MUNDOSAP

Regresar   MUNDOSAP > DESARROLLO > Programación ABAP IV
Nombre de Usuario
Contraseña
Home Descargas Registrar FAQ Miembros Calendario Buscar Temas de Hoy Marcar Foros Como Leídos




 
 
 
Herramientas Buscar en Tema Desplegado
Prev Mensaje Previo   Próximo Mensaje Próx
  #2  
Viejo 27/05/14, 02:49:06
Desmoquattro Desmoquattro is offline
Junior Member
 
Fecha de Ingreso: may 2006
Mensajes: 27

types: begin of ty_bkpf,
bukrs type bkpf-bukrs,
belnr type bkpf-belnr,
gjahr type bkpf-gjahr,
bldat type bkpf-bldat,
budat type bkpf-budat,
xblnr type bkpf-xblnr,
bktxt type bkpf-bktxt,
blart type bkpf-blart,
end of ty_bkpf.

types: begin of ty_bseg,
bukrs type bseg-bukrs,
belnr type bseg-belnr,
gjahr type bseg-gjahr,
buzei type bseg-buzei,
sgtxt type bseg-sgtxt,
prctr type bseg-prctr,
end of ty_bseg.

types: begin of ty_datos,
bukrs type bkpf-bukrs,
belnr type bkpf-belnr,
gjahr type bkpf-gjahr,
buzei type bseg-buzei,
bldat type bkpf-bldat,
budat type bkpf-budat,
xblnr type bkpf-xblnr,
bktxt type bkpf-bktxt,
blart type bkpf-blart,
Sgtxt type bseg-sgtxt,
Prctr type bseg-prctr,
end of ty_datos.

data: t_datos type standard table of ty_datos,
t_bkpf type standard table of ty_bkpf,
t_bseg type standard table of ty_bseg.

data: wa_bkpf type ty_bkpf,
wa_bseg type ty_bseg,
wa_datos type ty_datos.

** También podrías llenar t_datos directamente
Select Bukrs Belnr Gjahr Bldat Budat Xblnr Bktxt Blart
From Bkpf
Into table t_bkpf
Where Bukrs Eq P_bukrs
And Belnr In S_belnr
And Gjahr In S_gjahr.

if t_bkpf[] is not initial.
Select bukrs belnr gjahr buzei Sgtxt Prctr
From Bseg
Into table t_bseg
for all entries in t_bkpf
Where Bukrs Eq T_bkpf-bukrs
And Belnr Eq T_bkpf-belnr
And Gjahr Eq T_bkpf-gjahr.

endif.

Loop At T_bkpf into wa_bkpf.
** Movés los campos de wa_bkpf a wa_datos.
loop at t_bseg into wa_bseg
where bukrs eq wa_bkpf-bukrs
and belnr eq wa_bkpf-belnr
and gjahr eq wa_bkpf-gjahr.
** Movés los campos de wa_bseg a wa_datos.
append wa_datos to t_datos.
clear wa_datos.
endloop.
Endloop.

Básicamente sería eso... después hay varias cosas para mejorar si necesitás performance (tablas sorted, loopear la bseg directo y un read a bkpf si cambió el valor, usar índices, etc etc)


Saludos!
Responder Con Cita
 


Herramientas Buscar en Tema
Buscar en Tema:

Búsqueda Avanzada
Desplegado

Reglas de Mensajes
no puedes crear nuevos temas
no puedes responder temas
no puedes adjuntar archivos
no puedes editar tus mensajes

El código vB está On
Las caritas están On
Código [IMG] está On
Código HTML está Off
Saltar a Foro


Husos Horarios son GMT. La hora en este momento es 07:30:45.


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