[UTIL] Protocole Batch-input avec données du dossier Batch

[UTIL] Protocole Batch-input avec données du dossier Batch

Messagede thoul » 16 Avril 2015, 10:01

Bonjour,

Voici un nouvel utilitaire qui répond à une demande assez fréquente lors de l'utilisation de Batch-input contenant un grand nombre de transactions.
Comment puis-je extraire le contenu du dossier de Batch-input ET le protocole de traitement correspondant dans un fichier pour pouvoir l'analyser hors SAP.

En effet il est facile d'extraire le protocole d'exécution mais celui-ci ne contient alors que le n° de transaction permettant de faire le lien avec les valeurs contenu dans cette transaction.
Le programme standard /SAPDMC/SAP_LSMW_BI_ANALYSIS répond partiellement au besoin mais la présentation du compte-rendu (qui n'est pas sous forme de tableau) ne permet pas de manipuler facilement le résultat.

Il existe également quelques programme spécifiques sur le web qui , soit ne fonctionnaient pas, soit ne répondait pas vraiment à mon besoin.

Voici donc ma variation sur le même thème avec:
-1 écran de sélection qui permet de choisir les zones de valeurs a restituer parmi les zones présentes dans le dossier BatchInput (jusqu'à 5 zones possibles)
-1 restitution au format ALV (type SALV)

La principale évolution serait, selon moi, de rendre la structure de restitution ALV évolutive et de pouvoir effectuer des traitement en arrière plan directement à destination d'un fichier.
De plus, j'utilise ici u
Toutefois, il est à noter que l'ALV avec SALV permet une exécution en arrière plan avec restit dans le spool. Il est donc possible d'aller ensuite lire le spool pour charger celui ci dans un fichier.
Je vous proposerais d'ailleurs prochainement un programme permettant d'exécuter un report avec restitution structuré (sous forme de tableau) et d'en récupérer le résultat sous forme de fichier structuré avec séparateur.

Comme d'habitude, les remarques/retours et autres sont les bienvenus

Code: Tout sélectionner
REPORT z_xxx_display_batch_protocol LINE-SIZE 255.
*----------------------------------------------------------------------*
* Dév.   Date        Description                                       *
*----------------------------------------------------------------------*
* THO    02/04/2015  Création                                          *
*----------------------------------------------------------------------*
*__________DECLARATIONS
*Read plain log from TemSe
INCLUDE rsbdcil3.

TYPES: BEGIN OF ty_apqi,
         groupid TYPE apqi-groupid,
         creator TYPE apqi-creator,
         credate TYPE apqi-credate,
         cretime TYPE apqi-cretime,
         qid TYPE apqi-qid,
       END OF ty_apqi.
TYPES: BEGIN OF ty_ifile,
        trans TYPE apqd-trans,
        tx_state(10) TYPE c,    "transaction state (description)
        p_field1(132) TYPE c,
        p_field2(132) TYPE c,
        p_field3(132) TYPE c,
        p_field4(132) TYPE c,
        p_field5(132) TYPE c,
        type(4) TYPE c,
        text TYPE bdc_mpar,
      END OF ty_ifile.
TYPES: BEGIN OF ty_data,
         groupid TYPE apqi-groupid,
         credate TYPE apqi-credate,
         cretime TYPE apqi-cretime,
         qid TYPE apqi-qid,
         trans TYPE apqd-trans,
         block TYPE apqd-block,
         tcode TYPE tstc-tcode,
         program TYPE bdcdata-program,
         dynpro TYPE bdcdata-dynpro,
         fnam TYPE bdcdata-fnam,
         fval TYPE bdcdata-fval,
       END OF ty_data.

DATA it_apqi TYPE TABLE OF ty_apqi.
DATA st_apqi TYPE ty_apqi.
DATA st_ifile TYPE ty_ifile.
DATA t_data TYPE STANDARD TABLE OF ty_data.

TYPES: BEGIN OF ty_ifields,
        fnam      TYPE bdcdata-fnam,
        fieldtext TYPE dfies-fieldtext,
        intlen    TYPE dd03l-intlen,
        outputlen TYPE dd03l-leng,
      END OF ty_ifields.
DATA t_ifields TYPE TABLE OF ty_ifields.
DATA s_ifields TYPE ty_ifields.
DATA s_t100 TYPE t100.

DATA: t_ifile TYPE TABLE OF ty_ifile.
CONSTANTS c_paramname(11) VALUE 'bdc/logfile'.
CONSTANTS c_digits(10) TYPE c VALUE '0123456789'.
DATA: logname1(80),
      logname(80) VALUE 'D:\usr\sap\DEV\SYS\global\BIS70M000600.LOG',
      ec     TYPE i,
      one    TYPE i VALUE 1,
      parcnt  TYPE i,
      do_condense TYPE c,
      mtvaroff TYPE i,
      x(1) VALUE 'X',
      mparcnt TYPE i,
      mtext(124) TYPE c,
      mtext1(124) TYPE c,
      mtext2(273) TYPE c,
      line_count TYPE i,
      protcnt TYPE i.

TYPES: BEGIN OF ty_mttab,
        off(02) TYPE n,
        len(02) TYPE n,
        text(80) TYPE c,
      END OF ty_mttab.
DATA t_mttab TYPE TABLE OF ty_mttab.
DATA s_mttab TYPE ty_mttab.

DATA: BEGIN OF file.
INCLUDE rstr0112.
DATA: END OF file.

DATA: BEGIN OF par,
        len(02) TYPE n,
        text(80) TYPE c,
      END OF par.

DATA: shiftlen TYPE i VALUE 0,
      protflen TYPE i VALUE 0,
      protfoff TYPE i VALUE 0,
      rlen     TYPE i VALUE 0.

TYPES: BEGIN OF ty_bdcld.
INCLUDE TYPE bdcld.
TYPES: logname(80),
       local_host(12) TYPE c,
       cnt TYPE i,
       active(1) TYPE c,
       temseid TYPE rstsoname.
TYPES: END OF ty_bdcld.
DATA t_bdcld TYPE TABLE OF ty_bdcld.
DATA s_bdcld TYPE ty_bdcld.

DATA t_logtab_temse TYPE TABLE OF apql.

TYPES: BEGIN OF ty_bdclda.
INCLUDE TYPE bdcld.
TYPES: END OF ty_bdclda.
DATA t_bdclda TYPE TABLE OF ty_bdclda.
DATA s_bdclda TYPE ty_bdclda.

DATA: save_mpar TYPE bdc_mpar.
TYPES: BEGIN OF ty_bdclm.
INCLUDE TYPE bdclm.
TYPES:  counter TYPE i,
        longtext TYPE bdc_mpar,
       END OF ty_bdclm.
DATA t_bdclm TYPE TABLE OF ty_bdclm.
DATA s_bdclm TYPE ty_bdclm.

TYPES: BEGIN OF ty_prot_list.
TYPES:  type(10) TYPE c, "Type of entry.
        name(75) TYPE c, "Name of entry. (Possibly truncated.)
        len(8)   TYPE p DECIMALS 0, "Length in bytes.
        owner(8) TYPE c, "Owner of the entry.
        mtime(6) TYPE p DECIMALS 0, "Last modification date. Seconds since 1970.
        mode(9)  TYPE c, "Like "rwx-r-x--x": protection mode.
        useable(1) TYPE c,
        subrc(4) TYPE c,
        errno(3) TYPE c,
        errmsg(40) TYPE c,
        mod_date      TYPE d,
        mod_time(8)   TYPE c,
        seen(1) TYPE c,
        to_be_deleted(1) TYPE c,
        has_changed(1) TYPE c,
        local_host(12) TYPE c,
      END OF ty_prot_list.
DATA t_prot_list TYPE TABLE OF ty_prot_list.
DATA s_prot_list TYPE ty_prot_list.
DATA k TYPE i.
DATA kc(1) TYPE c.
DATA field_txt TYPE fieldname.
DATA p_field_txt TYPE fieldname.
DATA newprot(3) VALUE 'off'.
DATA selected_protocol TYPE i.
DATA w_nb_tx_tot TYPE i. "Nbr of total transactions in BI group
DATA w_nb_tx_rep TYPE i. "Nbr of processed Tx in BI group

DATA: w_tabname TYPE dfies-tabname,
      w_fieldname TYPE dfies-fieldname.
DATA p_qid(20).
DATA r_tx_state TYPE RANGE OF bdcth-state.
DATA gr_content TYPE REF TO cl_salv_form_element.           "#EC NEEDED

FIELD-SYMBOLS: <p_field> TYPE ANY,
               <mtxt> TYPE ANY,
               <vtxt> TYPE ANY,
               <field> TYPE ANY.
CONSTANTS c_ifile_fieldname TYPE fieldname VALUE 'st_ifile-p_field'.
CONSTANTS c_sel_field TYPE fieldname VALUE 'p_field'.
CONSTANTS c_tx_state_ok TYPE bdcth-state VALUE 'F'.  "state value for processed tx in BI group
CONSTANTS c_tx_state_err TYPE bdcth-state VALUE 'E'. "state value for erroneous tx in BI group

*__________ECRAN DE SELECTION
SELECTION-SCREEN BEGIN OF BLOCK qid WITH FRAME TITLE text-001.
*Group Selection
PARAMETERS: p_grpid TYPE apqi-groupid OBLIGATORY.
PARAMETERS: p_date TYPE ty_apqi-credate OBLIGATORY.
SELECT-OPTIONS: so_time FOR st_apqi-cretime OBLIGATORY NO-EXTENSION.
SELECTION-SCREEN SKIP.
PARAMETERS p_tx_err RADIOBUTTON GROUP grp DEFAULT 'X'. "erroneous transactions only
PARAMETERS p_tx_ok RADIOBUTTON GROUP grp.              "processed transactions only
PARAMETERS p_tx_all RADIOBUTTON GROUP grp.             "all transactions
SELECTION-SCREEN END OF BLOCK qid.
SELECTION-SCREEN BEGIN OF BLOCK type WITH FRAME TITLE text-002.
*Messages Selection
SELECT-OPTIONS: so_mart FOR s_bdclm-mart DEFAULT 'E',
                so_mid FOR s_bdclm-mid,
                so_mnr FOR s_bdclm-mnr.
SELECTION-SCREEN END OF BLOCK type.

SELECTION-SCREEN BEGIN OF BLOCK fields WITH FRAME TITLE text-003.
*Field Output Selection
PARAMETERS: p_field1 TYPE bdcdata-fnam,
            p_field2 TYPE bdcdata-fnam,
            p_field3 TYPE bdcdata-fnam,
            p_field4 TYPE bdcdata-fnam,
            p_field5 TYPE bdcdata-fnam.
SELECTION-SCREEN END OF BLOCK fields.

AT SELECTION-SCREEN ON BLOCK qid.
  PERFORM select_single_batch_group USING st_apqi.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_field1.
  PERFORM get_search_help USING 'P_FIELD1'.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_field2.
  PERFORM get_search_help USING 'P_FIELD2'.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_field3.
  PERFORM get_search_help USING 'P_FIELD3'.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_field4.
  PERFORM get_search_help USING 'P_FIELD4'.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_field5.
  PERFORM get_search_help USING 'P_FIELD5'.

AT SELECTION-SCREEN ON BLOCK fields.
  PERFORM check_fields.


START-OF-SELECTION.
  PERFORM edit_protocol USING st_apqi.

END-OF-SELECTION.
  PERFORM create_alv_header USING gr_content.
  PERFORM create_alv_grid.
*&---------------------------------------------------------------------*
*&      Form F_REPLACE_VAR                                             *
*&---------------------------------------------------------------------*
FORM f_replace_var USING vark TYPE char2
                              vari TYPE i
                              varpos TYPE sy-fdpos.
  DATA: var(02),
        var1 TYPE c,
        moff TYPE i.

  CLEAR: s_mttab , moff.
  var = vark.
  SHIFT var BY 1 PLACES.
  CASE var.
    WHEN ' '.
      READ TABLE t_mttab INTO s_mttab INDEX vari.
      IF sy-subrc EQ 0.
        moff = varpos + mtvaroff.
        ASSIGN mtext2+moff(*) TO <mtxt>.
        ASSIGN s_mttab-text(s_mttab-len) TO <vtxt>.
        var1 = vark.
        REPLACE var1 WITH <vtxt>     INTO <mtxt>.
        mtvaroff = s_mttab-len.
      ELSE.
        IF vari GT mparcnt.
          moff = varpos + mtvaroff.
          ASSIGN mtext2+moff(*) TO <mtxt>.
          REPLACE vark WITH '  ' INTO <mtxt>.
          mtvaroff = 2.
        ELSE.
          moff = varpos + mtvaroff.
          ASSIGN mtext2+moff(*) TO <mtxt>.
          REPLACE vark WITH '%%_Z_%%' INTO <mtxt>.
          mtvaroff = 7.
        ENDIF.
      ENDIF.
    WHEN '$'.                          "'&&'
      moff = varpos + mtvaroff.
      ASSIGN mtext2+moff(*) TO <mtxt>.
      REPLACE vark WITH '%%_D_%%' INTO <mtxt>.
      mtvaroff = 7.
    WHEN '&'.
      moff = varpos + mtvaroff.
      ASSIGN mtext2+moff(*) TO <mtxt>.
      REPLACE vark WITH '%%_A_%%' INTO <mtxt>.
      mtvaroff = 7.
    WHEN '<'.
      READ TABLE t_mttab INTO s_mttab INDEX vari.
      IF sy-subrc EQ 0.
        IF vark EQ '&<'.
          moff = varpos + mtvaroff.
          ASSIGN mtext2+moff(*) TO <mtxt>.
          ASSIGN s_mttab-text(s_mttab-len) TO <vtxt>.
          REPLACE '&' WITH <vtxt>     INTO <mtxt>.
          mtvaroff = s_mttab-len.
        ENDIF.
        IF vark EQ '$<'.
          moff = varpos + mtvaroff.
          ASSIGN mtext2+moff(*) TO <mtxt>.
          ASSIGN s_mttab-text(s_mttab-len) TO <vtxt>.
          REPLACE '$' WITH <vtxt>     INTO <mtxt>.
          mtvaroff = s_mttab-len.
        ENDIF.
      ELSE.
        IF vark EQ '&<'.
          moff = varpos + mtvaroff.
          ASSIGN mtext2+moff(*) TO <mtxt>.
          REPLACE '&' WITH ' ' INTO <mtxt>.
          mtvaroff = 1.
        ENDIF.
        IF vark EQ '$<'.
          moff = varpos + mtvaroff.
          ASSIGN mtext2+moff(*) TO <mtxt>.
          REPLACE '$' WITH ' ' INTO <mtxt>.
          mtvaroff = 1.
        ENDIF.
      ENDIF.
    WHEN '1'.
      READ TABLE t_mttab INTO s_mttab INDEX 1.
      IF sy-subrc EQ 0.
        moff = varpos + mtvaroff.
        ASSIGN mtext2+moff(*) TO <mtxt>.
        ASSIGN s_mttab-text(s_mttab-len) TO <vtxt>.
        REPLACE vark WITH <vtxt>     INTO <mtxt>.
        mtvaroff = s_mttab-len.
      ELSE.
        IF vari GT mparcnt.
          moff = varpos + mtvaroff.
          ASSIGN mtext2+moff(*) TO <mtxt>.
          REPLACE vark WITH '  ' INTO <mtxt>.
          mtvaroff = 2.
        ELSE.
          moff = varpos + mtvaroff.
          ASSIGN mtext2+moff(*) TO <mtxt>.
          REPLACE vark WITH '%%_Z_%%' INTO <mtxt>.
          mtvaroff = 7.
        ENDIF.
      ENDIF.
    WHEN '2'.
      READ TABLE t_mttab INTO s_mttab INDEX 2.
      IF sy-subrc EQ 0.
        moff = varpos + mtvaroff.
        ASSIGN mtext2+moff(*) TO <mtxt>.
        ASSIGN s_mttab-text(s_mttab-len) TO <vtxt>.
        REPLACE vark WITH <vtxt>     INTO <mtxt>.
        mtvaroff = s_mttab-len.
      ELSE.
        IF vari GT mparcnt.
          moff = varpos + mtvaroff.
          ASSIGN mtext2+moff(*) TO <mtxt>.
          REPLACE vark WITH '  ' INTO <mtxt>.
          mtvaroff = 2.
        ELSE.
          moff = varpos + mtvaroff.
          ASSIGN mtext2+moff(*) TO <mtxt>.
          REPLACE vark WITH '%%_Z_%%' INTO <mtxt>.
          mtvaroff = 7.
        ENDIF.
      ENDIF.
    WHEN '3'.
      READ TABLE t_mttab INTO s_mttab INDEX 3.
      IF sy-subrc EQ 0.
        moff = varpos + mtvaroff.
        ASSIGN mtext2+moff(*) TO <mtxt>.
        ASSIGN s_mttab-text(s_mttab-len) TO <vtxt>.
        REPLACE vark WITH <vtxt>     INTO <mtxt>.
        mtvaroff = s_mttab-len.
      ELSE.
        IF vari GT mparcnt.
          moff = varpos + mtvaroff.
          ASSIGN mtext2+moff(*) TO <mtxt>.
          REPLACE vark WITH '  ' INTO <mtxt>.
          mtvaroff = 2.
        ELSE.
          moff = varpos + mtvaroff.
          ASSIGN mtext2+moff(*) TO <mtxt>.
          REPLACE vark WITH '%%_Z_%%' INTO <mtxt>.
          mtvaroff = 7.
        ENDIF.
      ENDIF.
    WHEN '4'.
      READ TABLE t_mttab INTO s_mttab INDEX 4.
      IF sy-subrc EQ 0.
        moff = varpos + mtvaroff.
        ASSIGN mtext2+moff(*) TO <mtxt>.
        ASSIGN s_mttab-text(s_mttab-len) TO <vtxt>.
        REPLACE vark WITH <vtxt>     INTO <mtxt>.
        mtvaroff = s_mttab-len.
      ELSE.
        IF vari GT mparcnt.
          moff = varpos + mtvaroff.
          ASSIGN mtext2+moff(*) TO <mtxt>.
          REPLACE vark WITH '  ' INTO <mtxt>.
          mtvaroff = 2.
        ELSE.
          moff = varpos + mtvaroff.
          ASSIGN mtext2+moff(*) TO <mtxt>.
          REPLACE vark WITH '%%_Z_%%' INTO <mtxt>.
          mtvaroff = 7.
        ENDIF.
      ENDIF.
  ENDCASE.
  do_condense = space.
ENDFORM.                               " F_REPLACE_VAR
*&---------------------------------------------------------------------*
*&      Form F_GET_LOGFILE_FOR_QID                                     *
*&---------------------------------------------------------------------*
FORM f_get_logfiles_for_qid.

*Get log from TemSe if it is active
  PERFORM f_get_logfiles_from_temse.
  IF t_bdcld[] IS INITIAL.
    newprot = 'OFF'.
*  Get logs from common log file
    CALL 'C_SAPGPARAM' ID 'NAME'   FIELD c_paramname
                       ID 'VALUE'  FIELD logname.
    PERFORM f_list_protocol_files.
    LOOP AT t_prot_list INTO s_prot_list.
      logname = s_prot_list-name.
      PERFORM f_log_dir.
    ENDLOOP.
  ENDIF.

*Now bdcld contains the log files for the given qid
  SORT t_bdcld BY edate DESCENDING etime DESCENDING.
  DESCRIBE TABLE t_bdcld LINES selected_protocol.
ENDFORM.                    " F_GET_LOGFILES_FOR_QID
*&---------------------------------------------------------------------*
*&      Form F_LOG_DIR                                                 *
*&---------------------------------------------------------------------*
FORM f_log_dir.
  CLEAR s_bdclda. REFRESH t_bdclda.
  CALL 'ReadLogDirA'       ID 'LOGN'  FIELD logname
                           ID 'DTAB'  FIELD s_bdclda-quid
                           ID 'AINF'  FIELD one
                           ID 'ECNT'  FIELD ec.
  IF sy-subrc NE 0 OR ec = 0.
    EXIT.
  ENDIF.
  LOOP AT t_bdclda INTO s_bdclda
                   WHERE lmand = sy-mandt
                     AND quid = p_qid.
    MOVE-CORRESPONDING s_bdclda TO s_bdcld.
    MOVE logname TO s_bdcld-logname.
    MOVE s_prot_list-local_host TO s_bdcld-local_host.
    APPEND s_bdcld TO t_bdcld.
  ENDLOOP.
ENDFORM.                               " F_LOG_DIR.
*&---------------------------------------------------------------------*
*&      Form F_SEARCH_PROT                                             *
*&---------------------------------------------------------------------*
FORM f_search_prot USING prot_files.
  DATA: errcnt(2) TYPE p VALUE 0.

  CALL 'C_DIR_READ_START' ID 'FILE'   FIELD prot_files
   ID 'ERRNO'  FIELD file-errno
   ID 'ERRMSG' FIELD file-errmsg.

  IF sy-subrc <> 0.
    MESSAGE text-e03 TYPE 'E'.
  ENDIF.

  DO.
*Read protocol file
    CLEAR file.
    CALL 'C_DIR_READ_NEXT'
      ID 'TYPE'   FIELD file-type
      ID 'NAME'   FIELD file-name
      ID 'LEN'    FIELD file-len
      ID 'OWNER'  FIELD file-owner
      ID 'MTIME'  FIELD file-mtime
      ID 'MODE'   FIELD file-mode
      ID 'ERRNO'  FIELD file-errno
      ID 'ERRMSG' FIELD file-errmsg.
    MOVE sy-subrc TO    file-subrc.
    CASE sy-subrc.
      WHEN 0.
        CASE file-type(1).
          WHEN 'F'.                    " normal file.
            MOVE 1       TO file-useable.
          WHEN 'f'.                    " normal file.
            MOVE 1       TO file-useable.
          WHEN OTHERS. " Directory, device, fifo, socket,...
            MOVE 0       TO file-useable.
        ENDCASE.
        IF file-len = 0.
          MOVE 0      TO file-useable.
        ENDIF.
      WHEN 1.
        EXIT.
      WHEN OTHERS.                     " SY-SUBRC >= 2
        ADD 1 TO errcnt.
        IF errcnt > 10.
          EXIT.
        ENDIF.
        IF sy-subrc = 5.
          MOVE: '???' TO file-type,
                '???' TO file-owner,
                '???' TO file-mode.
        ENDIF.
        MOVE 0      TO file-useable.
    ENDCASE.

    MOVE-CORRESPONDING file TO s_prot_list.
    SHIFT file-name BY protfoff PLACES.
    MOVE file-name TO s_prot_list-local_host.
    protcnt = protcnt + 1.
    APPEND s_prot_list TO t_prot_list.
  ENDDO.

  CALL 'C_DIR_READ_FINISH'
    ID 'ERRNO'  FIELD file-errno
    ID 'ERRMSG' FIELD file-errmsg.

ENDFORM.                               " F_SEARCH_PROT
*&---------------------------------------------------------------------*
*&      Form F_LIST_PROTOCOL_FILES                                     *
*&---------------------------------------------------------------------*
FORM f_list_protocol_files.
  CLEAR:   logname1, s_prot_list, protcnt.
  REFRESH: t_prot_list.
  protflen = STRLEN( logname ).
  MOVE logname TO logname1.
  WHILE shiftlen LE protflen.
    IF  logname1 CP '#B#I'.          "suchen nach muster #B#I
      IF sy-fdpos EQ 0.                "nur grou00DFbuchstaben
        shiftlen = 2.
      ELSE.
        shiftlen = sy-fdpos.
      ENDIF.
      protfoff = protfoff + shiftlen.
      SHIFT logname1 BY shiftlen PLACES.
    ELSE.
      shiftlen = protflen + 1.
      protfoff = protfoff - 2.
    ENDIF.
  ENDWHILE.
  IF protfoff LE 0.
    protfoff = 0.
  ENDIF.

  rlen = 80 - protfoff.
  WRITE space  TO logname+protfoff(rlen).
  WRITE 'BI* ' TO logname+protfoff(4).
  PERFORM f_search_prot USING logname.

ENDFORM.                    " F_LIST_PROTOCOL_FILES
*&---------------------------------------------------------------------*
*&      Form F_GET_LOGFILES_FROM_TEMSE                                 *
*&---------------------------------------------------------------------*
FORM f_get_logfiles_from_temse.
*are there any logs in the TemSe for this QID ?
  CLEAR t_logtab_temse[].
  CLEAR t_bdcld[].
  SELECT * FROM apql INTO TABLE t_logtab_temse
           WHERE qid = p_qid.
  CHECK sy-subrc = 0.
*some logs were found: now put this info into table bdcld.
  DATA: wa_log TYPE apql,
        wa_ld  TYPE ty_bdcld.
  LOOP AT t_logtab_temse INTO wa_log.
    CLEAR wa_ld.
    wa_ld-temseid = wa_log-temseid.
    wa_ld-lmand   = wa_log-mandant.
    wa_ld-edate   = wa_log-credate.
    wa_ld-etime   = wa_log-cretime.
    wa_ld-luser   = wa_log-creator.
    wa_ld-grpn    = wa_log-groupid.
    wa_ld-quid    = wa_log-qid.
    wa_ld-local_host = wa_log-destsys(8).
    APPEND wa_ld TO t_bdcld.
  ENDLOOP.

ENDFORM.                    " F_GET_LOGFILES_FROM_TEMSE
*&---------------------------------------------------------------------*
*&      Form F_GET_LOG                                                 *
*&---------------------------------------------------------------------*
FORM f_get_log.
  TYPES: BEGIN OF ty_logtable,
          enterdate TYPE btctle-enterdate,
          entertime TYPE btctle-entertime,
          logmessage(352) TYPE c,
        END OF ty_logtable.
  DATA lt_logtable TYPE TABLE OF ty_logtable.
  DATA ls_logtable TYPE ty_logtable.

  DATA: external_date(10),
        internal_date TYPE d.

*_the most recently updated protocol is read.
  CLEAR s_bdcld.
  READ TABLE t_bdcld INTO s_bdcld INDEX 1.
  logname = s_bdcld-logname.
  IF newprot = 'OFF'.
*get logfile contents from common log file
    CALL 'ReadLogPartitionA'     ID 'LOGN'    FIELD logname
                                 ID 'ETAB'    FIELD s_bdclm-mid
                                 ID 'PART'    FIELD s_bdcld
                                 ID 'ECNT'    FIELD ec.
    IF sy-subrc <> 0. MESSAGE s325(00). ENDIF.
    IF ec = 0.        MESSAGE s324(00). ENDIF.
  ELSE.
*get logfile contents from TemSe
    PERFORM read_bdc_log_plain
      TABLES lt_logtable
      USING s_bdcld-temseid
            s_bdcld-lmand.
    IF sy-subrc <> 0.
      MESSAGE s004(ts).
      EXIT.
    ENDIF.
    CLEAR t_bdclm[].
    LOOP AT lt_logtable INTO ls_logtable.
      CALL 'DATE_CONV_INT_TO_EXT'
           ID 'DATINT' FIELD ls_logtable-enterdate
           ID 'DATEXT' FIELD external_date.

      CALL 'DATE_CONV_EXT_TO_INT'
           ID 'DATEXT' FIELD external_date
           ID 'DATINT' FIELD internal_date.
      IF sy-subrc NE 0.
        CONTINUE.
      ENDIF.

      CLEAR s_bdclm.
      s_bdclm-indate  = ls_logtable-enterdate.
      s_bdclm-intime  = ls_logtable-entertime.
      s_bdclm+14(352) = ls_logtable-logmessage.
      APPEND s_bdclm TO t_bdclm.
    ENDLOOP.
  ENDIF.

ENDFORM.                    " F_GET_LOG
*&---------------------------------------------------------------------*
*&      Form F_EXTEND_MESSAGE_TEXTS                                    *
*&---------------------------------------------------------------------*
FORM f_extend_message_texts.
  LOOP AT t_bdclm INTO s_bdclm.
    save_mpar = s_bdclm-mpar.
    PERFORM f_get_text.
    s_bdclm-longtext = mtext.
    s_bdclm-mpar = save_mpar.
    MODIFY t_bdclm FROM s_bdclm.
  ENDLOOP.
ENDFORM.                    " F_EXTEND_MESSAGE_TEXTS
*&---------------------------------------------------------------------*
*&      Form F_GET_TEXT                                                *
*&---------------------------------------------------------------------*
FORM f_get_text.
  DATA: shiftln TYPE i,
        vartcnt TYPE i,
        fdpos LIKE sy-fdpos.

  IF s_bdclm-mparcnt CN c_digits.        "Korrupter Datensatz:
    s_bdclm-mparcnt = 0.               "z.B. Hexnullen
  ENDIF.

  CLEAR s_t100.
  SELECT SINGLE * FROM t100 INTO s_t100
   WHERE sprsl = sy-langu
   AND  arbgb  = s_bdclm-mid
   AND  msgnr  = s_bdclm-mnr.
  IF sy-subrc EQ 0.
    CLEAR: mtext,
           parcnt,
           mparcnt,
           sy-fdpos.
    MOVE s_bdclm-mparcnt TO mparcnt.
    IF s_t100-text CA '$&'.            "Kennung fuer parameter:
      MOVE s_t100-text TO mtext1.      " alt '$' --- neu '&'
    ELSE.
      MOVE s_t100-text TO mtext.
      EXIT.
    ENDIF.

    REFRESH t_mttab.
    CLEAR shiftln.
    DO mparcnt TIMES.
      CLEAR: par, s_mttab.
      MOVE s_bdclm-mpar TO par.
      IF par-len CN c_digits OR par-len EQ 0.     "convert_no_number
        par-len = 1.                              "entschu00E4rfen
      ENDIF.
      WRITE par-text TO s_mttab-text(par-len).
      MOVE par-len  TO s_mttab-len.
      MOVE mparcnt  TO s_mttab-off.
      APPEND s_mttab TO t_mttab.
      shiftln = par-len + 2.
      SHIFT s_bdclm-mpar BY shiftln PLACES.
    ENDDO.

    mtext2 = mtext1.
    IF s_bdclm-mid EQ  '00' AND    " sonderbehandlung s00368
       s_bdclm-mnr EQ '368' AND
       s_bdclm-mart EQ 'S'.
      CLEAR mtext2.
      CLEAR s_mttab.
      READ TABLE t_mttab INTO s_mttab INDEX 1.
      WRITE s_mttab-text TO mtext2+0(s_mttab-len).
      CLEAR s_mttab.
      READ TABLE t_mttab INTO s_mttab INDEX 2.
      WRITE s_mttab-text TO mtext2+35(s_mttab-len).
      mtext = mtext2.
      EXIT.
    ENDIF.

    do_condense = x.
    CLEAR: vartcnt, mtvaroff.
    WHILE vartcnt LE 3.
      vartcnt = vartcnt + 1.
      IF mtext1 CA '$&'.
        parcnt = parcnt + 1.
        IF sy-fdpos GT 0.
          fdpos = sy-fdpos - 1.
        ELSE.
          fdpos = sy-fdpos.
        ENDIF.
        SHIFT mtext1 BY sy-fdpos PLACES.
        IF mtext1(1) EQ '&'.
          SHIFT mtext1 BY 1 PLACES.
          CASE mtext1(1).
            WHEN ' '.
              PERFORM f_replace_var USING '& ' parcnt fdpos.
            WHEN '$'.
              PERFORM f_replace_var USING '&&' 0      fdpos.
            WHEN '1'.
              PERFORM f_replace_var USING '&1' 1      fdpos.
            WHEN '2'.
              PERFORM f_replace_var USING '&2' 2      fdpos.
            WHEN '3'.
              PERFORM f_replace_var USING '&3' 3      fdpos.
            WHEN '4'.
              PERFORM f_replace_var USING '&4' 4      fdpos.
            WHEN OTHERS.
              PERFORM f_replace_var USING '&<' parcnt fdpos.
          ENDCASE.
        ENDIF.

        IF mtext1(1) EQ '$'.
          SHIFT mtext1 BY 1 PLACES.
          CASE mtext1(1).
            WHEN ' '.
              PERFORM f_replace_var USING '$ ' parcnt  fdpos.
            WHEN '$'.
              PERFORM f_replace_var USING '$$' 0       fdpos.
            WHEN '1'.
              PERFORM f_replace_var USING '$1' 1       fdpos.
            WHEN '2'.
              PERFORM f_replace_var USING '$2' 2       fdpos.
            WHEN '3'.
              PERFORM f_replace_var USING '$3' 3       fdpos.
            WHEN '4'.
              PERFORM f_replace_var USING '$4' 4       fdpos.
            WHEN OTHERS.
              PERFORM f_replace_var USING '$<' parcnt  fdpos.
          ENDCASE.
        ENDIF.
      ENDIF.
    ENDWHILE.

    IF mtext2 CA '%%_D_%%'.
      REPLACE '%%_D_%%' WITH '$' INTO mtext2.
    ENDIF.
    IF mtext2 CA '%%_A_%%'.
      REPLACE '%%_A_%%' WITH '&' INTO mtext2.
    ENDIF.
    IF do_condense EQ space.
      mtext = mtext2.
    ELSE.
      CONDENSE mtext2 .
      mtext = mtext2.
    ENDIF.
  ELSE.
    mtext = '???????????????????????????????????????????????????'.
  ENDIF.
ENDFORM.                    " F_GET_TEXT
*&---------------------------------------------------------------------*
*&      Form SELECT_SINGLE_BATCH_GROUP                                 *
*&---------------------------------------------------------------------*
FORM select_single_batch_group USING ps_apqi TYPE ty_apqi.
  DATA lw_lines TYPE i.    "line count

  CLEAR it_apqi[].
  SELECT * FROM apqi INTO CORRESPONDING FIELDS OF TABLE it_apqi
                     WHERE groupid LIKE p_grpid
                       AND credate EQ p_date
                       AND cretime IN so_time.
  DESCRIBE TABLE it_apqi LINES lw_lines.
  IF lw_lines GT 1.
    MESSAGE text-t01 TYPE 'S'.
    SUBMIT (sy-repid).
  ELSEIF lw_lines LT 1.
    MESSAGE text-t02 TYPE 'S'.
    SUBMIT (sy-repid) VIA SELECTION-SCREEN.
  ELSEIF lw_lines EQ 1.
    READ TABLE it_apqi INTO ps_apqi INDEX 1.
  ENDIF.
ENDFORM.                    " SELECT_SINGLE_BATCH_GROUP
*&---------------------------------------------------------------------*
*&      Form CREATE_ALV_GRID                                           *
*&---------------------------------------------------------------------*
*       génération du CR d'exécution au format ALV                     *
*----------------------------------------------------------------------*
FORM create_alv_grid.
  DATA lr_table TYPE REF TO cl_salv_table.
  DATA lr_display TYPE REF TO cl_salv_display_settings.
  DATA lv_title TYPE lvc_title.
  DATA lr_oref TYPE REF TO cx_root.
  DATA lv_text TYPE string.                                 "#EC NEEDED
  DATA lo_columns TYPE REF TO cl_salv_columns_table.
  DATA lr_columns TYPE REF TO cl_salv_columns.
  DATA lt_fieldcatalog TYPE lvc_t_fcat.
  DATA ls_fieldcatalog LIKE LINE OF lt_fieldcatalog.
  DATA lr_aggregations TYPE REF TO cl_salv_aggregations.

  TRY.
      cl_salv_table=>factory(
        IMPORTING
          r_salv_table = lr_table
        CHANGING
          t_table      = t_ifile ).
    CATCH cx_salv_msg INTO lr_oref.                     "#EC NO_HANDLER
      CLEAR lv_text.
      lv_text = lr_oref->get_text( ).
  ENDTRY.

*_set SALV_STANDARD status to ALV grid
  lr_table->set_screen_status(
    pfstatus      =  'SALV_TABLE_STANDARD'
    report        =  'SAPLSALV_METADATA_STATUS'
    set_functions = lr_table->c_functions_all ).

* get aggregation
  lr_aggregations = lr_table->get_aggregations( ).
* get field catalog to set columns designations
  lo_columns = lr_table->get_columns( ).
  lr_columns = lr_table->get_columns( ).
  REFRESH lt_fieldcatalog.
  lt_fieldcatalog = cl_salv_controller_metadata=>get_lvc_fieldcatalog( r_columns = lo_columns
                                                                       r_aggregations = lr_aggregations ).
*_get information of processed table to set columns designations in fieldcat
  LOOP AT lt_fieldcatalog INTO ls_fieldcatalog.
    IF ls_fieldcatalog-fieldname CP 'P_FIELD+'.
      ASSIGN (ls_fieldcatalog-fieldname) TO <p_field>.
      IF sy-subrc IS INITIAL.
        CLEAR s_ifields.
        READ TABLE t_ifields INTO s_ifields WITH KEY fnam = <p_field>.
        IF sy-subrc IS INITIAL.
          ls_fieldcatalog-scrtext_l = s_ifields-fieldtext.
          ls_fieldcatalog-scrtext_m = s_ifields-fieldtext.
          ls_fieldcatalog-scrtext_s = s_ifields-fieldtext.
        ELSE.
          ls_fieldcatalog-scrtext_l = ls_fieldcatalog-fieldname.
          ls_fieldcatalog-scrtext_m = ls_fieldcatalog-fieldname.
          ls_fieldcatalog-scrtext_s = ls_fieldcatalog-fieldname.
        ENDIF.
      ENDIF.
    ELSEIF ls_fieldcatalog-fieldname EQ 'TX_STATE'.
      ls_fieldcatalog-scrtext_l = text-t08.
      ls_fieldcatalog-scrtext_m = text-t08.
      ls_fieldcatalog-scrtext_s = text-t08.
    ELSEIF ls_fieldcatalog-fieldname EQ 'TYPE'.
      ls_fieldcatalog-scrtext_l = text-t03.
      ls_fieldcatalog-scrtext_m = text-t03.
      ls_fieldcatalog-scrtext_s = text-t03.
    ELSEIF ls_fieldcatalog-fieldname EQ 'TEXT'.
      ls_fieldcatalog-scrtext_l = text-t04.
      ls_fieldcatalog-scrtext_m = text-t04.
      ls_fieldcatalog-scrtext_s = text-t04.
    ENDIF.
    MODIFY lt_fieldcatalog FROM ls_fieldcatalog.
    IF <p_field> IS ASSIGNED.
      UNASSIGN <p_field>.
    ENDIF.
  ENDLOOP.

*_set updated Field Catalog
  CALL METHOD cl_salv_controller_metadata=>set_lvc_fieldcatalog
    EXPORTING
      t_fieldcatalog = lt_fieldcatalog
      r_columns      = lo_columns
      r_aggregations = lr_aggregations.

*_set ALV title
  lr_display = lr_table->get_display_settings( ).
  CLEAR lv_title.
  lv_title = text-t06.
  lr_display->set_list_header( lv_title ).
*_optimize columns width
  lr_columns->set_optimize( 'X' ).
*_display ALV header
  lr_table->set_top_of_list( gr_content ).
*_display ALV
  lr_table->display( ).
ENDFORM.                    " CREATE_ALV_GRID
*&---------------------------------------------------------------------*
*&      Form GET_FIELDS                                                *
*&---------------------------------------------------------------------*
FORM get_fields TABLES pt_data LIKE t_data.
  DATA lt_apqd TYPE TABLE OF apqd.
  DATA ls_apqd TYPE apqd.
  DATA lw_qid TYPE apqi-qid.
  DATA ls_bdcmh TYPE bdcmh.
  DATA lw_vardata TYPE apqd-vardata.
  TYPES: BEGIN OF lty_content,
           entry(2000) TYPE c,
         END OF lty_content.
  DATA lw_offset TYPE i.
  DATA lw_rest TYPE i.
  DATA lw_length TYPE i.
  DATA ls_data TYPE ty_data.
  DATA lt_content TYPE TABLE OF lty_content.
  DATA ls_content LIKE LINE OF lt_content.
*  DATA lt_dynpfields TYPE TABLE OF dynpread.
*  DATA ls_dynpfields TYPE dynpread.
*  FIELD-SYMBOLS <dynprofield> TYPE ANY.

*  CLEAR: ls_dynpfields,
*         lt_dynpfields[].
*  ls_dynpfields-fieldname = 'P_GRPID'.
*  APPEND ls_dynpfields TO lt_dynpfields.
*  CALL FUNCTION 'DYNP_VALUES_READ'
*    EXPORTING
*      dyname                               = sy-cprog
*      dynumb                               = sy-dynnr
**     TRANSLATE_TO_UPPER                   = ' '
**     REQUEST                              = ' '
**     PERFORM_CONVERSION_EXITS             = ' '
**     PERFORM_INPUT_CONVERSION             = ' '
**     DETERMINE_LOOP_INDEX                 = ' '
**     START_SEARCH_IN_CURRENT_SCREEN       = ' '
**     START_SEARCH_IN_MAIN_SCREEN          = ' '
**     START_SEARCH_IN_STACKED_SCREEN       = ' '
**     START_SEARCH_ON_SCR_STACKPOS         = ' '
**     SEARCH_OWN_SUBSCREENS_FIRST          = ' '
**     SEARCHPATH_OF_SUBSCREEN_AREAS        = ' '
*    TABLES
*      dynpfields                           = lt_dynpfields
*   EXCEPTIONS
*      invalid_abapworkarea                 = 1
*      invalid_dynprofield                  = 2
*      invalid_dynproname                   = 3
*      invalid_dynpronummer                 = 4
*      invalid_request                      = 5
*      no_fielddescription                  = 6
*      invalid_parameter                    = 7
*      undefind_error                       = 8
*      double_conversion                    = 9
*      stepl_not_found                      = 10
*      OTHERS                               = 11.
*  IF sy-subrc EQ 0.
*    LOOP AT lt_dynpfields INTO ls_dynpfields.
*      ASSIGN (ls_dynpfields-fieldname) TO <dynprofield>.
*      IF sy-subrc IS INITIAL.
*        MOVE ls_dynpfields-fieldvalue TO <dynprofield>.
*      ENDIF.
*    ENDLOOP.
*    IF <dynprofield> IS ASSIGNED.
*      UNASSIGN <dynprofield>.
*    ENDIF.
*
*    CLEAR: ls_dynpfields,
*           lt_dynpfields[].
*    ls_dynpfields-fieldname = 'P_DATE'.
*    APPEND ls_dynpfields TO lt_dynpfields.
*    CALL FUNCTION 'DYNP_VALUES_READ'
*      EXPORTING
*        dyname                               = sy-cprog
*        dynumb                               = sy-dynnr
**       TRANSLATE_TO_UPPER                   = ' '
**       REQUEST                              = ' '
**       PERFORM_CONVERSION_EXITS             = ' '
**       PERFORM_INPUT_CONVERSION             = ' '
**       DETERMINE_LOOP_INDEX                 = ' '
**       START_SEARCH_IN_CURRENT_SCREEN       = ' '
**       START_SEARCH_IN_MAIN_SCREEN          = ' '
**       START_SEARCH_IN_STACKED_SCREEN       = ' '
**       START_SEARCH_ON_SCR_STACKPOS         = ' '
**       SEARCH_OWN_SUBSCREENS_FIRST          = ' '
**       SEARCHPATH_OF_SUBSCREEN_AREAS        = ' '
*      TABLES
*        dynpfields                           = lt_dynpfields
*     EXCEPTIONS
*        invalid_abapworkarea                 = 1
*        invalid_dynprofield                  = 2
*        invalid_dynproname                   = 3
*        invalid_dynpronummer                 = 4
*        invalid_request                      = 5
*        no_fielddescription                  = 6
*        invalid_parameter                    = 7
*        undefind_error                       = 8
*        double_conversion                    = 9
*        stepl_not_found                      = 10
*        OTHERS                               = 11.
*    IF sy-subrc EQ 0.
*      LOOP AT lt_dynpfields INTO ls_dynpfields.
*        ASSIGN (ls_dynpfields-fieldname) TO <dynprofield>.
*        IF sy-subrc IS INITIAL.
*          IF ls_dynpfields-fieldvalue CP './-'.
*            <dynprofield> = ls_dynpfields-fieldvalue.
*          ELSE.
*            CONCATENATE ls_dynpfields-fieldvalue+4(4)
*                        ls_dynpfields-fieldvalue+2(2)
*                        ls_dynpfields-fieldvalue+0(2)
*                        INTO <dynprofield>.
*          ENDIF.
*        ENDIF.
*      ENDLOOP.
*      IF <dynprofield> IS ASSIGNED.
*        UNASSIGN <dynprofield>.
*      ENDIF.
*    ENDIF.
*  ENDIF.
*
*  CLEAR: ls_dynpfields,
*         lt_dynpfields[].
*  ls_dynpfields-fieldname = 'SO_TIME-LOW'.
*  APPEND ls_dynpfields TO lt_dynpfields.
*  ls_dynpfields-fieldname = 'SO_TIME-HIGH'.
*  APPEND ls_dynpfields TO lt_dynpfields.
*  CALL FUNCTION 'DYNP_VALUES_READ'
*    EXPORTING
*      dyname                               = sy-cprog
*      dynumb                               = sy-dynnr
**     TRANSLATE_TO_UPPER                   = ' '
**     REQUEST                              = ' '
**     PERFORM_CONVERSION_EXITS             = ' '
**     PERFORM_INPUT_CONVERSION             = ' '
**     DETERMINE_LOOP_INDEX                 = ' '
**     START_SEARCH_IN_CURRENT_SCREEN       = ' '
**     START_SEARCH_IN_MAIN_SCREEN          = ' '
**     START_SEARCH_IN_STACKED_SCREEN       = ' '
**     START_SEARCH_ON_SCR_STACKPOS         = ' '
**     SEARCH_OWN_SUBSCREENS_FIRST          = ' '
**     SEARCHPATH_OF_SUBSCREEN_AREAS        = ' '
*    TABLES
*      dynpfields                           = lt_dynpfields
*   EXCEPTIONS
*      invalid_abapworkarea                 = 1
*      invalid_dynprofield                  = 2
*      invalid_dynproname                   = 3
*      invalid_dynpronummer                 = 4
*      invalid_request                      = 5
*      no_fielddescription                  = 6
*      invalid_parameter                    = 7
*      undefind_error                       = 8
*      double_conversion                    = 9
*      stepl_not_found                      = 10
*      OTHERS                               = 11.
*  IF sy-subrc EQ 0.
*    LOOP AT lt_dynpfields INTO ls_dynpfields.
*      ASSIGN (ls_dynpfields-fieldname) TO <dynprofield>.
*      IF sy-subrc IS INITIAL.
*        IF ls_dynpfields-fieldvalue CP ':'.
*          MOVE ls_dynpfields-fieldvalue TO <dynprofield>.
*        ELSE.
*          CONCATENATE ls_dynpfields-fieldvalue+0(2)
*                      ls_dynpfields-fieldvalue+2(2)
*                      ls_dynpfields-fieldvalue+4(2)
*                      INTO <dynprofield>.
*        ENDIF.
*      ENDIF.
*    ENDLOOP.
*    IF <dynprofield> IS ASSIGNED.
*      UNASSIGN <dynprofield>.
*    ENDIF.
*  ENDIF.

  PERFORM select_single_batch_group USING st_apqi.

  CLEAR lt_apqd[].
  SELECT qid UP TO 1 ROWS FROM apqi INTO lw_qid
                          WHERE groupid EQ p_grpid
                            AND credate EQ p_date.
  ENDSELECT.
  IF sy-subrc IS INITIAL.
    SELECT * FROM apqd INTO TABLE lt_apqd
                       WHERE qid = lw_qid.
  ENDIF.

  DELETE lt_apqd WHERE vardata+0(1) NE 'M'.
*_we use the first Tx only to gest the field list
  READ TABLE lt_apqd INTO ls_apqd INDEX 1.
  DELETE lt_apqd WHERE trans NE ls_apqd-trans.

  DESCRIBE FIELD ls_bdcmh LENGTH lw_offset IN CHARACTER MODE.

  LOOP AT lt_apqd INTO ls_apqd.
    ls_bdcmh = ls_apqd-vardata.
    ls_data-program = ls_bdcmh-prog.
    ls_data-dynpro = ls_bdcmh-dynr.
    CLEAR lw_vardata.
    lw_length = ls_apqd-varlen - lw_offset.
    IF lw_length > 0.
      lw_vardata = ls_apqd-vardata+lw_offset(lw_length).
      CLEAR lt_content[].
      SPLIT lw_vardata AT ls_bdcmh-sepc INTO TABLE lt_content.
      LOOP AT lt_content INTO ls_content.
        lw_rest = sy-tabix MOD 2.
        IF lw_rest = 1.
          ls_data-fnam = ls_content.
          IF ls_data-fnam = space OR
             ls_data-fnam(4) = 'BDC_'.
          ELSE.
            APPEND ls_data TO pt_data.
          ENDIF.
        ENDIF.
      ENDLOOP.
    ENDIF.
  ENDLOOP.
ENDFORM.                    " GET_FIELDS

*&---------------------------------------------------------------------*
*&      Form EDIT_PROTOCOL                                             *
*&---------------------------------------------------------------------*
FORM edit_protocol USING ps_apqi TYPE ty_apqi.
  DATA ls_bdcmh TYPE bdcmh.
  DATA lt_apqd TYPE TABLE OF apqd.
  DATA ls_apqd TYPE apqd.
  DATA lw_vardata TYPE apqd-vardata.
  TYPES: BEGIN OF ty_data,
           tx_state(10) TYPE c,
           groupid TYPE apqi-groupid,
           credate TYPE apqi-credate,
           cretime TYPE apqi-cretime,
           qid TYPE apqi-qid,
           trans TYPE apqd-trans,
           block TYPE apqd-block,
           tcode TYPE tstc-tcode,
           program TYPE bdcdata-program,
           dynpro TYPE bdcdata-dynpro,
           fnam TYPE bdcdata-fnam,
           fval TYPE bdcdata-fval,
         END OF ty_data.
  DATA lt_data TYPE TABLE OF ty_data.
  DATA ls_data TYPE ty_data.

  DATA lw_offset TYPE i.
  DATA lw_rest TYPE i.
  DATA lw_length TYPE i.
  TYPES: BEGIN OF lty_content,
         entry(2000) TYPE c,
        END OF lty_content.
  DATA lt_content TYPE TABLE OF lty_content.
  DATA ls_content TYPE lty_content.
  DATA ls_tx_state LIKE LINE OF r_tx_state.
  DATA ls_bdcth TYPE bdcth.
  DATA lw_trans TYPE apqd-trans.

*_fill range for transaction states to be selected
  ls_tx_state-sign = 'I'.
  ls_tx_state-option = 'EQ'.
  IF p_tx_err EQ 'X'.
    ls_tx_state-low = c_tx_state_err.
    APPEND ls_tx_state TO r_tx_state.
  ELSEIF p_tx_ok EQ 'X'.
    ls_tx_state-low = c_tx_state_ok.
    APPEND ls_tx_state TO r_tx_state.
  ELSEIF p_tx_all EQ 'X'.
  ENDIF.

  REFRESH: t_bdclm,
           t_prot_list,
           t_ifile[],
           t_ifields,
           t_bdcld.
  k = 0.
  DO 5 TIMES.
    k = k + 1.
    kc = k.
    CONCATENATE 'p_field' kc INTO p_field_txt.
    ASSIGN (p_field_txt) TO <p_field>.
    IF <p_field> = space.
      CONTINUE.
    ENDIF.
    CLEAR s_ifields.
    s_ifields-fnam = <p_field>.
    TRANSLATE s_ifields-fnam TO UPPER CASE.              "#EC TRANSLANG
    SPLIT s_ifields-fnam AT '-' INTO w_tabname w_fieldname.
    SELECT intlen leng UP TO 1 ROWS
             FROM dd03l
             INTO (s_ifields-intlen,s_ifields-outputlen)
            WHERE tabname   = w_tabname
              AND fieldname = w_fieldname.
    ENDSELECT.
    s_ifields-fieldtext = w_fieldname.
    APPEND s_ifields TO t_ifields.
  ENDDO.


  logname = space.
  line_count = 0.
  p_qid = ps_apqi-qid.

  PERFORM f_get_logfiles_for_qid.
  IF selected_protocol > 0.
    PERFORM f_get_log.
    PERFORM f_extend_message_texts.
  ENDIF.
  DELETE t_bdclm WHERE tcnt IS INITIAL OR
                       tcnt EQ 0.

  SELECT * INTO TABLE lt_apqd
                FROM apqd
                WHERE qid = p_qid.
  SORT lt_apqd BY qid trans block.

*_count transactions in Batch input Group
  CLEAR w_nb_tx_tot.
  SELECT MAX( trans ) FROM apqd INTO w_nb_tx_tot
                      WHERE qid EQ p_qid.

  DESCRIBE FIELD ls_bdcmh LENGTH lw_offset IN CHARACTER MODE.
  CLEAR w_nb_tx_rep.
  LOOP AT t_bdclm INTO s_bdclm
                  WHERE mart IN so_mart AND
                        mid  IN so_mid AND
                        mnr  IN so_mnr.
    CLEAR: lt_data[],
           ls_data.
    CLEAR lw_trans.
    LOOP AT lt_apqd INTO ls_apqd
                    WHERE qid = p_qid
                      AND trans = s_bdclm-tcnt.
*_____count processed transactions
      IF lw_trans NE ls_apqd-trans.
        ADD 1 TO w_nb_tx_rep.
        lw_trans = ls_apqd-trans.
      ENDIF.
      CLEAR ls_bdcth.
      IF ls_apqd-vardata+0(1) EQ 'S'.
        ls_bdcth = ls_apqd-vardata.
*_______if transaction doesn't have to be reported
*_______skip to next transaction
        IF NOT ls_bdcth-state IN r_tx_state.
          DELETE lt_apqd WHERE qid EQ ls_apqd-qid
                           AND trans EQ ls_apqd-trans.
          EXIT.
        ELSE.
*__________get transaction state for Report
          IF ls_bdcth-state EQ c_tx_state_err.
            ls_data-tx_state = text-t05.
          ELSEIF ls_bdcth-state EQ c_tx_state_ok.
            ls_data-tx_state = text-t07.
          ENDIF.
        ENDIF.
      ELSEIF ls_apqd-vardata+0(1) EQ 'M'.
*_______only process APQD entries with field values.
        CLEAR lt_content.
        ls_bdcmh = ls_apqd-vardata.
        ls_data-program = ls_bdcmh-prog.
        ls_data-dynpro = ls_bdcmh-dynr.
        ls_data-trans = ls_apqd-trans.
        CLEAR lw_vardata.
        lw_length = ls_apqd-varlen - lw_offset.
        IF lw_length > 0.
          lw_vardata = ls_apqd-vardata+lw_offset(lw_length).
          CLEAR lt_content[].
          SPLIT lw_vardata AT ls_bdcmh-sepc INTO TABLE lt_content.
          LOOP AT lt_content INTO ls_content.
            lw_rest = sy-tabix MOD 2.
            IF lw_rest = 1.
              ls_data-fnam = ls_content.
            ELSE.
              ls_data-fval = ls_content.
              IF ls_data-fnam+0(4) NE 'BDC_'.
                APPEND ls_data TO lt_data.
              ENDIF.
            ENDIF.
          ENDLOOP.
        ENDIF.
      ENDIF.
    ENDLOOP.

    IF NOT lt_data[] IS INITIAL.
      LOOP AT t_ifields INTO s_ifields.
        k = sy-tabix.
        kc = k.
        CONCATENATE c_ifile_fieldname kc INTO field_txt.
        ASSIGN s_ifields-fnam TO <p_field>.
        ASSIGN (field_txt) TO <field>.
        IF <p_field> = space OR NOT <field> IS INITIAL.
          CONTINUE.
        ENDIF.
*      Retrieve content of the field
        LOOP AT lt_data INTO ls_data
                        WHERE fnam EQ <p_field>.
          <field> = ls_data-fval.
        ENDLOOP.
      ENDLOOP.
      st_ifile-trans = ls_data-trans.
      st_ifile-tx_state = ls_data-tx_state.
      st_ifile-text = s_bdclm-longtext.
      st_ifile-type = s_bdclm-mart.
      APPEND st_ifile TO t_ifile.
      ADD 1 TO line_count.
      CLEAR st_ifile.
    ENDIF.
  ENDLOOP.

ENDFORM.                    " EDIT_PROTOCOL2
*&---------------------------------------------------------------------*
*&      Form CHECK_FIELDS                                              *
*&---------------------------------------------------------------------*
FORM check_fields.
  DATA lw_field_empty TYPE i.
  DATA lw_nb TYPE i.
  DATA lw_nb_c(3) TYPE c.
  DATA lw_field TYPE fieldname.
  DATA lw_text TYPE string.

  PERFORM get_fields TABLES t_data.

  DO 5 TIMES.
    ADD 1 TO lw_nb.
    lw_nb_c = lw_nb.
    SHIFT lw_nb_c LEFT DELETING LEADING space.
    CLEAR lw_field.
    CONCATENATE c_sel_field
                lw_nb_c
                INTO lw_field.
    ASSIGN (lw_field) TO <p_field>.
    IF sy-subrc IS INITIAL.
      IF <p_field> IS INITIAL.
        ADD 1  TO lw_field_empty.
      ELSE.
        READ TABLE t_data WITH KEY fnam = <p_field>
                          TRANSPORTING NO FIELDS.
        IF NOT sy-subrc IS INITIAL.
          lw_text = text-e02.
          REPLACE FIRST OCCURRENCE OF '&1' IN lw_text WITH <p_field>.
          REPLACE FIRST OCCURRENCE OF '&2' IN lw_text WITH p_grpid.
          MESSAGE lw_text TYPE 'E'.
        ENDIF.
      ENDIF.
    ELSE.
      EXIT.
    ENDIF.
  ENDDO.
  IF <p_field> IS ASSIGNED.
    UNASSIGN <p_field>.
  ENDIF.

  IF lw_field_empty EQ 5.
    MESSAGE text-e01 TYPE 'E'.
  ENDIF.
ENDFORM.                    " CHECK_FIELDS
*&---------------------------------------------------------------------*
*&      Form GET_SEARCH_HELP                                           *
*&---------------------------------------------------------------------*
FORM get_search_help USING value(p_field) TYPE help_info-dynprofld.
  TYPES: BEGIN OF lty_valeur,
           fnam TYPE bdcdata-fnam,
         END OF lty_valeur.
  DATA ls_data LIKE LINE OF t_data.
  DATA lt_valeur TYPE TABLE OF lty_valeur.
  DATA ls_valeur LIKE LINE OF lt_valeur.
  DATA lt_field TYPE TABLE OF dfies.
  DATA ls_field TYPE dfies.

  CLEAR t_data[].
  PERFORM get_fields TABLES t_data.

  IF NOT t_data[] IS INITIAL.
    LOOP AT t_data INTO ls_data.
      CLEAR ls_valeur.
      ls_valeur-fnam = ls_data-fnam.
      APPEND ls_valeur TO lt_valeur.
    ENDLOOP.
    ls_field-tabname = 'BDCDATA'.
    ls_field-fieldname = 'FNAM'.
    APPEND ls_field TO lt_field.
    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
      EXPORTING
*       DDIC_STRUCTURE         = ' '
        retfield               = 'FNAM'
*       PVALKEY                = ' '
        dynpprog               = sy-repid
        dynpnr                 = sy-dynnr
        dynprofield            = p_field
*       STEPL                  = 0
        window_title           = text-l01
*       VALUE                  = ' '
        value_org              = 'C'
*       MULTIPLE_CHOICE        = ' '
*       DISPLAY                = ' '
*       CALLBACK_PROGRAM       = ' '
*       CALLBACK_FORM          = ' '
*       MARK_TAB               =
*     IMPORTING
*       USER_RESET             =
      TABLES
        value_tab              = lt_valeur
        field_tab              = lt_field
*       return_tab             =
*       DYNPFLD_MAPPING        =
      EXCEPTIONS
        parameter_error        = 1
        no_values_found        = 2
        error_message          = 3.
    IF sy-subrc IS NOT INITIAL.
      MESSAGE text-e04 TYPE 'W'.
    ENDIF.
  ENDIF.
ENDFORM.                    " GET_SEARCH_HELP
*&---------------------------------------------------------------------*
*&      Form CREATE_ALV_HEADER                                         *
*&---------------------------------------------------------------------*
FORM create_alv_header USING cr_content TYPE REF TO cl_salv_form_element.
  DATA lr_grid TYPE REF TO cl_salv_form_layout_grid.
  DATA lr_grid_1 TYPE REF TO cl_salv_form_layout_grid.
  DATA lr_label TYPE REF TO cl_salv_form_label.
  DATA lr_text TYPE REF TO cl_salv_form_text.
  DATA lv_cpt_char(10) TYPE c.
  DATA lv_text TYPE string.

  CREATE OBJECT lr_grid.

  CLEAR lv_text.

  lr_grid_1 = lr_grid->create_grid(
                row    = 4
                column = 1 ).

*_group name
  CLEAR lv_text.
  lv_text = text-t09.
  lr_label = lr_grid_1->create_label(
    row     = 1
    column  = 1
    text    = lv_text
    tooltip = lv_text ).

  CLEAR lv_text.
  lv_text = p_grpid.
  lr_text = lr_grid_1->create_text(
    row     = 1
    column  = 2
    text    = lv_text
    tooltip = lv_text ).

*_Transactions status
  CLEAR lv_text.
  lv_text = text-t10.
  lr_label = lr_grid_1->create_label(
    row     = 2
    column  = 1
    text    = lv_text
    tooltip = lv_text ).

  CLEAR lv_text.
  IF p_tx_err EQ 'X'.
    lv_text = text-t05.
  ELSEIF p_tx_ok EQ 'X'.
    lv_text = text-t07.
  ELSEIF p_tx_all EQ 'X'.
    lv_text = text-t13.
  ENDIF.
  lr_text = lr_grid_1->create_text(
    row     = 2
    column  = 2
    text    = lv_text
    tooltip = lv_text ).

*_nuber of total transactions in group
  CLEAR lv_text.
  lv_text = text-t11.
  lr_label = lr_grid_1->create_label(
    row     = 3
    column  = 1
    text    = lv_text
    tooltip = lv_text ).

  CLEAR lv_cpt_char.
  WRITE w_nb_tx_tot TO lv_cpt_char.

  CLEAR lv_text.
  lv_text = lv_cpt_char.
  lr_text = lr_grid_1->create_text(
    row     = 3
    column  = 2
    text    = lv_text
    tooltip = lv_text ).

*_number of reported transactions
  CLEAR lv_text.
  lv_text = text-t12.
  lr_label = lr_grid_1->create_label(
    row     = 4
    column  = 1
    text    = lv_text
    tooltip = lv_text ).

  CLEAR lv_cpt_char.
  WRITE w_nb_tx_rep TO lv_cpt_char.

  CLEAR lv_text.
  lv_text = lv_cpt_char.
  lr_text = lr_grid_1->create_text(
    row     = 4
    column  = 2
    text    = lv_text
    tooltip = lv_text ).

  lr_label->set_label_for( lr_text ).

  cr_content = lr_grid.

ENDFORM.                    " CREATE_ALV_HEADER
thomas
'si il n'y a pas de solution, c'est qu'il n'y a pas de problème'
Avatar de l’utilisateur
thoul
Posteur confirmé
Posteur confirmé
 
Messages: 62
Inscription: 26 Juillet 2010, 10:56

[UTIL] Protocole Batch-input avec données du dossier Batch

Messagede thoul » 22 Avril 2015, 15:47

Bonjour,

Voici une nouvelle version du programme avec une petite correction de bug sur le compteur du Nombre de transactions ainsi qu'une modification mineure de la constitution de grille ALV avec l'appel direct d'un statut standard (SALV_TABLE_STANDARD du prog SAPLSALV_METADATA_STATUS) plutôt que la création d'un statut copié d'un statut standard et rattaché au programme principale. Conséquence, le code est portable (à l'écart près des symboles de textes) que vous trouverez également joints

Code: Tout sélectionner
REPORT z_XXX_display_batch_protocol LINE-SIZE 255.
*----------------------------------------------------------------------*
* Dév.   Date        Description                                       *
*----------------------------------------------------------------------*
* THO    02/04/2015  Création                                          *
*----------------------------------------------------------------------*
*__________DECLARATIONS
*Read plain log from TemSe
INCLUDE rsbdcil3.

TYPES: BEGIN OF ty_apqi,
         groupid TYPE apqi-groupid,
         creator TYPE apqi-creator,
         credate TYPE apqi-credate,
         cretime TYPE apqi-cretime,
         qid TYPE apqi-qid,
       END OF ty_apqi.
TYPES: BEGIN OF ty_ifile,
        trans TYPE apqd-trans,
        tx_state(10) TYPE c,    "transaction state (description)
        p_field1(132) TYPE c,
        p_field2(132) TYPE c,
        p_field3(132) TYPE c,
        p_field4(132) TYPE c,
        p_field5(132) TYPE c,
        type(4) TYPE c,
        mid TYPE bdclm-mid,
        mnr TYPE bdclm-mnr,
        text TYPE bdc_mpar,
      END OF ty_ifile.
TYPES: BEGIN OF ty_data,
         groupid TYPE apqi-groupid,
         credate TYPE apqi-credate,
         cretime TYPE apqi-cretime,
         qid TYPE apqi-qid,
         trans TYPE apqd-trans,
         block TYPE apqd-block,
         tcode TYPE tstc-tcode,
         program TYPE bdcdata-program,
         dynpro TYPE bdcdata-dynpro,
         fnam TYPE bdcdata-fnam,
         fval TYPE bdcdata-fval,
       END OF ty_data.

DATA it_apqi TYPE TABLE OF ty_apqi.
DATA st_apqi TYPE ty_apqi.
DATA st_ifile TYPE ty_ifile.
DATA t_data TYPE STANDARD TABLE OF ty_data.

TYPES: BEGIN OF ty_ifields,
        fnam      TYPE bdcdata-fnam,
        fieldtext TYPE dfies-fieldtext,
        intlen    TYPE dd03l-intlen,
        outputlen TYPE dd03l-leng,
      END OF ty_ifields.
DATA t_ifields TYPE TABLE OF ty_ifields.
DATA s_ifields TYPE ty_ifields.
DATA s_t100 TYPE t100.

DATA: t_ifile TYPE TABLE OF ty_ifile.
CONSTANTS c_paramname(11) VALUE 'bdc/logfile'.
CONSTANTS c_digits(10) TYPE c VALUE '0123456789'.
DATA: logname1(80),
      logname(80) VALUE 'D:\usr\sap\DEV\SYS\global\BIS70M000600.LOG',
      ec     TYPE i,
      one    TYPE i VALUE 1,
      parcnt  TYPE i,
      do_condense TYPE c,
      mtvaroff TYPE i,
      x(1) VALUE 'X',
      mparcnt TYPE i,
      mtext(124) TYPE c,
      mtext1(124) TYPE c,
      mtext2(273) TYPE c,
      line_count TYPE i,
      protcnt TYPE i.

TYPES: BEGIN OF ty_mttab,
        off(02) TYPE n,
        len(02) TYPE n,
        text(80) TYPE c,
      END OF ty_mttab.
DATA t_mttab TYPE TABLE OF ty_mttab.
DATA s_mttab TYPE ty_mttab.

DATA: BEGIN OF file.
INCLUDE rstr0112.
DATA: END OF file.

DATA: BEGIN OF par,
        len(02) TYPE n,
        text(80) TYPE c,
      END OF par.

DATA: shiftlen TYPE i VALUE 0,
      protflen TYPE i VALUE 0,
      protfoff TYPE i VALUE 0,
      rlen     TYPE i VALUE 0.

TYPES: BEGIN OF ty_bdcld.
INCLUDE TYPE bdcld.
TYPES: logname(80),
       local_host(12) TYPE c,
       cnt TYPE i,
       active(1) TYPE c,
       temseid TYPE rstsoname.
TYPES: END OF ty_bdcld.
DATA t_bdcld TYPE TABLE OF ty_bdcld.
DATA s_bdcld TYPE ty_bdcld.

DATA t_logtab_temse TYPE TABLE OF apql.

TYPES: BEGIN OF ty_bdclda.
INCLUDE TYPE bdcld.
TYPES: END OF ty_bdclda.
DATA t_bdclda TYPE TABLE OF ty_bdclda.
DATA s_bdclda TYPE ty_bdclda.

DATA: save_mpar TYPE bdc_mpar.
TYPES: BEGIN OF ty_bdclm.
INCLUDE TYPE bdclm.
TYPES:  counter TYPE i,
        longtext TYPE bdc_mpar,
       END OF ty_bdclm.
DATA t_bdclm TYPE TABLE OF ty_bdclm.
DATA s_bdclm TYPE ty_bdclm.

TYPES: BEGIN OF ty_prot_list.
TYPES:  type(10) TYPE c, "Type of entry.
        name(75) TYPE c, "Name of entry. (Possibly truncated.)
        len(8)   TYPE p DECIMALS 0, "Length in bytes.
        owner(8) TYPE c, "Owner of the entry.
        mtime(6) TYPE p DECIMALS 0, "Last modification date. Seconds since 1970.
        mode(9)  TYPE c, "Like "rwx-r-x--x": protection mode.
        useable(1) TYPE c,
        subrc(4) TYPE c,
        errno(3) TYPE c,
        errmsg(40) TYPE c,
        mod_date      TYPE d,
        mod_time(8)   TYPE c,
        seen(1) TYPE c,
        to_be_deleted(1) TYPE c,
        has_changed(1) TYPE c,
        local_host(12) TYPE c,
      END OF ty_prot_list.
DATA t_prot_list TYPE TABLE OF ty_prot_list.
DATA s_prot_list TYPE ty_prot_list.
DATA k TYPE i.
DATA kc(1) TYPE c.
DATA field_txt TYPE fieldname.
DATA p_field_txt TYPE fieldname.
DATA newprot(3) VALUE 'off'.
DATA selected_protocol TYPE i.
DATA w_nb_tx_tot TYPE i. "Nbr of total transactions in BI group
DATA w_nb_tx_rep TYPE i. "Nbr of processed Tx in BI group

DATA: w_tabname TYPE dfies-tabname,
      w_fieldname TYPE dfies-fieldname.
DATA p_qid(20).
DATA r_tx_state TYPE RANGE OF bdcth-state.
DATA gr_content TYPE REF TO cl_salv_form_element.           "#EC NEEDED

FIELD-SYMBOLS: <p_field> TYPE ANY,
               <mtxt> TYPE ANY,
               <vtxt> TYPE ANY,
               <field> TYPE ANY.
CONSTANTS c_ifile_fieldname TYPE fieldname VALUE 'st_ifile-p_field'.
CONSTANTS c_sel_field TYPE fieldname VALUE 'p_field'.
CONSTANTS c_tx_state_ok TYPE bdcth-state VALUE 'F'.  "state value for processed tx in BI group
CONSTANTS c_tx_state_err TYPE bdcth-state VALUE 'E'. "state value for erroneous tx in BI group

*__________ECRAN DE SELECTION
SELECTION-SCREEN BEGIN OF BLOCK qid WITH FRAME TITLE text-001.
*Group Selection
PARAMETERS: p_grpid TYPE apqi-groupid OBLIGATORY.
PARAMETERS: p_date TYPE ty_apqi-credate OBLIGATORY.
SELECT-OPTIONS: so_time FOR st_apqi-cretime OBLIGATORY NO-EXTENSION.
SELECTION-SCREEN SKIP.
PARAMETERS p_tx_err RADIOBUTTON GROUP grp DEFAULT 'X'. "erroneous transactions only
PARAMETERS p_tx_ok RADIOBUTTON GROUP grp.              "processed transactions only
PARAMETERS p_tx_all RADIOBUTTON GROUP grp.             "all transactions
SELECTION-SCREEN END OF BLOCK qid.
SELECTION-SCREEN BEGIN OF BLOCK type WITH FRAME TITLE text-002.
*Messages Selection
SELECT-OPTIONS: so_mart FOR s_bdclm-mart DEFAULT 'E',
                so_mid FOR s_bdclm-mid,
                so_mnr FOR s_bdclm-mnr.
SELECTION-SCREEN END OF BLOCK type.

SELECTION-SCREEN BEGIN OF BLOCK fields WITH FRAME TITLE text-003.
*Field Output Selection
PARAMETERS: p_field1 TYPE bdcdata-fnam,
            p_field2 TYPE bdcdata-fnam,
            p_field3 TYPE bdcdata-fnam,
            p_field4 TYPE bdcdata-fnam,
            p_field5 TYPE bdcdata-fnam.
SELECTION-SCREEN END OF BLOCK fields.

AT SELECTION-SCREEN ON BLOCK qid.
  PERFORM select_single_batch_group USING st_apqi.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_field1.
  PERFORM get_search_help USING 'P_FIELD1'.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_field2.
  PERFORM get_search_help USING 'P_FIELD2'.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_field3.
  PERFORM get_search_help USING 'P_FIELD3'.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_field4.
  PERFORM get_search_help USING 'P_FIELD4'.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_field5.
  PERFORM get_search_help USING 'P_FIELD5'.

AT SELECTION-SCREEN ON BLOCK fields.
  PERFORM check_fields.


START-OF-SELECTION.
  PERFORM edit_protocol USING st_apqi.

END-OF-SELECTION.
  PERFORM create_alv_header USING gr_content.
  PERFORM create_alv_grid.
*&---------------------------------------------------------------------*
*&      Form F_REPLACE_VAR                                             *
*&---------------------------------------------------------------------*
FORM f_replace_var USING vark TYPE char2
                              vari TYPE i
                              varpos TYPE sy-fdpos.
  DATA: var(02),
        var1 TYPE c,
        moff TYPE i.

  CLEAR: s_mttab , moff.
  var = vark.
  SHIFT var BY 1 PLACES.
  CASE var.
    WHEN ' '.
      READ TABLE t_mttab INTO s_mttab INDEX vari.
      IF sy-subrc EQ 0.
        moff = varpos + mtvaroff.
        ASSIGN mtext2+moff(*) TO <mtxt>.
        ASSIGN s_mttab-text(s_mttab-len) TO <vtxt>.
        var1 = vark.
        REPLACE var1 WITH <vtxt>     INTO <mtxt>.
        mtvaroff = s_mttab-len.
      ELSE.
        IF vari GT mparcnt.
          moff = varpos + mtvaroff.
          ASSIGN mtext2+moff(*) TO <mtxt>.
          REPLACE vark WITH '  ' INTO <mtxt>.
          mtvaroff = 2.
        ELSE.
          moff = varpos + mtvaroff.
          ASSIGN mtext2+moff(*) TO <mtxt>.
          REPLACE vark WITH '%%_Z_%%' INTO <mtxt>.
          mtvaroff = 7.
        ENDIF.
      ENDIF.
    WHEN '$'.                          "'&&'
      moff = varpos + mtvaroff.
      ASSIGN mtext2+moff(*) TO <mtxt>.
      REPLACE vark WITH '%%_D_%%' INTO <mtxt>.
      mtvaroff = 7.
    WHEN '&'.
      moff = varpos + mtvaroff.
      ASSIGN mtext2+moff(*) TO <mtxt>.
      REPLACE vark WITH '%%_A_%%' INTO <mtxt>.
      mtvaroff = 7.
    WHEN '<'.
      READ TABLE t_mttab INTO s_mttab INDEX vari.
      IF sy-subrc EQ 0.
        IF vark EQ '&<'.
          moff = varpos + mtvaroff.
          ASSIGN mtext2+moff(*) TO <mtxt>.
          ASSIGN s_mttab-text(s_mttab-len) TO <vtxt>.
          REPLACE '&' WITH <vtxt>     INTO <mtxt>.
          mtvaroff = s_mttab-len.
        ENDIF.
        IF vark EQ '$<'.
          moff = varpos + mtvaroff.
          ASSIGN mtext2+moff(*) TO <mtxt>.
          ASSIGN s_mttab-text(s_mttab-len) TO <vtxt>.
          REPLACE '$' WITH <vtxt>     INTO <mtxt>.
          mtvaroff = s_mttab-len.
        ENDIF.
      ELSE.
        IF vark EQ '&<'.
          moff = varpos + mtvaroff.
          ASSIGN mtext2+moff(*) TO <mtxt>.
          REPLACE '&' WITH ' ' INTO <mtxt>.
          mtvaroff = 1.
        ENDIF.
        IF vark EQ '$<'.
          moff = varpos + mtvaroff.
          ASSIGN mtext2+moff(*) TO <mtxt>.
          REPLACE '$' WITH ' ' INTO <mtxt>.
          mtvaroff = 1.
        ENDIF.
      ENDIF.
    WHEN '1'.
      READ TABLE t_mttab INTO s_mttab INDEX 1.
      IF sy-subrc EQ 0.
        moff = varpos + mtvaroff.
        ASSIGN mtext2+moff(*) TO <mtxt>.
        ASSIGN s_mttab-text(s_mttab-len) TO <vtxt>.
        REPLACE vark WITH <vtxt>     INTO <mtxt>.
        mtvaroff = s_mttab-len.
      ELSE.
        IF vari GT mparcnt.
          moff = varpos + mtvaroff.
          ASSIGN mtext2+moff(*) TO <mtxt>.
          REPLACE vark WITH '  ' INTO <mtxt>.
          mtvaroff = 2.
        ELSE.
          moff = varpos + mtvaroff.
          ASSIGN mtext2+moff(*) TO <mtxt>.
          REPLACE vark WITH '%%_Z_%%' INTO <mtxt>.
          mtvaroff = 7.
        ENDIF.
      ENDIF.
    WHEN '2'.
      READ TABLE t_mttab INTO s_mttab INDEX 2.
      IF sy-subrc EQ 0.
        moff = varpos + mtvaroff.
        ASSIGN mtext2+moff(*) TO <mtxt>.
        ASSIGN s_mttab-text(s_mttab-len) TO <vtxt>.
        REPLACE vark WITH <vtxt>     INTO <mtxt>.
        mtvaroff = s_mttab-len.
      ELSE.
        IF vari GT mparcnt.
          moff = varpos + mtvaroff.
          ASSIGN mtext2+moff(*) TO <mtxt>.
          REPLACE vark WITH '  ' INTO <mtxt>.
          mtvaroff = 2.
        ELSE.
          moff = varpos + mtvaroff.
          ASSIGN mtext2+moff(*) TO <mtxt>.
          REPLACE vark WITH '%%_Z_%%' INTO <mtxt>.
          mtvaroff = 7.
        ENDIF.
      ENDIF.
    WHEN '3'.
      READ TABLE t_mttab INTO s_mttab INDEX 3.
      IF sy-subrc EQ 0.
        moff = varpos + mtvaroff.
        ASSIGN mtext2+moff(*) TO <mtxt>.
        ASSIGN s_mttab-text(s_mttab-len) TO <vtxt>.
        REPLACE vark WITH <vtxt>     INTO <mtxt>.
        mtvaroff = s_mttab-len.
      ELSE.
        IF vari GT mparcnt.
          moff = varpos + mtvaroff.
          ASSIGN mtext2+moff(*) TO <mtxt>.
          REPLACE vark WITH '  ' INTO <mtxt>.
          mtvaroff = 2.
        ELSE.
          moff = varpos + mtvaroff.
          ASSIGN mtext2+moff(*) TO <mtxt>.
          REPLACE vark WITH '%%_Z_%%' INTO <mtxt>.
          mtvaroff = 7.
        ENDIF.
      ENDIF.
    WHEN '4'.
      READ TABLE t_mttab INTO s_mttab INDEX 4.
      IF sy-subrc EQ 0.
        moff = varpos + mtvaroff.
        ASSIGN mtext2+moff(*) TO <mtxt>.
        ASSIGN s_mttab-text(s_mttab-len) TO <vtxt>.
        REPLACE vark WITH <vtxt>     INTO <mtxt>.
        mtvaroff = s_mttab-len.
      ELSE.
        IF vari GT mparcnt.
          moff = varpos + mtvaroff.
          ASSIGN mtext2+moff(*) TO <mtxt>.
          REPLACE vark WITH '  ' INTO <mtxt>.
          mtvaroff = 2.
        ELSE.
          moff = varpos + mtvaroff.
          ASSIGN mtext2+moff(*) TO <mtxt>.
          REPLACE vark WITH '%%_Z_%%' INTO <mtxt>.
          mtvaroff = 7.
        ENDIF.
      ENDIF.
  ENDCASE.
  do_condense = space.
ENDFORM.                               " F_REPLACE_VAR
*&---------------------------------------------------------------------*
*&      Form F_GET_LOGFILE_FOR_QID                                     *
*&---------------------------------------------------------------------*
FORM f_get_logfiles_for_qid.

*Get log from TemSe if it is active
  PERFORM f_get_logfiles_from_temse.
  IF t_bdcld[] IS INITIAL.
    newprot = 'OFF'.
*  Get logs from common log file
    CALL 'C_SAPGPARAM' ID 'NAME'   FIELD c_paramname
                       ID 'VALUE'  FIELD logname.
    PERFORM f_list_protocol_files.
    LOOP AT t_prot_list INTO s_prot_list.
      logname = s_prot_list-name.
      PERFORM f_log_dir.
    ENDLOOP.
  ENDIF.

*Now bdcld contains the log files for the given qid
  SORT t_bdcld BY edate DESCENDING etime DESCENDING.
  DESCRIBE TABLE t_bdcld LINES selected_protocol.
ENDFORM.                    " F_GET_LOGFILES_FOR_QID
*&---------------------------------------------------------------------*
*&      Form F_LOG_DIR                                                 *
*&---------------------------------------------------------------------*
FORM f_log_dir.
  CLEAR s_bdclda. REFRESH t_bdclda.
  CALL 'ReadLogDirA'       ID 'LOGN'  FIELD logname
                           ID 'DTAB'  FIELD s_bdclda-quid
                           ID 'AINF'  FIELD one
                           ID 'ECNT'  FIELD ec.
  IF sy-subrc NE 0 OR ec = 0.
    EXIT.
  ENDIF.
  LOOP AT t_bdclda INTO s_bdclda
                   WHERE lmand = sy-mandt
                     AND quid = p_qid.
    MOVE-CORRESPONDING s_bdclda TO s_bdcld.
    MOVE logname TO s_bdcld-logname.
    MOVE s_prot_list-local_host TO s_bdcld-local_host.
    APPEND s_bdcld TO t_bdcld.
  ENDLOOP.
ENDFORM.                               " F_LOG_DIR.
*&---------------------------------------------------------------------*
*&      Form F_SEARCH_PROT                                             *
*&---------------------------------------------------------------------*
FORM f_search_prot USING prot_files.
  DATA: errcnt(2) TYPE p VALUE 0.

  CALL 'C_DIR_READ_START' ID 'FILE'   FIELD prot_files
   ID 'ERRNO'  FIELD file-errno
   ID 'ERRMSG' FIELD file-errmsg.

  IF sy-subrc <> 0.
    MESSAGE text-e03 TYPE 'E'.
  ENDIF.

  DO.
*Read protocol file
    CLEAR file.
    CALL 'C_DIR_READ_NEXT'
      ID 'TYPE'   FIELD file-type
      ID 'NAME'   FIELD file-name
      ID 'LEN'    FIELD file-len
      ID 'OWNER'  FIELD file-owner
      ID 'MTIME'  FIELD file-mtime
      ID 'MODE'   FIELD file-mode
      ID 'ERRNO'  FIELD file-errno
      ID 'ERRMSG' FIELD file-errmsg.
    MOVE sy-subrc TO    file-subrc.
    CASE sy-subrc.
      WHEN 0.
        CASE file-type(1).
          WHEN 'F'.                    " normal file.
            MOVE 1       TO file-useable.
          WHEN 'f'.                    " normal file.
            MOVE 1       TO file-useable.
          WHEN OTHERS. " Directory, device, fifo, socket,...
            MOVE 0       TO file-useable.
        ENDCASE.
        IF file-len = 0.
          MOVE 0      TO file-useable.
        ENDIF.
      WHEN 1.
        EXIT.
      WHEN OTHERS.                     " SY-SUBRC >= 2
        ADD 1 TO errcnt.
        IF errcnt > 10.
          EXIT.
        ENDIF.
        IF sy-subrc = 5.
          MOVE: '???' TO file-type,
                '???' TO file-owner,
                '???' TO file-mode.
        ENDIF.
        MOVE 0      TO file-useable.
    ENDCASE.

    MOVE-CORRESPONDING file TO s_prot_list.
    SHIFT file-name BY protfoff PLACES.
    MOVE file-name TO s_prot_list-local_host.
    protcnt = protcnt + 1.
    APPEND s_prot_list TO t_prot_list.
  ENDDO.

  CALL 'C_DIR_READ_FINISH'
    ID 'ERRNO'  FIELD file-errno
    ID 'ERRMSG' FIELD file-errmsg.

ENDFORM.                               " F_SEARCH_PROT
*&---------------------------------------------------------------------*
*&      Form F_LIST_PROTOCOL_FILES                                     *
*&---------------------------------------------------------------------*
FORM f_list_protocol_files.
  CLEAR:   logname1, s_prot_list, protcnt.
  REFRESH: t_prot_list.
  protflen = STRLEN( logname ).
  MOVE logname TO logname1.
  WHILE shiftlen LE protflen.
    IF  logname1 CP '#B#I'.          "suchen nach muster #B#I
      IF sy-fdpos EQ 0.                "nur grou00DFbuchstaben
        shiftlen = 2.
      ELSE.
        shiftlen = sy-fdpos.
      ENDIF.
      protfoff = protfoff + shiftlen.
      SHIFT logname1 BY shiftlen PLACES.
    ELSE.
      shiftlen = protflen + 1.
      protfoff = protfoff - 2.
    ENDIF.
  ENDWHILE.
  IF protfoff LE 0.
    protfoff = 0.
  ENDIF.

  rlen = 80 - protfoff.
  WRITE space  TO logname+protfoff(rlen).
  WRITE 'BI* ' TO logname+protfoff(4).
  PERFORM f_search_prot USING logname.

ENDFORM.                    " F_LIST_PROTOCOL_FILES
*&---------------------------------------------------------------------*
*&      Form F_GET_LOGFILES_FROM_TEMSE                                 *
*&---------------------------------------------------------------------*
FORM f_get_logfiles_from_temse.
*are there any logs in the TemSe for this QID ?
  CLEAR t_logtab_temse[].
  CLEAR t_bdcld[].
  SELECT * FROM apql INTO TABLE t_logtab_temse
           WHERE qid = p_qid.
  CHECK sy-subrc = 0.
*some logs were found: now put this info into table bdcld.
  DATA: wa_log TYPE apql,
        wa_ld  TYPE ty_bdcld.
  LOOP AT t_logtab_temse INTO wa_log.
    CLEAR wa_ld.
    wa_ld-temseid = wa_log-temseid.
    wa_ld-lmand   = wa_log-mandant.
    wa_ld-edate   = wa_log-credate.
    wa_ld-etime   = wa_log-cretime.
    wa_ld-luser   = wa_log-creator.
    wa_ld-grpn    = wa_log-groupid.
    wa_ld-quid    = wa_log-qid.
    wa_ld-local_host = wa_log-destsys(8).
    APPEND wa_ld TO t_bdcld.
  ENDLOOP.

ENDFORM.                    " F_GET_LOGFILES_FROM_TEMSE
*&---------------------------------------------------------------------*
*&      Form F_GET_LOG                                                 *
*&---------------------------------------------------------------------*
FORM f_get_log.
  TYPES: BEGIN OF ty_logtable,
          enterdate TYPE btctle-enterdate,
          entertime TYPE btctle-entertime,
          logmessage(352) TYPE c,
        END OF ty_logtable.
  DATA lt_logtable TYPE TABLE OF ty_logtable.
  DATA ls_logtable TYPE ty_logtable.

  DATA: external_date(10),
        internal_date TYPE d.

*_the most recently updated protocol is read.
  CLEAR s_bdcld.
  READ TABLE t_bdcld INTO s_bdcld INDEX 1.
  logname = s_bdcld-logname.
  IF newprot = 'OFF'.
*get logfile contents from common log file
    CALL 'ReadLogPartitionA'     ID 'LOGN'    FIELD logname
                                 ID 'ETAB'    FIELD s_bdclm-mid
                                 ID 'PART'    FIELD s_bdcld
                                 ID 'ECNT'    FIELD ec.
    IF sy-subrc <> 0. MESSAGE s325(00). ENDIF.
    IF ec = 0.        MESSAGE s324(00). ENDIF.
  ELSE.
*get logfile contents from TemSe
    PERFORM read_bdc_log_plain
      TABLES lt_logtable
      USING s_bdcld-temseid
            s_bdcld-lmand.
    IF sy-subrc <> 0.
      MESSAGE s004(ts).
      EXIT.
    ENDIF.
    CLEAR t_bdclm[].
    LOOP AT lt_logtable INTO ls_logtable.
      CALL 'DATE_CONV_INT_TO_EXT'
           ID 'DATINT' FIELD ls_logtable-enterdate
           ID 'DATEXT' FIELD external_date.

      CALL 'DATE_CONV_EXT_TO_INT'
           ID 'DATEXT' FIELD external_date
           ID 'DATINT' FIELD internal_date.
      IF sy-subrc NE 0.
        CONTINUE.
      ENDIF.

      CLEAR s_bdclm.
      s_bdclm-indate  = ls_logtable-enterdate.
      s_bdclm-intime  = ls_logtable-entertime.
      s_bdclm+14(352) = ls_logtable-logmessage.
      APPEND s_bdclm TO t_bdclm.
    ENDLOOP.
  ENDIF.

ENDFORM.                    " F_GET_LOG
*&---------------------------------------------------------------------*
*&      Form F_EXTEND_MESSAGE_TEXTS                                    *
*&---------------------------------------------------------------------*
FORM f_extend_message_texts.
  LOOP AT t_bdclm INTO s_bdclm.
    save_mpar = s_bdclm-mpar.
    PERFORM f_get_text.
    s_bdclm-longtext = mtext.
    s_bdclm-mpar = save_mpar.
    MODIFY t_bdclm FROM s_bdclm.
  ENDLOOP.
ENDFORM.                    " F_EXTEND_MESSAGE_TEXTS
*&---------------------------------------------------------------------*
*&      Form F_GET_TEXT                                                *
*&---------------------------------------------------------------------*
FORM f_get_text.
  DATA: shiftln TYPE i,
        vartcnt TYPE i,
        fdpos LIKE sy-fdpos.

  IF s_bdclm-mparcnt CN c_digits.        "Korrupter Datensatz:
    s_bdclm-mparcnt = 0.               "z.B. Hexnullen
  ENDIF.

  CLEAR s_t100.
  SELECT SINGLE * FROM t100 INTO s_t100
   WHERE sprsl = sy-langu
   AND  arbgb  = s_bdclm-mid
   AND  msgnr  = s_bdclm-mnr.
  IF sy-subrc EQ 0.
    CLEAR: mtext,
           parcnt,
           mparcnt,
           sy-fdpos.
    MOVE s_bdclm-mparcnt TO mparcnt.
    IF s_t100-text CA '$&'.            "Kennung fuer parameter:
      MOVE s_t100-text TO mtext1.      " alt '$' --- neu '&'
    ELSE.
      MOVE s_t100-text TO mtext.
      EXIT.
    ENDIF.

    REFRESH t_mttab.
    CLEAR shiftln.
    DO mparcnt TIMES.
      CLEAR: par, s_mttab.
      MOVE s_bdclm-mpar TO par.
      IF par-len CN c_digits OR par-len EQ 0.     "convert_no_number
        par-len = 1.                              "entschu00E4rfen
      ENDIF.
      WRITE par-text TO s_mttab-text(par-len).
      MOVE par-len  TO s_mttab-len.
      MOVE mparcnt  TO s_mttab-off.
      APPEND s_mttab TO t_mttab.
      shiftln = par-len + 2.
      SHIFT s_bdclm-mpar BY shiftln PLACES.
    ENDDO.

    mtext2 = mtext1.
    IF s_bdclm-mid EQ  '00' AND    " sonderbehandlung s00368
       s_bdclm-mnr EQ '368' AND
       s_bdclm-mart EQ 'S'.
      CLEAR mtext2.
      CLEAR s_mttab.
      READ TABLE t_mttab INTO s_mttab INDEX 1.
      WRITE s_mttab-text TO mtext2+0(s_mttab-len).
      CLEAR s_mttab.
      READ TABLE t_mttab INTO s_mttab INDEX 2.
      WRITE s_mttab-text TO mtext2+35(s_mttab-len).
      mtext = mtext2.
      EXIT.
    ENDIF.

    do_condense = x.
    CLEAR: vartcnt, mtvaroff.
    WHILE vartcnt LE 3.
      vartcnt = vartcnt + 1.
      IF mtext1 CA '$&'.
        parcnt = parcnt + 1.
        IF sy-fdpos GT 0.
          fdpos = sy-fdpos - 1.
        ELSE.
          fdpos = sy-fdpos.
        ENDIF.
        SHIFT mtext1 BY sy-fdpos PLACES.
        IF mtext1(1) EQ '&'.
          SHIFT mtext1 BY 1 PLACES.
          CASE mtext1(1).
            WHEN ' '.
              PERFORM f_replace_var USING '& ' parcnt fdpos.
            WHEN '$'.
              PERFORM f_replace_var USING '&&' 0      fdpos.
            WHEN '1'.
              PERFORM f_replace_var USING '&1' 1      fdpos.
            WHEN '2'.
              PERFORM f_replace_var USING '&2' 2      fdpos.
            WHEN '3'.
              PERFORM f_replace_var USING '&3' 3      fdpos.
            WHEN '4'.
              PERFORM f_replace_var USING '&4' 4      fdpos.
            WHEN OTHERS.
              PERFORM f_replace_var USING '&<' parcnt fdpos.
          ENDCASE.
        ENDIF.

        IF mtext1(1) EQ '$'.
          SHIFT mtext1 BY 1 PLACES.
          CASE mtext1(1).
            WHEN ' '.
              PERFORM f_replace_var USING '$ ' parcnt  fdpos.
            WHEN '$'.
              PERFORM f_replace_var USING '$$' 0       fdpos.
            WHEN '1'.
              PERFORM f_replace_var USING '$1' 1       fdpos.
            WHEN '2'.
              PERFORM f_replace_var USING '$2' 2       fdpos.
            WHEN '3'.
              PERFORM f_replace_var USING '$3' 3       fdpos.
            WHEN '4'.
              PERFORM f_replace_var USING '$4' 4       fdpos.
            WHEN OTHERS.
              PERFORM f_replace_var USING '$<' parcnt  fdpos.
          ENDCASE.
        ENDIF.
      ENDIF.
    ENDWHILE.

    IF mtext2 CA '%%_D_%%'.
      REPLACE '%%_D_%%' WITH '$' INTO mtext2.
    ENDIF.
    IF mtext2 CA '%%_A_%%'.
      REPLACE '%%_A_%%' WITH '&' INTO mtext2.
    ENDIF.
    IF do_condense EQ space.
      mtext = mtext2.
    ELSE.
      CONDENSE mtext2 .
      mtext = mtext2.
    ENDIF.
  ELSE.
    mtext = '???????????????????????????????????????????????????'.
  ENDIF.
ENDFORM.                    " F_GET_TEXT
*&---------------------------------------------------------------------*
*&      Form SELECT_SINGLE_BATCH_GROUP                                 *
*&---------------------------------------------------------------------*
FORM select_single_batch_group USING ps_apqi TYPE ty_apqi.
  DATA lw_lines TYPE i.    "line count

  CLEAR it_apqi[].
  SELECT * FROM apqi INTO CORRESPONDING FIELDS OF TABLE it_apqi
                     WHERE groupid LIKE p_grpid
                       AND credate EQ p_date
                       AND cretime IN so_time.
  DESCRIBE TABLE it_apqi LINES lw_lines.
  IF lw_lines GT 1.
    MESSAGE text-t01 TYPE 'S'.
    SUBMIT (sy-repid).
  ELSEIF lw_lines LT 1.
    MESSAGE text-t02 TYPE 'S'.
    SUBMIT (sy-repid) VIA SELECTION-SCREEN.
  ELSEIF lw_lines EQ 1.
    READ TABLE it_apqi INTO ps_apqi INDEX 1.
  ENDIF.
ENDFORM.                    " SELECT_SINGLE_BATCH_GROUP
*&---------------------------------------------------------------------*
*&      Form CREATE_ALV_GRID                                           *
*&---------------------------------------------------------------------*
*       génération du CR d'exécution au format ALV                     *
*----------------------------------------------------------------------*
FORM create_alv_grid.
  DATA lr_table TYPE REF TO cl_salv_table.
  DATA lr_display TYPE REF TO cl_salv_display_settings.
  DATA lv_title TYPE lvc_title.
  DATA lr_oref TYPE REF TO cx_root.
  DATA lv_text TYPE string.                                 "#EC NEEDED
  DATA lo_columns TYPE REF TO cl_salv_columns_table.
  DATA lr_columns TYPE REF TO cl_salv_columns.
  DATA lt_fieldcatalog TYPE lvc_t_fcat.
  DATA ls_fieldcatalog LIKE LINE OF lt_fieldcatalog.
  DATA lr_aggregations TYPE REF TO cl_salv_aggregations.

  TRY.
      cl_salv_table=>factory(
        IMPORTING
          r_salv_table = lr_table
        CHANGING
          t_table      = t_ifile ).
    CATCH cx_salv_msg INTO lr_oref.                     "#EC NO_HANDLER
      CLEAR lv_text.
      lv_text = lr_oref->get_text( ).
  ENDTRY.

*_set SALV_TABLE_STANDARD status to ALV grid
  lr_table->set_screen_status(
    pfstatus      =  'SALV_TABLE_STANDARD'
    report        =  'SAPLSALV_METADATA_STATUS'
    set_functions = lr_table->c_functions_all ).

* get aggregation
  lr_aggregations = lr_table->get_aggregations( ).
* get field catalog to set columns designations
  lo_columns = lr_table->get_columns( ).
  lr_columns = lr_table->get_columns( ).
  REFRESH lt_fieldcatalog.
  lt_fieldcatalog = cl_salv_controller_metadata=>get_lvc_fieldcatalog( r_columns = lo_columns
                                                                       r_aggregations = lr_aggregations ).
*_get information of processed table to set columns designations in fieldcat
  LOOP AT lt_fieldcatalog INTO ls_fieldcatalog.
    IF ls_fieldcatalog-fieldname CP 'P_FIELD+'.
      ASSIGN (ls_fieldcatalog-fieldname) TO <p_field>.
      IF sy-subrc IS INITIAL.
        CLEAR s_ifields.
        READ TABLE t_ifields INTO s_ifields WITH KEY fnam = <p_field>.
        IF sy-subrc IS INITIAL.
          ls_fieldcatalog-scrtext_l = s_ifields-fieldtext.
          ls_fieldcatalog-scrtext_m = s_ifields-fieldtext.
          ls_fieldcatalog-scrtext_s = s_ifields-fieldtext.
        ELSE.
          ls_fieldcatalog-scrtext_l = ls_fieldcatalog-fieldname.
          ls_fieldcatalog-scrtext_m = ls_fieldcatalog-fieldname.
          ls_fieldcatalog-scrtext_s = ls_fieldcatalog-fieldname.
        ENDIF.
      ENDIF.
    ELSEIF ls_fieldcatalog-fieldname EQ 'TX_STATE'.
      ls_fieldcatalog-scrtext_l = text-t08.
      ls_fieldcatalog-scrtext_m = text-t08.
      ls_fieldcatalog-scrtext_s = text-t08.
    ELSEIF ls_fieldcatalog-fieldname EQ 'TYPE'.
      ls_fieldcatalog-scrtext_l = text-t03.
      ls_fieldcatalog-scrtext_m = text-t03.
      ls_fieldcatalog-scrtext_s = text-t03.
    ELSEIF ls_fieldcatalog-fieldname EQ 'TEXT'.
      ls_fieldcatalog-scrtext_l = text-t04.
      ls_fieldcatalog-scrtext_m = text-t04.
      ls_fieldcatalog-scrtext_s = text-t04.
    ENDIF.
    MODIFY lt_fieldcatalog FROM ls_fieldcatalog.
    IF <p_field> IS ASSIGNED.
      UNASSIGN <p_field>.
    ENDIF.
  ENDLOOP.

*_set updated Field Catalog
  CALL METHOD cl_salv_controller_metadata=>set_lvc_fieldcatalog
    EXPORTING
      t_fieldcatalog = lt_fieldcatalog
      r_columns      = lo_columns
      r_aggregations = lr_aggregations.

*_set ALV title
  lr_display = lr_table->get_display_settings( ).
  CLEAR lv_title.
  lv_title = text-t06.
  lr_display->set_list_header( lv_title ).
*_optimize columns width
  lr_columns->set_optimize( 'X' ).
*_display ALV header
  lr_table->set_top_of_list( gr_content ).
*_display ALV
  lr_table->display( ).
ENDFORM.                    " CREATE_ALV_GRID
*&---------------------------------------------------------------------*
*&      Form GET_FIELDS                                                *
*&---------------------------------------------------------------------*
FORM get_fields TABLES pt_data LIKE t_data.
  DATA lt_apqd TYPE TABLE OF apqd.
  DATA ls_apqd TYPE apqd.
  DATA lw_qid TYPE apqi-qid.
  DATA ls_bdcmh TYPE bdcmh.
  DATA lw_vardata TYPE apqd-vardata.
  TYPES: BEGIN OF lty_content,
           entry(2000) TYPE c,
         END OF lty_content.
  DATA lw_offset TYPE i.
  DATA lw_rest TYPE i.
  DATA lw_length TYPE i.
  DATA ls_data TYPE ty_data.
  DATA lt_content TYPE TABLE OF lty_content.
  DATA ls_content LIKE LINE OF lt_content.
*  DATA lt_dynpfields TYPE TABLE OF dynpread.
*  DATA ls_dynpfields TYPE dynpread.
*  FIELD-SYMBOLS <dynprofield> TYPE ANY.

*  CLEAR: ls_dynpfields,
*         lt_dynpfields[].
*  ls_dynpfields-fieldname = 'P_GRPID'.
*  APPEND ls_dynpfields TO lt_dynpfields.
*  CALL FUNCTION 'DYNP_VALUES_READ'
*    EXPORTING
*      dyname                               = sy-cprog
*      dynumb                               = sy-dynnr
**     TRANSLATE_TO_UPPER                   = ' '
**     REQUEST                              = ' '
**     PERFORM_CONVERSION_EXITS             = ' '
**     PERFORM_INPUT_CONVERSION             = ' '
**     DETERMINE_LOOP_INDEX                 = ' '
**     START_SEARCH_IN_CURRENT_SCREEN       = ' '
**     START_SEARCH_IN_MAIN_SCREEN          = ' '
**     START_SEARCH_IN_STACKED_SCREEN       = ' '
**     START_SEARCH_ON_SCR_STACKPOS         = ' '
**     SEARCH_OWN_SUBSCREENS_FIRST          = ' '
**     SEARCHPATH_OF_SUBSCREEN_AREAS        = ' '
*    TABLES
*      dynpfields                           = lt_dynpfields
*   EXCEPTIONS
*      invalid_abapworkarea                 = 1
*      invalid_dynprofield                  = 2
*      invalid_dynproname                   = 3
*      invalid_dynpronummer                 = 4
*      invalid_request                      = 5
*      no_fielddescription                  = 6
*      invalid_parameter                    = 7
*      undefind_error                       = 8
*      double_conversion                    = 9
*      stepl_not_found                      = 10
*      OTHERS                               = 11.
*  IF sy-subrc EQ 0.
*    LOOP AT lt_dynpfields INTO ls_dynpfields.
*      ASSIGN (ls_dynpfields-fieldname) TO <dynprofield>.
*      IF sy-subrc IS INITIAL.
*        MOVE ls_dynpfields-fieldvalue TO <dynprofield>.
*      ENDIF.
*    ENDLOOP.
*    IF <dynprofield> IS ASSIGNED.
*      UNASSIGN <dynprofield>.
*    ENDIF.
*
*    CLEAR: ls_dynpfields,
*           lt_dynpfields[].
*    ls_dynpfields-fieldname = 'P_DATE'.
*    APPEND ls_dynpfields TO lt_dynpfields.
*    CALL FUNCTION 'DYNP_VALUES_READ'
*      EXPORTING
*        dyname                               = sy-cprog
*        dynumb                               = sy-dynnr
**       TRANSLATE_TO_UPPER                   = ' '
**       REQUEST                              = ' '
**       PERFORM_CONVERSION_EXITS             = ' '
**       PERFORM_INPUT_CONVERSION             = ' '
**       DETERMINE_LOOP_INDEX                 = ' '
**       START_SEARCH_IN_CURRENT_SCREEN       = ' '
**       START_SEARCH_IN_MAIN_SCREEN          = ' '
**       START_SEARCH_IN_STACKED_SCREEN       = ' '
**       START_SEARCH_ON_SCR_STACKPOS         = ' '
**       SEARCH_OWN_SUBSCREENS_FIRST          = ' '
**       SEARCHPATH_OF_SUBSCREEN_AREAS        = ' '
*      TABLES
*        dynpfields                           = lt_dynpfields
*     EXCEPTIONS
*        invalid_abapworkarea                 = 1
*        invalid_dynprofield                  = 2
*        invalid_dynproname                   = 3
*        invalid_dynpronummer                 = 4
*        invalid_request                      = 5
*        no_fielddescription                  = 6
*        invalid_parameter                    = 7
*        undefind_error                       = 8
*        double_conversion                    = 9
*        stepl_not_found                      = 10
*        OTHERS                               = 11.
*    IF sy-subrc EQ 0.
*      LOOP AT lt_dynpfields INTO ls_dynpfields.
*        ASSIGN (ls_dynpfields-fieldname) TO <dynprofield>.
*        IF sy-subrc IS INITIAL.
*          IF ls_dynpfields-fieldvalue CP './-'.
*            <dynprofield> = ls_dynpfields-fieldvalue.
*          ELSE.
*            CONCATENATE ls_dynpfields-fieldvalue+4(4)
*                        ls_dynpfields-fieldvalue+2(2)
*                        ls_dynpfields-fieldvalue+0(2)
*                        INTO <dynprofield>.
*          ENDIF.
*        ENDIF.
*      ENDLOOP.
*      IF <dynprofield> IS ASSIGNED.
*        UNASSIGN <dynprofield>.
*      ENDIF.
*    ENDIF.
*  ENDIF.
*
*  CLEAR: ls_dynpfields,
*         lt_dynpfields[].
*  ls_dynpfields-fieldname = 'SO_TIME-LOW'.
*  APPEND ls_dynpfields TO lt_dynpfields.
*  ls_dynpfields-fieldname = 'SO_TIME-HIGH'.
*  APPEND ls_dynpfields TO lt_dynpfields.
*  CALL FUNCTION 'DYNP_VALUES_READ'
*    EXPORTING
*      dyname                               = sy-cprog
*      dynumb                               = sy-dynnr
**     TRANSLATE_TO_UPPER                   = ' '
**     REQUEST                              = ' '
**     PERFORM_CONVERSION_EXITS             = ' '
**     PERFORM_INPUT_CONVERSION             = ' '
**     DETERMINE_LOOP_INDEX                 = ' '
**     START_SEARCH_IN_CURRENT_SCREEN       = ' '
**     START_SEARCH_IN_MAIN_SCREEN          = ' '
**     START_SEARCH_IN_STACKED_SCREEN       = ' '
**     START_SEARCH_ON_SCR_STACKPOS         = ' '
**     SEARCH_OWN_SUBSCREENS_FIRST          = ' '
**     SEARCHPATH_OF_SUBSCREEN_AREAS        = ' '
*    TABLES
*      dynpfields                           = lt_dynpfields
*   EXCEPTIONS
*      invalid_abapworkarea                 = 1
*      invalid_dynprofield                  = 2
*      invalid_dynproname                   = 3
*      invalid_dynpronummer                 = 4
*      invalid_request                      = 5
*      no_fielddescription                  = 6
*      invalid_parameter                    = 7
*      undefind_error                       = 8
*      double_conversion                    = 9
*      stepl_not_found                      = 10
*      OTHERS                               = 11.
*  IF sy-subrc EQ 0.
*    LOOP AT lt_dynpfields INTO ls_dynpfields.
*      ASSIGN (ls_dynpfields-fieldname) TO <dynprofield>.
*      IF sy-subrc IS INITIAL.
*        IF ls_dynpfields-fieldvalue CP ':'.
*          MOVE ls_dynpfields-fieldvalue TO <dynprofield>.
*        ELSE.
*          CONCATENATE ls_dynpfields-fieldvalue+0(2)
*                      ls_dynpfields-fieldvalue+2(2)
*                      ls_dynpfields-fieldvalue+4(2)
*                      INTO <dynprofield>.
*        ENDIF.
*      ENDIF.
*    ENDLOOP.
*    IF <dynprofield> IS ASSIGNED.
*      UNASSIGN <dynprofield>.
*    ENDIF.
*  ENDIF.

  PERFORM select_single_batch_group USING st_apqi.

  CLEAR lt_apqd[].
  SELECT qid UP TO 1 ROWS FROM apqi INTO lw_qid
                          WHERE groupid EQ p_grpid
                            AND credate EQ p_date.
  ENDSELECT.
  IF sy-subrc IS INITIAL.
    SELECT * FROM apqd INTO TABLE lt_apqd
                       WHERE qid = lw_qid.
  ENDIF.

  DELETE lt_apqd WHERE vardata+0(1) NE 'M'.
*_we use the first Tx only to gest the field list
  READ TABLE lt_apqd INTO ls_apqd INDEX 1.
  DELETE lt_apqd WHERE trans NE ls_apqd-trans.

  DESCRIBE FIELD ls_bdcmh LENGTH lw_offset IN CHARACTER MODE.

  LOOP AT lt_apqd INTO ls_apqd.
    ls_bdcmh = ls_apqd-vardata.
    ls_data-program = ls_bdcmh-prog.
    ls_data-dynpro = ls_bdcmh-dynr.
    CLEAR lw_vardata.
    lw_length = ls_apqd-varlen - lw_offset.
    IF lw_length > 0.
      lw_vardata = ls_apqd-vardata+lw_offset(lw_length).
      CLEAR lt_content[].
      SPLIT lw_vardata AT ls_bdcmh-sepc INTO TABLE lt_content.
      LOOP AT lt_content INTO ls_content.
        lw_rest = sy-tabix MOD 2.
        IF lw_rest = 1.
          ls_data-fnam = ls_content.
          IF ls_data-fnam = space OR
             ls_data-fnam(4) = 'BDC_'.
          ELSE.
            APPEND ls_data TO pt_data.
          ENDIF.
        ENDIF.
      ENDLOOP.
    ENDIF.
  ENDLOOP.
ENDFORM.                    " GET_FIELDS

*&---------------------------------------------------------------------*
*&      Form EDIT_PROTOCOL                                             *
*&---------------------------------------------------------------------*
FORM edit_protocol USING ps_apqi TYPE ty_apqi.
  DATA ls_bdcmh TYPE bdcmh.
  DATA lt_apqd TYPE TABLE OF apqd.
  DATA ls_apqd TYPE apqd.
  DATA lw_vardata TYPE apqd-vardata.
  TYPES: BEGIN OF ty_data,
           tx_state(10) TYPE c,
           groupid TYPE apqi-groupid,
           credate TYPE apqi-credate,
           cretime TYPE apqi-cretime,
           qid TYPE apqi-qid,
           trans TYPE apqd-trans,
           block TYPE apqd-block,
           tcode TYPE tstc-tcode,
           program TYPE bdcdata-program,
           dynpro TYPE bdcdata-dynpro,
           fnam TYPE bdcdata-fnam,
           fval TYPE bdcdata-fval,
         END OF ty_data.
  DATA lt_data TYPE TABLE OF ty_data.
  DATA ls_data TYPE ty_data.

  DATA lw_offset TYPE i.
  DATA lw_rest TYPE i.
  DATA lw_length TYPE i.
  TYPES: BEGIN OF lty_content,
         entry(2000) TYPE c,
        END OF lty_content.
  DATA lt_content TYPE TABLE OF lty_content.
  DATA ls_content TYPE lty_content.
  DATA ls_tx_state LIKE LINE OF r_tx_state.
  DATA ls_bdcth TYPE bdcth.
  DATA lw_trans TYPE apqd-trans.

*_fill range for transaction states to be selected
  ls_tx_state-sign = 'I'.
  ls_tx_state-option = 'EQ'.
  IF p_tx_err EQ 'X'.
    ls_tx_state-low = c_tx_state_err.
    APPEND ls_tx_state TO r_tx_state.
  ELSEIF p_tx_ok EQ 'X'.
    ls_tx_state-low = c_tx_state_ok.
    APPEND ls_tx_state TO r_tx_state.
  ELSEIF p_tx_all EQ 'X'.
  ENDIF.

  REFRESH: t_bdclm,
           t_prot_list,
           t_ifile[],
           t_ifields,
           t_bdcld.
  k = 0.
  DO 5 TIMES.
    k = k + 1.
    kc = k.
    CONCATENATE 'p_field' kc INTO p_field_txt.
    ASSIGN (p_field_txt) TO <p_field>.
    IF <p_field> = space.
      CONTINUE.
    ENDIF.
    CLEAR s_ifields.
    s_ifields-fnam = <p_field>.
    TRANSLATE s_ifields-fnam TO UPPER CASE.              "#EC TRANSLANG
    SPLIT s_ifields-fnam AT '-' INTO w_tabname w_fieldname.
    SELECT intlen leng UP TO 1 ROWS
             FROM dd03l
             INTO (s_ifields-intlen,s_ifields-outputlen)
            WHERE tabname   = w_tabname
              AND fieldname = w_fieldname.
    ENDSELECT.
    s_ifields-fieldtext = w_fieldname.
    APPEND s_ifields TO t_ifields.
  ENDDO.


  logname = space.
  line_count = 0.
  p_qid = ps_apqi-qid.

  PERFORM f_get_logfiles_for_qid.
  IF selected_protocol > 0.
    PERFORM f_get_log.
    PERFORM f_extend_message_texts.
  ENDIF.
  DELETE t_bdclm WHERE tcnt IS INITIAL OR
                       tcnt EQ 0.

  SELECT * INTO TABLE lt_apqd
                FROM apqd
                WHERE qid = p_qid.
  SORT lt_apqd BY qid trans block.

*_count transactions in Batch input Group
  CLEAR w_nb_tx_tot.
  SELECT MAX( trans ) FROM apqd INTO w_nb_tx_tot
                      WHERE qid EQ p_qid.

  DESCRIBE FIELD ls_bdcmh LENGTH lw_offset IN CHARACTER MODE.
  CLEAR w_nb_tx_rep.
  CLEAR lw_trans.

  LOOP AT t_bdclm INTO s_bdclm
                  WHERE mart IN so_mart AND
                        mid  IN so_mid AND
                        mnr  IN so_mnr.
    CLEAR: lt_data[],
           ls_data.

    LOOP AT lt_apqd INTO ls_apqd
                    WHERE qid = p_qid
                      AND trans = s_bdclm-tcnt.
*_____count processed transactions
      IF lw_trans NE ls_apqd-trans.
        ADD 1 TO w_nb_tx_rep.
        lw_trans = ls_apqd-trans.
      ENDIF.
      CLEAR ls_bdcth.
      IF ls_apqd-vardata+0(1) EQ 'S'.
        ls_bdcth = ls_apqd-vardata.
*_______if transaction doesn't have to be reported
*_______skip to next transaction
        IF NOT ls_bdcth-state IN r_tx_state.
          DELETE lt_apqd WHERE qid EQ ls_apqd-qid
                           AND trans EQ ls_apqd-trans.
          EXIT.
        ELSE.
*__________get transaction state for Report
          IF ls_bdcth-state EQ c_tx_state_err.
            ls_data-tx_state = text-t05.
          ELSEIF ls_bdcth-state EQ c_tx_state_ok.
            ls_data-tx_state = text-t07.
          ENDIF.
        ENDIF.
      ELSEIF ls_apqd-vardata+0(1) EQ 'M'.
*_______only process APQD entries with field values.
        CLEAR lt_content.
        ls_bdcmh = ls_apqd-vardata.
        ls_data-program = ls_bdcmh-prog.
        ls_data-dynpro = ls_bdcmh-dynr.
        ls_data-trans = ls_apqd-trans.
        CLEAR lw_vardata.
        lw_length = ls_apqd-varlen - lw_offset.
        IF lw_length > 0.
          lw_vardata = ls_apqd-vardata+lw_offset(lw_length).
          CLEAR lt_content[].
          SPLIT lw_vardata AT ls_bdcmh-sepc INTO TABLE lt_content.
          LOOP AT lt_content INTO ls_content.
            lw_rest = sy-tabix MOD 2.
            IF lw_rest = 1.
              ls_data-fnam = ls_content.
            ELSE.
              ls_data-fval = ls_content.
              IF ls_data-fnam+0(4) NE 'BDC_'.
                APPEND ls_data TO lt_data.
              ENDIF.
            ENDIF.
          ENDLOOP.
        ENDIF.
      ENDIF.
    ENDLOOP.

    IF NOT lt_data[] IS INITIAL.
      LOOP AT t_ifields INTO s_ifields.
        k = sy-tabix.
        kc = k.
        CONCATENATE c_ifile_fieldname kc INTO field_txt.
        ASSIGN s_ifields-fnam TO <p_field>.
        ASSIGN (field_txt) TO <field>.
        IF <p_field> = space OR NOT <field> IS INITIAL.
          CONTINUE.
        ENDIF.
*      Retrieve content of the field
        LOOP AT lt_data INTO ls_data
                        WHERE fnam EQ <p_field>.
          <field> = ls_data-fval.
        ENDLOOP.
      ENDLOOP.
      st_ifile-trans = ls_data-trans.
      st_ifile-tx_state = ls_data-tx_state.
      st_ifile-text = s_bdclm-longtext.
      st_ifile-type = s_bdclm-mart.
      st_ifile-mid = s_bdclm-mid.
      st_ifile-mnr = s_bdclm-mnr.
      APPEND st_ifile TO t_ifile.
      ADD 1 TO line_count.
      CLEAR st_ifile.
    ENDIF.
  ENDLOOP.

ENDFORM.                    " EDIT_PROTOCOL2
*&---------------------------------------------------------------------*
*&      Form CHECK_FIELDS                                              *
*&---------------------------------------------------------------------*
FORM check_fields.
  DATA lw_field_empty TYPE i.
  DATA lw_nb TYPE i.
  DATA lw_nb_c(3) TYPE c.
  DATA lw_field TYPE fieldname.
  DATA lw_text TYPE string.

  PERFORM get_fields TABLES t_data.

  DO 5 TIMES.
    ADD 1 TO lw_nb.
    lw_nb_c = lw_nb.
    SHIFT lw_nb_c LEFT DELETING LEADING space.
    CLEAR lw_field.
    CONCATENATE c_sel_field
                lw_nb_c
                INTO lw_field.
    ASSIGN (lw_field) TO <p_field>.
    IF sy-subrc IS INITIAL.
      IF <p_field> IS INITIAL.
        ADD 1  TO lw_field_empty.
      ELSE.
        READ TABLE t_data WITH KEY fnam = <p_field>
                          TRANSPORTING NO FIELDS.
        IF NOT sy-subrc IS INITIAL.
          lw_text = text-e02.
          REPLACE FIRST OCCURRENCE OF '&1' IN lw_text WITH <p_field>.
          REPLACE FIRST OCCURRENCE OF '&2' IN lw_text WITH p_grpid.
          MESSAGE lw_text TYPE 'E'.
        ENDIF.
      ENDIF.
    ELSE.
      EXIT.
    ENDIF.
  ENDDO.
  IF <p_field> IS ASSIGNED.
    UNASSIGN <p_field>.
  ENDIF.

  IF lw_field_empty EQ 5.
    MESSAGE text-e01 TYPE 'E'.
  ENDIF.
ENDFORM.                    " CHECK_FIELDS
*&---------------------------------------------------------------------*
*&      Form GET_SEARCH_HELP                                           *
*&---------------------------------------------------------------------*
FORM get_search_help USING value(p_field) TYPE help_info-dynprofld.
  TYPES: BEGIN OF lty_valeur,
           fnam TYPE bdcdata-fnam,
         END OF lty_valeur.
  DATA ls_data LIKE LINE OF t_data.
  DATA lt_valeur TYPE TABLE OF lty_valeur.
  DATA ls_valeur LIKE LINE OF lt_valeur.
  DATA lt_field TYPE TABLE OF dfies.
  DATA ls_field TYPE dfies.

  CLEAR t_data[].
  PERFORM get_fields TABLES t_data.

  IF NOT t_data[] IS INITIAL.
    LOOP AT t_data INTO ls_data.
      CLEAR ls_valeur.
      ls_valeur-fnam = ls_data-fnam.
      APPEND ls_valeur TO lt_valeur.
    ENDLOOP.
    ls_field-tabname = 'BDCDATA'.
    ls_field-fieldname = 'FNAM'.
    APPEND ls_field TO lt_field.
    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
      EXPORTING
*       DDIC_STRUCTURE         = ' '
        retfield               = 'FNAM'
*       PVALKEY                = ' '
        dynpprog               = sy-repid
        dynpnr                 = sy-dynnr
        dynprofield            = p_field
*       STEPL                  = 0
        window_title           = text-l01
*       VALUE                  = ' '
        value_org              = 'C'
*       MULTIPLE_CHOICE        = ' '
*       DISPLAY                = ' '
*       CALLBACK_PROGRAM       = ' '
*       CALLBACK_FORM          = ' '
*       MARK_TAB               =
*     IMPORTING
*       USER_RESET             =
      TABLES
        value_tab              = lt_valeur
        field_tab              = lt_field
*       return_tab             =
*       DYNPFLD_MAPPING        =
      EXCEPTIONS
        parameter_error        = 1
        no_values_found        = 2
        error_message          = 3.
    IF sy-subrc IS NOT INITIAL.
      MESSAGE text-e04 TYPE 'W'.
    ENDIF.
  ENDIF.
ENDFORM.                    " GET_SEARCH_HELP
*&---------------------------------------------------------------------*
*&      Form CREATE_ALV_HEADER                                         *
*&---------------------------------------------------------------------*
FORM create_alv_header USING cr_content TYPE REF TO cl_salv_form_element.
  DATA lr_grid TYPE REF TO cl_salv_form_layout_grid.
  DATA lr_grid_1 TYPE REF TO cl_salv_form_layout_grid.
  DATA lr_label TYPE REF TO cl_salv_form_label.
  DATA lr_text TYPE REF TO cl_salv_form_text.
  DATA lv_cpt_char(10) TYPE c.
  DATA lv_text TYPE string.

  CREATE OBJECT lr_grid.

  CLEAR lv_text.

  lr_grid_1 = lr_grid->create_grid(
                row    = 4
                column = 1 ).

*_group name
  CLEAR lv_text.
  lv_text = text-t09.
  lr_label = lr_grid_1->create_label(
    row     = 1
    column  = 1
    text    = lv_text
    tooltip = lv_text ).

  CLEAR lv_text.
  lv_text = p_grpid.
  lr_text = lr_grid_1->create_text(
    row     = 1
    column  = 2
    text    = lv_text
    tooltip = lv_text ).

*_Transactions status
  CLEAR lv_text.
  lv_text = text-t10.
  lr_label = lr_grid_1->create_label(
    row     = 2
    column  = 1
    text    = lv_text
    tooltip = lv_text ).

  CLEAR lv_text.
  IF p_tx_err EQ 'X'.
    lv_text = text-t05.
  ELSEIF p_tx_ok EQ 'X'.
    lv_text = text-t07.
  ELSEIF p_tx_all EQ 'X'.
    lv_text = text-t13.
  ENDIF.
  lr_text = lr_grid_1->create_text(
    row     = 2
    column  = 2
    text    = lv_text
    tooltip = lv_text ).

*_nuber of total transactions in group
  CLEAR lv_text.
  lv_text = text-t11.
  lr_label = lr_grid_1->create_label(
    row     = 3
    column  = 1
    text    = lv_text
    tooltip = lv_text ).

  CLEAR lv_cpt_char.
  WRITE w_nb_tx_tot TO lv_cpt_char.

  CLEAR lv_text.
  lv_text = lv_cpt_char.
  lr_text = lr_grid_1->create_text(
    row     = 3
    column  = 2
    text    = lv_text
    tooltip = lv_text ).

*_number of reported transactions
  CLEAR lv_text.
  lv_text = text-t12.
  lr_label = lr_grid_1->create_label(
    row     = 4
    column  = 1
    text    = lv_text
    tooltip = lv_text ).

  CLEAR lv_cpt_char.
  WRITE w_nb_tx_rep TO lv_cpt_char.

  CLEAR lv_text.
  lv_text = lv_cpt_char.
  lr_text = lr_grid_1->create_text(
    row     = 4
    column  = 2
    text    = lv_text
    tooltip = lv_text ).

  lr_label->set_label_for( lr_text ).

  cr_content = lr_grid.

ENDFORM.                    " CREATE_ALV_HEADER

*Symboles de texte
*001   Sélection du dossier de Batch-input
*002   Sélection des informations issues du protocole
*003   Zones de dossier à afficher dans le protocole
*E01   Veuillez renseigner au moins une zone à restituer
*E02   La zone &1 n'existe pas dans le dossier de BI &2
*E03   Erreur à l'appel de la fonction systeme C_DIR_READ_START
*E04   Erreur lors de l'afichage de l'aide à la saisie
*L01   Zones accessibles sur dossier BI
*T01   Il existe plusieurs dossiers sur la période sélectionnée.
*T02   Il n'existe aucun dossier de batch correspondant aux critères de sélection.
*T03   Type de message
*T04   Message
*T05   Erronée
*T06   Protocole Batch-input avec valeurs correspondantes
*T07   Traitée
*T08   Etat de la transaction
*T09   Nom du dossier
*T10   Statut des transactions
*T11   Nombre total de transaction
*T12   Nombre de transactions lues
*T13   Tout statut

*Textes de sélection
*P_DATE   Date de création du dossier
*P_FIELD1   Nom de zone
*P_FIELD2   Nom de zone
*P_FIELD3   Nom de zone
*P_FIELD4   Nom de zone
*P_FIELD5   Nom de zone
*P_GRPID   Nom groupe
*P_TX_ALL   Toutes transactions
*P_TX_ERR   Transactions erronées
*P_TX_OK   Transactions traitées
*SO_MART   Type de message
*SO_MID   Classe de message
*SO_MNR   N° de message
*SO_TIME   Heure de création
thomas
'si il n'y a pas de solution, c'est qu'il n'y a pas de problème'
Avatar de l’utilisateur
thoul
Posteur confirmé
Posteur confirmé
 
Messages: 62
Inscription: 26 Juillet 2010, 10:56


Retourner vers ABAP

Qui est en ligne

Utilisateurs parcourant ce forum: Aucun utilisateur enregistré et 1 invité

cron