Skip to Content
avatar image
Former Member

function module to display the programe name , title, linesize..etc

hi Guru's,

My requirement is to create a fuction module for displaying the classical report header and footer.

in header i need Program Name,Program Title ,page no, date , time , user..

Can any one provide me with function module.

cheers,

kumar.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Oct 16, 2008 at 10:32 AM

    hi,

    you can make this type of FM or take help from this...

    CALL FUNCTION 'Z_Z00_STD_HEADER'

    EXPORTING

    line_size = sy-linsz

    listtitle = sy-title

    EXCEPTIONS

    mandt_not_found = 1

    line_size_too_small = 2

    OTHERS = 3.

    IF sy-subrc <> 0.

    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

    ENDIF.

    ENDFORM.

    FUNCTION Z_Z00_STD_HEADER.

    *"----


    ""Local interface:

    *" IMPORTING

    *" REFERENCE(LINE_SIZE) DEFAULT 80

    *" REFERENCE(LISTTITLE) DEFAULT SPACE

    *" REFERENCE(PARAM1) OPTIONAL

    *" REFERENCE(PARAM2) OPTIONAL

    *" EXCEPTIONS

    *" MANDT_NOT_FOUND

    *" LINE_SIZE_TOO_SMALL

    *"----


    data : pos_center1(3) type n,

    pos_center2(3) type n,

    pos_right1(3) type n,

    pos_right2(3) type n,

    tit_len type i.

    • Table to store the client name

    DATA iT000 type T000.

    • Clear Internal Table

    CLEAR it000.

    • Get client name from the T000 table

    SELECT SINGLE MANDT MTEXT INTO iT000 FROM T000

    WHERE MANDT = SY-MANDT.

    IF SY-SUBRC NE 0.

    RAISE MANDT_NOT_FOUND.

    ENDIF.

    if line_size < 75.

    raise line_size_too_small.

    endif.

    • Initialize values of the position counters

    pos_center1 = ( LINE_SIZE / 2 ) - 5.

    pos_right1 = LINE_SIZE - 19.

    pos_right2 = LINE_SIZE - 12.

    tit_len = strlen( listtitle ).

    pos_center2 = ( LINE_SIZE / 2 ) - ( tit_len / 2 ) - 1.

    • Write the standard header

    • First Line

    uline at (line_size).

    • Second Line

    WRITE: /3 text-010, "Report Text

    12 sy-cprog. "PERIASAS on 19/04/2004

    WRITE AT pos_center1 iT000-Mtext.

    WRITE AT pos_right1 text-006 RIGHT-JUSTIFIED. "Date Text

    WRITE AT pos_right2 sy-datum RIGHT-JUSTIFIED.

    • Third Line

    • WRITE: /3 text-009, "Report Owner

    • 10 sy-uname.

    WRITE AT /3 param1. "PERIASAS on 19/04/2004

    WRITE AT pos_center2 listtitle.

    WRITE AT pos_right1 text-007 RIGHT-JUSTIFIED. "Time Text

    WRITE AT pos_right2 sy-uzeit RIGHT-JUSTIFIED.

    • Fourth Line

    WRITE AT /3 param2. "PERIASAS on 19/04/2004

    WRITE AT pos_right1 text-008 RIGHT-JUSTIFIED. "Page Text

    WRITE AT pos_right2 sy-pagno RIGHT-JUSTIFIED.

    • Fifth Line.

    uline at (line_size).

    ENDFUNCTION.

    with regards

    Lokesh

    Edited by: Lokesh Tripathi on Oct 16, 2008 12:32 PM

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 16, 2008 at 06:33 AM

    See system strucutre SYST in se11. You will have there all user and system settings.

    In your program yuo use it as sy-XXX where XXX is a name of component from SYST structure.

    I.ex

    sy-uname "user name
    sy-pagno "page number
    sy-datum "date
    sy-title "program title
    sy-repid "report name
    ...
    

    Add comment
    10|10000 characters needed characters exceeded