Skip to Content
author's profile photo Former Member
Former Member

Regarding function Module TRINT_READ_LOG

Hi everybody,

Could u help me on this TRINT_READ_LOG function module.

and provide some coding to write..

Thanks in Advance.

jogu_vinesh@yahoo.com

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Sep 10, 2007 at 12:01 PM

    I am not sure but I believe this function module gives no of lines/tables in table.

    Import parameters are

    IV_LOG_TYPE FILE

    IV_LOGNAME_DB

    IV_LOGNAME_FILE

    IV_TIMESTAMP 00000000000000

    IV_LANGUAGE EN

    IV_CLIENT

    output

    Tables Value

    ET_LINES 0 Entries

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 10, 2007 at 12:04 PM

    WHEN TRLOG_TYPE_FILE.

    IF PV_LOGNAME_FILE = SPACE.

    MESSAGE E314(PU) RAISING INVALID_INPUT.

    ENDIF.

    CALL FUNCTION 'TRINT_READ_LOG'

    EXPORTING

    IV_LOG_TYPE = TRLOG_TYPE_FILE

    IV_LOGNAME_FILE = PV_LOGNAME_FILE

    IV_TIMESTAMP = PV_TIMESTAMP

    IV_CLIENT = PV_CLIENT

    IV_LANGUAGE = PV_LANGUAGE

    TABLES

    ET_LINES = PT_LINES

    EXCEPTIONS

    OTHERS = 1.

    IF SY-SUBRC <> 0.

    CURRENT_MESSAGE_RAISING ACCESS_ERROR.

    ENDIF.

    *----


    read log from database -


    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 10, 2007 at 12:05 PM

    see the below example

    FORM READ_LOG TABLES PT_LINES STRUCTURE TRLOG

    USING PV_LOG_TYPE TYPE TRLOG_TYPE

    PV_LOGNAME_FILE LIKE TSTRF01-FILE

    PV_LOGNAME_DB LIKE DDPRH-PROTNAME

    PV_LOGNAME_MEMORY LIKE TSTRF01-FILENAME

    PV_LANGUAGE LIKE SYST-LANGU

    PV_TIMESTAMP TYPE TSTAMP

    PV_CLIENT TYPE T000-MANDT .

    DATA: LT_LOG LIKE TRLOGM OCCURS 0.

    CASE PV_LOG_TYPE.

    *----


    read log from file -


    WHEN TRLOG_TYPE_FILE.

    IF PV_LOGNAME_FILE = SPACE.

    MESSAGE E314(PU) RAISING INVALID_INPUT.

    ENDIF.

    CALL FUNCTION 'TRINT_READ_LOG'

    EXPORTING

    IV_LOG_TYPE = TRLOG_TYPE_FILE

    IV_LOGNAME_FILE = PV_LOGNAME_FILE

    IV_TIMESTAMP = PV_TIMESTAMP

    IV_CLIENT = PV_CLIENT

    IV_LANGUAGE = PV_LANGUAGE

    TABLES

    ET_LINES = PT_LINES

    EXCEPTIONS

    OTHERS = 1.

    IF SY-SUBRC <> 0.

    CURRENT_MESSAGE_RAISING ACCESS_ERROR.

    ENDIF.

    *----


    read log from database -


    WHEN TRLOG_TYPE_DB.

    IF PV_LOGNAME_DB = SPACE.

    MESSAGE E314(PU) RAISING INVALID_INPUT.

    ENDIF.

    CALL FUNCTION 'TRINT_READ_LOG'

    EXPORTING

    IV_LOG_TYPE = TRLOG_TYPE_DB

    IV_LOGNAME_DB = PV_LOGNAME_DB

    IV_LANGUAGE = PV_LANGUAGE

    TABLES

    ET_LINES = PT_LINES

    EXCEPTIONS

    OTHERS = 1.

    IF SY-SUBRC <> 0.

    CURRENT_MESSAGE_RAISING ACCESS_ERROR.

    ENDIF.

    *----


    read log from database -


    WHEN TRLOG_TYPE_MEMORY.

    IF PV_LOGNAME_MEMORY = SPACE.

    MESSAGE E314(PU) RAISING INVALID_INPUT.

    ENDIF.

    CALL FUNCTION 'TRINT_READ_LOG_FROM_MEMORY'

    EXPORTING

    IV_LOGNAME_MEMORY = PV_LOGNAME_MEMORY

    IV_FREE_MEMORY = ' '

    TABLES

    ET_LOG = LT_LOG

    EXCEPTIONS

    OTHERS = 1.

    IF SY-SUBRC <> 0.

    CURRENT_MESSAGE_RAISING ACCESS_ERROR.

    ENDIF.

    CALL FUNCTION 'TRINT_CONVERT_LOG'

    TABLES

    IT_LOG = LT_LOG

    ET_LINES = PT_LINES.

    *--


    other types are not valid--


    WHEN OTHERS.

    MESSAGE E313(PU) RAISING INVALID_INPUT.

    ENDCASE.

    ENDFORM. " READ_LOG

    &----


    *& Form DISPLAY_LOG

    &----


    FORM DISPLAY_LOG TABLES PT_LINES STRUCTURE TRLOG

    USING PV_TITLEBAR LIKE SY-TITLE

    PV_HEADING LIKE TRLOG-LINE

    PV_DISPLAY_LEVEL LIKE SPROT-LEVEL

    PV_LANGUAGE LIKE SYST-LANGU

    CHANGING

    PV_WITH_LONG_TEXT_ICON LIKE TRPARI-FLAG

    PV_WITH_LINE_NUMBERS LIKE TRPARI-FLAG

    PV_WITH_MESSAGE_NUMBERS LIKE TRPARI-FLAG

    PV_WITH_LEVEL LIKE TRPARI-FLAG

    PV_WITH_REFRESH_ICON LIKE TRPARI-FLAG

    PV_REFRESH LIKE TRPARI-FLAG

    PS_REFRESH_PARAMETERS

    TYPE TRLOG_REFRESH_PARAMETERS.

    CALL FUNCTION 'TRINT_DISPLAY_LOG'

    EXPORTING

    IV_DISPLAY_LEVEL = PV_DISPLAY_LEVEL

    IV_WITH_REFRESH_ICON = PV_WITH_REFRESH_ICON

    IV_TITLEBAR = PV_TITLEBAR

    IV_HEADING1 = PV_HEADING

    IV_HEADING2 = ' '

    IV_LANGUAGE = PV_LANGUAGE

    IMPORTING

    EV_REFRESH = PV_REFRESH

    TABLES

    CT_LINES = PT_LINES

    CHANGING

    CV_WITH_LONG_TEXT_ICON = PV_WITH_LONG_TEXT_ICON

    CV_WITH_LINE_NUMBERS = PV_WITH_LINE_NUMBERS

    CV_WITH_MESSAGE_NUMBERS = PV_WITH_MESSAGE_NUMBERS

    CV_WITH_LEVEL = PV_WITH_LEVEL

    CS_REFRESH_PARAMETERS = PS_REFRESH_PARAMETERS.

    ENDFORM. "DISPLAY_LOG

    ----


    • FORM SET_HEADINGS *

    ----


    FORM SET_HEADINGS USING PV_LOG_TYPE TYPE TRLOG_TYPE

    PV_LOGNAME_FILE

    PV_LOGNAME_DB

    PV_TITLEBAR

    CHANGING PV_HEADING LIKE TRLOG-LINE.

    IF PV_HEADING = SPACE.

    CASE PV_LOG_TYPE.

    WHEN TRLOG_TYPE_FILE.

    PV_HEADING = TEXT-H01.

    PV_HEADING+25 = PV_LOGNAME_FILE.

    WHEN TRLOG_TYPE_DB.

    PV_HEADING = TEXT-H02.

    PV_HEADING+25 = PV_LOGNAME_DB.

    WHEN TRLOG_TYPE_MEMORY.

    PV_HEADING = PV_TITLEBAR.

    ENDCASE.

    ENDIF.

    ENDFORM.

    ----


    • FORM REFRESH_LOG *

    ----


    FORM REFRESH_LOG TABLES PT_LINES STRUCTURE TRLOG

    PT_LINES_OLD STRUCTURE TRLOG.

    DATA: LS_LINE LIKE TRLOG,

    LV_LINES TYPE I,

    LV_LINES_OLD TYPE I,

    LV_START_LINE TYPE I,

    LV_LEVEL LIKE TRLOG-LEVEL.

    • if old table is empty, it is the first loop and there's nothing to do

    DESCRIBE TABLE PT_LINES_OLD LINES LV_LINES_OLD.

    IF LV_LINES_OLD < 1.

    EXIT.

    ENDIF.

    MESSAGE S318(PU). "log was read anew

    DESCRIBE TABLE PT_LINES LINES LV_LINES.

    IF LV_LINES_OLD >= LV_LINES. " log has not become longer

    PT_LINES[] = PT_LINES_OLD[].

    CLEAR: PT_LINES_OLD[].

    EXIT. "nothing more to do

    ENDIF.

    • now the new log is longer than the old one

    • we assume that the old log is identical to the new log up to line

    • lv_lines_old; the layout is still stored in the table pt_lines_old

    PERFORM GET_HIGHEST_VISIBLE_LEVEL_ALL TABLES PT_LINES_OLD

    USING LV_LEVEL.

    LV_START_LINE = LV_LINES_OLD + 1.

    LOOP AT PT_LINES FROM LV_START_LINE

    INTO LS_LINE.

    IF LS_LINE-LEVEL <= LV_LEVEL.

    LS_LINE-INVISIBLE = ' '.

    ELSE.

    LS_LINE-INVISIBLE = 'X'.

    ENDIF.

    APPEND LS_LINE TO PT_LINES_OLD.

    ENDLOOP.

    CLEAR: PT_LINES[].

    PT_LINES[] = PT_LINES_OLD[].

    CLEAR: PT_LINES_OLD[].

    ENDFORM.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.