Reporte con inner join

Colapsar
X
 
  • Tiempo
  • Mostrar
Limpiar Todo
nuevos mensajes
  • ALNICO
    Senior Member
    • may
    • 107

    #1

    Reporte con inner join

    Saludos a todos , soy nuevo en la comunidad y de verdad necesito ayuda con un reporte que estoy haciendo y lleva unas consultas cruzadas de unas 5 tablas tengo tiempo tratando de hacerlo pero no me ha salido como quiero , voy a agregar el codigo para que lo observen y me digan en que estoy fallando


    REPORT ZHR_EMBARGOS_PRESTACIONES.

    * Declaración de variables


    TABLES:PA9111,PA0001,pa0185,ZINT_EVAL,Z9HRMOTEMB,Z 9HRTSTEMB.

    DATA: BEGIN OF REG,


    fili type PA0001-bukrs,
    anom type PA0001-abkrs,
    nper type PA9111-pernr,
    ced type Pa0185-icnum,
    nom type PA0001-ename,
    perf type PA9111-perfil,
    freg type PA9111-finimedemb,
    mtot type PA9111-mtunico,
    ptot type PA9111-porsmn,
    int type ZINT_EVAL-intereses,
    mot type Z9HRMOTEMB-dsmotemb,
    stat type Z9HRTSTEMB-tstatus,
    cedb type PA9111-nbbenfr,
    nomb type PA9111-cibenfr,
    trib type PA9111-tribunal,
    nofic type PA9111-numofic,
    fofc type PA9111-fofc,
    numfs type PA9111-numofcsup,
    statu type PA9111-status,


    END OF REG.


    DATA: BEGIN OF ZT OCCURS 0.
    INCLUDE STRUCTURE REG.
    DATA END OF ZT.



    * Pantalla de seleccion

    SELECTION-SCREEN BEGIN OF BLOCK b WITH FRAME TITLE text-001 NO INTERVALS.
    PARAMETERS:

    inval TYPE PA9111-begda,
    fival TYPE PA9111-endda,
    nper TYPE PA9111-pernr,
    soc TYPE PA0001-bukrs,
    anom TYPE PA0001-abkrs,
    freg TYPE PA9111-finimedemb,
    trib TYPE PA9111-tribunal,
    nofic TYPE PA9111-numofic,
    fofic TYPE PA9111-fofc,
    codmo TYPE PA9111-codmotivo,
    stat TYPE PA9111-status.



    SELECTION-SCREEN END OF BLOCK b.


    * Busquedas Cruzadas

    SELECT
    PA0001~bukrs PA0001~abkrs PA9111~pernr Pa0185~icnum Pa0001~ename
    PA9111~perfil PA9111~finimedemb PA9111~mtunico PA9111~porsmn
    ZINT_EVAL~intereses Z9HRMOTEMB~dsmotemb Z9HRTSTEMB~tstatus
    PA9111~nbbenfr PA9111~cibenfr PA9111~tribunal PA9111~numofic
    PA9111~fofc PA9111~numofcsup PA9111~status
    INTO CORRESPONDING FIELDS OF TABLE ZT FROM PA0001
    INNER JOIN PA9111 ON PA9111~PERNR = PA0001~PERNR
    INNER JOIN Pa0185 ON Pa0185~PERNR = Pa9111~PERNR
    INNER JOIN ZINT_EVAL ON ZINT_EVAL~EMPLEADO = PA0185~PERNR
    INNER JOIN Z9HRMOTEMB ON Z9HRMOTEMB~CODMOTIVO = PA9111~CODMOTIVO
    INNER JOIN Z9HRTSTEMB ON Z9HRTSTEMB~STATUS = PA9111~STATUS
    WHERE
    PA9111~begda = INVAL AND
    PA9111~endda = fival AND
    PA9111~pernr = nper AND
    PA0001~bukrs = soc AND
    PA0001~abkrs = anom AND
    PA9111~finimedemb = freg AND
    PA9111~tribunal = trib AND
    PA9111~numofic = nofic AND
    PA9111~fofc = fofic AND
    PA9111~codmotivo = codmo AND
    PA9111~status = stat.


    WRITE: /50(40) ' REPORTE PARA EMBARGO DE PRESTAMOS '.

    SKIP.
    ULINE AT /(145).


    WRITE: / sy-vline,'Filial', 10 sy-vline, 11'Área de nómina', 25 sy-vline, 26 'Tipo de pago', 38 sy-vline, 39 '# Empleado', 48 sy-vline, 49'Cédula', 55 sy-vline, 56 'Nombre', 62 sy-vline, 63 'Perfil',69 sy-vline,
    70 'F.registro',80 sy-vline, 81'Monto total', 92 sy-vline, 93'Porc retenido',106 sy-vline, 107 'Intereses',115 sy-vline, 116'Motivo',122 sy-vline, 123'Estatus',130 sy-vline, 131'Céd beneficiario',147 sy-vline, 148'Nom beneficiario',
    165 sy-vline, 166'Tribunal',174 sy-vline, 175'Núm del oficio',189 sy-vline, 190'F del oficio',202 sy-vline, 203'Núm eje/sus',214 sy-vline, 215'Status'.

    ULINE AT /(140).

    LOOP AT ZT.

    WRITE:

    ZT-fili,ZT-anom,ZT-nper,ZT-ced,ZT-nom,ZT-perf,ZT-freg,ZT-mtot,ZT-ptot,
    ZT-int,ZT-mot,ZT-stat,ZT-cedb,ZT-nomb,ZT-trib,ZT-nofic,ZT-fofc,ZT-numfs,
    ZT-statu.


    ENDLOOP.


    la cuestion esta que el select no llena la tabla a pesar de los datos si existen , y otro detalle es que al momento de imprimirlos no se como podria toda la pantalla ya que son muchos y por lo que veo la pantalla no me permito ponerlos todos en el mismo nivel , gracias a todos por su ayuda
  • davidffh
    Junior Member
    • ago
    • 10

    #2
    prueba en lugar de PARAMETERS con SELECT-OPTIONS, te funcionará mejor.

    y para la salida en pantalla puedes probar con una ALV.

    Comentario

    Trabajando...