Posted: Sat Nov 17, 2007 7:46 pm Post subject: Take information about a BDC session (name, creation date)
Take information about a BDC session (name, creation date and creation time) and print any erroneous transactions.
Code:
REPORT ZUTBDCER.
*----------------------------------------------------------------------*
* Topic: Batch Input Session analyzer *
* *
* Description: The program will take information about a BDC session *
* (name, create date and create time) and it will print *
* out the transactions that were in error. It expands on *
* the ANALYSIS button when you display the log file. *
* *
* It will show you the screen flow and the field contents *
* *
* Implementing: *
* *
* Customizing: None. *
* *
* Change of Check tables. *
* release: *
* *
* SAP Releases:2.2x - 3.0x *
* *
* Programmer: Contribution from Caras Howard [email protected] *
* who has made som modification to abap program from the *
* SAP-R3-LIST with unknown originally creator *
* *
* Date: may 1997 *
* *
* Submitting: By transaction SA38 or by batch job scheduling. *
* *
* Authori- : None *
* zation *
* *
* Sel. options Groupid: *
* Credate: *
* Cretime: *
* *
*-------------------------------Corrections----------------------------*
* Date Userid Correction *
* ??-??-???? ?????? *
*----------------------------------------------------------------------*
TABLES: APQI, APQD, *APQD, DDFTX, D021T.
DATA: SKIP_TRANS LIKE APQD-TRANS,
NO_ERRORS(5) TYPE N,
PROG_NAME LIKE D021T-PROG,
DYNR_NAME LIKE D021T-DYNR,
FLD_NAME(15),
FLD_NAME2(15),
TABLE_NAME(15),
FLD_DESC(40),
FLD_VALUE(38),
LENGTH LIKE SY-FDPOS,
DATA_OFFSET LIKE SY-FDPOS.
DATA: BEGIN OF DELIM,
HEX_# TYPE X VALUE 00,
END OF DELIM.
SELECT-OPTIONS: GROUPID FOR APQI-GROUPID, "Session Name
CREDATE FOR APQI-CREDATE, "Date Created
CRETIME FOR APQI-CRETIME. "Time Created
FIELD-SYMBOLS <F1>.
SELECT * FROM APQI WHERE GROUPID IN GROUPID
AND CREDATE IN CREDATE
AND CRETIME IN CRETIME.
SKIP.
WRITE: / 'SESSION NAME :', APQI-GROUPID.
WRITE: / 'PROCESSING DATE:', APQI-CREDATE.
WRITE: / 'PROCESSING TIME:', APQI-CRETIME.
NO_ERRORS = 'Y'.
SELECT * FROM APQD WHERE QID = APQI-QID
ORDER BY TRANS BLOCK SEGMT MSGCOUNT.
IF APQD-BLOCK = 1.
CLEAR SKIP_TRANS.
IF APQD-VARDATA+1(1) NE 'E'.
SKIP_TRANS = APQD-TRANS.
ELSE.
ADD 1 TO NO_ERRORS.
SKIP.
WRITE:/2 'Error in transaction #', APQD-TRANS.
CHECK 'x' NE 'x'.
ENDIF.
ENDIF.
CHECK SKIP_TRANS NE APQD-TRANS.
PROG_NAME = APQD-VARDATA+6(8).
DYNR_NAME = APQD-VARDATA+14(4).
WRITE:/4 'Program name:', APQD-VARDATA+6(8),
'screen:', APQD-VARDATA+14(4).
SHIFT APQD-VARDATA LEFT BY 20 PLACES.
WHILE SY-SUBRC = 0.
CALL FUNCTION 'STRING_SPLIT'
EXPORTING
DELIMITER = DELIM
STRING = APQD-VARDATA
IMPORTING
HEAD = FLD_NAME
TAIL = APQD-VARDATA
EXCEPTIONS
NOT_FOUND = 01
NOT_VALID = 02
TOO_LONG = 03
TOO_SMALL = 04.
CHECK SY-SUBRC = 0.
PERFORM FIND_FIELD_DESCRIPTION.
CALL FUNCTION 'STRING_SPLIT'
EXPORTING
DELIMITER = DELIM
STRING = APQD-VARDATA
IMPORTING
HEAD = FLD_VALUE
TAIL = APQD-VARDATA
EXCEPTIONS
NOT_FOUND = 01
NOT_VALID = 02
TOO_LONG = 03
TOO_SMALL = 04.
CHECK SY-SUBRC = 0.
IF FLD_NAME = 'BDC_OKCODE'.
FLD_DESC = 'OK CODE'.
ENDIF.
WRITE:/6 'Field name:', FLD_DESC, 'value:', FLD_VALUE,
' (',FLD_NAME,')'.
ENDWHILE.
ENDSELECT.
IF NO_ERRORS IS INITIAL.
WRITE:/ 'No errors'.
ELSE.
SKIP 3.
ULINE.
WRITE:/ 'There were',NO_ERRORS,'errors in this batch.'.
ULINE.
ENDIF.
NEW-PAGE.
ENDSELECT.
*&---------------------------------------------------------------------*
*& Form FIND_FIELD_DESCRIPTION
*&---------------------------------------------------------------------*
FORM FIND_FIELD_DESCRIPTION.
CALL FUNCTION 'STRING_SPLIT'
EXPORTING
DELIMITER = '-'
STRING = FLD_NAME
IMPORTING
HEAD = TABLE_NAME
TAIL = FLD_NAME2
EXCEPTIONS
NOT_FOUND = 01
NOT_VALID = 02
TOO_LONG = 03
TOO_SMALL = 04.
CHECK SY-SUBRC = 0.
CHECK NOT FLD_NAME IS INITIAL.
SELECT SINGLE * FROM DDFTX
WHERE TABNAME = TABLE_NAME
AND FIELDNAME = FLD_NAME2(5)
AND DDLANGUAGE = SY-LANGU.
IF SY-SUBRC = 0.
FLD_DESC = DDFTX-SCRTEXT_L.
IF FLD_DESC IS INITIAL.
SELECT SINGLE * FROM D021T
WHERE PROG = PROG_NAME
AND DYNR = DYNR_NAME
AND LANG = SY-LANGU
AND FLDN = FLD_NAME.
IF SY-SUBRC = 0.
FLD_DESC = D021T-DTXT.
ELSE.
FLD_DESC = 'field name not found'.
ENDIF.
ENDIF.
ENDIF.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG. Every effort is made to ensure content integrity. Use information on this site at your own risk.