Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 3523

ABAP Program Help!

$
0
0

Hello I have written a ABAP program getting data from E070 and E07t everything works great except the as4text is missing in my comments field. I know it is probbaly simple to get it working
but I am totally lost and I need some help please. I don't think I added it to the program correctly and would appreciate if someone could show me what I did wrong. Below is my code! Thanks!!

 

TABLES: e071, e070, e07t.
DATA: BEGIN OF t_ordenes OCCURS 0,
        trkorr LIKE e070-trkorr,
        trstatus LIKE e070-trstatus,
        trfunction LIKE e070-trfunction,
        as4date LIKE e070-as4date,
        as4time LIKE e070-as4time,
        as4text LIKE e07t-as4text,
       END OF t_ordenes,
       BEGIN OF t_tareas OCCURS 0,
        trkorr  LIKE e070-trkorr,
        strkorr LIKE e070-strkorr,
        as4user LIKE e070-as4user,
        as4date LIKE e070-as4date,
       as4time LIKE e070-as4time,

 

       END OF t_tareas.
TYPES: BEGIN OF ty_objetos,
          trkorr  LIKE e070-trkorr,
          strkorr LIKE e070-strkorr,
          as4user LIKE e070-as4user,
          pgmid LIKE e071-pgmid,
          object LIKE e071-object,
          obj_name LIKE e071-obj_name,
          trstatus LIKE e070-trstatus,
          as4date LIKE e070-as4date,
          as4time LIKE e070-as4time,
          as4text LIKE e07t-as4text,
          trfunction LIKE e070-trfunction,
          estado  LIKE dd07v-ddtext,
          tipo  LIKE dd07v-ddtext,
        END OF ty_objetos.

 

TYPE-POOLS: slis.
DATA: gt_fieldcat  TYPE slis_t_fieldcat_alv WITH HEADER LINE,
       gs_layout  TYPE slis_layout_alv,
       g_repid LIKE sy-repid,
       i_list_comments TYPE slis_t_listheader,
       w_list_comments    LIKE LINE OF i_list_comments,
       pt_events    TYPE slis_t_event.
DATA: tabla TYPE ty_objetos OCCURS 0 WITH HEADER LINE.
DATA: t_salida TYPE STANDARD TABLE OF ty_objetos WITH HEADER LINE.

 

SELECT-OPTIONS: request For e070-trkorr,
                 status FOR e070-trstatus,
                 date   FOR e070-as4date,
                 user For e070-as4user,
                 time FOR e070-as4time.
                

 

 

 


INITIALIZATION.
   g_repid = sy-repid.

 

START-OF-SELECTION.
   SELECT trkorr trstatus as4date as4time INTO CORRESPONDING FIELDS OF TABLE t_ordenes
     FROM e070
      WHERE as4date IN date
        AND trstatus IN status
                AND as4time IN time.
               
                
                              
 
   LOOP AT t_ordenes.
     SELECT trkorr strkorr as4user as4time APPENDING CORRESPONDING FIELDS OF TABLE t_tareas
      FROM e070
       WHERE strkorr EQ t_ordenes-trkorr.
      
         
 
      
   ENDLOOP.
 
 
 

 

   LOOP AT t_tareas.
     SELECT trkorr pgmid object obj_name INTO CORRESPONDING FIELDS OF tabla
      FROM e071
       WHERE trkorr EQ t_tareas-trkorr.
       tabla-strkorr = t_tareas-strkorr.
       tabla-as4user = t_tareas-as4user.
       tabla-as4time = t_tareas-as4time.
      

 


       READ TABLE t_ordenes WITH KEY trkorr = t_tareas-strkorr.
       IF sy-subrc EQ 0.
         tabla-trstatus = t_ordenes-trstatus.
         tabla-as4date = t_ordenes-as4date.
         tabla-as4time = t_tareas-as4time.
        

 

         SELECT SINGLE ddtext INTO tabla-estado FROM dd07v
          WHERE domname EQ 'TRSTATUS'
            AND ddlanguage EQ 'S'
            AND domvalue_l EQ t_ordenes-trstatus.

 

         SELECT SINGLE ddtext INTO tabla-tipo FROM dd07v
          WHERE domname EQ 'TRFUNCTION'
            AND ddlanguage EQ 'S'
            AND domvalue_l EQ t_ordenes-trfunction.

 


       ENDIF.
       APPEND tabla.
     ENDSELECT.
   ENDLOOP.
   SORT tabla.
   t_salida[] = tabla[].
   SORT t_salida BY strkorr.
   DELETE ADJACENT DUPLICATES FROM t_salida COMPARING strkorr.
   PERFORM mostrar_reporte_alv.

 

*&---------------------------------------------------------------------*
*&      Form  mostrar_reporte_alv
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_JTAB  text
*----------------------------------------------------------------------*
FORM mostrar_reporte_alv.

 

* Estructura y formato de salida
   PERFORM init_fieldcat.
   PERFORM init_layout.
* Mostrar listado
   PERFORM listado.

 

ENDFORM.                    " mostrar_reporte_alv
*&---------------------------------------------------------------------*
*&      Form  init_fieldcat
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM init_fieldcat.

 

   gt_fieldcat-seltext_l  = 'Request'.
   gt_fieldcat-fieldname = 'STRKORR'.
   gt_fieldcat-outputlen     = '16'.
   gt_fieldcat-just    = 'C'.
   gt_fieldcat-tabname = 'T_SALIDA'.
   APPEND gt_fieldcat. CLEAR gt_fieldcat.

 

   gt_fieldcat-seltext_l  = 'Status'.
   gt_fieldcat-fieldname = 'TRSTATUS '.
   gt_fieldcat-outputlen     = '10'.
   gt_fieldcat-just    = 'C'.
   gt_fieldcat-tabname = 'T_SALIDA'.
   APPEND gt_fieldcat. CLEAR gt_fieldcat.

 

   gt_fieldcat-seltext_l  = 'Time'.
   gt_fieldcat-fieldname = '    AS4TIME '.
   gt_fieldcat-outputlen     = '10'.
   gt_fieldcat-just    = 'C'.
   gt_fieldcat-tabname = 'T_SALIDA'.
   APPEND gt_fieldcat. CLEAR gt_fieldcat.

 

   gt_fieldcat-seltext_l  = 'User'.
   gt_fieldcat-fieldname = 'AS4USER'.
   gt_fieldcat-outputlen     = '16'.
   gt_fieldcat-just    = 'C'.
   gt_fieldcat-tabname = 'T_SALIDA'.
   APPEND gt_fieldcat. CLEAR gt_fieldcat.

 

   gt_fieldcat-seltext_l  = 'Date'.
   gt_fieldcat-fieldname = 'AS4DATE'.
   gt_fieldcat-outputlen     = '13'.
   gt_fieldcat-just    = 'C'.
   gt_fieldcat-tabname = 'T_SALIDA'.
   APPEND gt_fieldcat. CLEAR gt_fieldcat.

 

gt_fieldcat-seltext_l  = 'Text'.
   gt_fieldcat-fieldname = 'AS4TEXT'.
   gt_fieldcat-outputlen     = '18'.
   gt_fieldcat-just    = 'C'.
   gt_fieldcat-tabname = 'T_SALIDA'.
   APPEND gt_fieldcat. CLEAR gt_fieldcat.

 

ENDFORM.                    "init_fieldcat
*&---------------------------------------------------------------------*
*&      Form  init_layout
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM init_layout.

 

ENDFORM.                    " init_layout
*&---------------------------------------------------------------------*
*&      Form  listado
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM listado.

 

   CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
     EXPORTING
       i_callback_program = g_repid
       is_layout          = gs_layout
       it_fieldcat        = gt_fieldcat[]
       i_save             = 'A'
*     it_events          = pt_events
     TABLES
       t_outtab           = t_salida
     EXCEPTIONS
       program_error      = 1
       OTHERS             = 2.
   IF sy-subrc <> 0.
     MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
             WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
   ENDIF.

 

ENDFORM.                    " listado


Viewing all articles
Browse latest Browse all 3523

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>