Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Header in the output of the program

Former Member
0 Kudos

I have used this code for creating header in the output.

REPORT  ZF7U_PAYMT_PAR
        LINE-SIZE  132
        LINE-COUNT 60
        NO STANDARD PAGE HEADING.

TOP-OF-PAGE.

CALL FUNCTION 'Z_STANDARD_PAGE_HEADER'
       EXPORTING
            COMPANY_CODE = ''
            PAGE_NUMBER  = SY-PAGNO
            REPORT_NAME  = SY-CPROG
            REPORT_TITLE = SY-TITLE
            REPORT_WIDTH = SY-LINSZ
            RUN_DATE     = SY-DATUM
            SUB_TITLE    = 'CALTEX OIL (pty) Limited'
       EXCEPTIONS
            OTHERS       = 1.

But the program name in the output is ZF7U_PAY instead of ZF7U_PAYMT_PAR.

What changes are to be done in the code ?

or Is there any other problem?

17 REPLIES 17

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

In the program menu,check the attribute,program name.

Former Member
0 Kudos

hi,

whats the length of "REPORT_NAME" in funtion.

check whether REPORT_NAME gets full your program name in debugging mode.

Try using sy-repid instead of sy-cprog.

Former Member
0 Kudos

Hi

can u plz check the length of the field "Report_Name" that d FM 'Z_STANDARD_PAGE_HEADER' imports and the length of the sy-cprog system fiels that u r passing to it.

In case of a conflict try using Sy-repid instead of sy-cprog.

Regards

Pankaj

Former Member
0 Kudos

Hi ,

Instead of writing

REPORT_NAME = SY-CPRO

write

REPORT_NAME = SY-REPID

Former Member
0 Kudos

u can just send the program name by using the variable of type sy-repid

for ur reference example.

CALL FUNCTION 'function name'

EXPORTING

comp_txt = ' '

topic_txt =

date_txt = SY-DATUM

page_no_txt = SY-PAGNO

program in the function module.

ULINE (100).

WRITE:/1 SY-VLINE, 15 COMP_TXT INVERSE COLOR 5,100 SY-VLINE.

WRITE:/1 SY-VLINE, 25 TOPIC_TXT INVERSE COLOR 5,100 SY-VLINE.

WRITE:55 'DATE:',62 DATE_TXT INVERSE COLOR 5,100 SY-VLINE.

WRITE:/1 SY-VLINE,55 'PAGE-NO:' ,62 PAGE_NO_TXT INVERSE COLOR 5,100 SY-VLINE.

ULINE (100).

ENDFUNCTION.

regards

vamsi

Former Member
0 Kudos

Hi SHASHANK AMIN ,

Try using REPORT_NAME = sy-repid ,

instead of REPORT_NAME = sy-cprog .

PLZ DO LET ME KNOW ...

Regards ,

Dhera Kamlesh H. R.

0 Kudos

it is the same ,doesnt make any difference.

0 Kudos

hI Shashank ,

Could you please paste the code of the FM 'Z_STANDARD_PAGE_HEADER', along with the data type of its parameters.

Regards

Arun

0 Kudos

FUNCTION Z_STANDARD_PAGE_HEADER.

*"----


""Local interface:

*" IMPORTING

*" REFERENCE(COMPANY_CODE) LIKE T001-BUKRS

*" REFERENCE(PAGE_NUMBER) LIKE SY-PAGNO DEFAULT SY-PAGNO

*" REFERENCE(REPORT_NAME) LIKE SY-CPROG DEFAULT SY-CPROG

*" REFERENCE(REPORT_TITLE) LIKE SY-TITLE DEFAULT SY-TITLE

*" REFERENCE(REPORT_WIDTH) LIKE SY-LINSZ DEFAULT SY-LINSZ

*" REFERENCE(RUN_DATE) LIKE SY-DATUM DEFAULT SY-DATUM

*" REFERENCE(SUB_TITLE) LIKE SY-TITLE OPTIONAL

*" EXPORTING

*" REFERENCE(OTHERS) LIKE SY-SUBRC

*"----


tables: t001,

  • sadr. "img.21nov02

adrc.

  • Working storage

data: center_start like sy-linsz,

right_align like sy-linsz,

title_length like sy-linsz,

avl_text(4) type n,

prt_text(4) type n,

w_sys_descr(15) type c.

  • Get name and address of Company based on Company Code

if t001-bukrs ne company_code.

select single * from t001 where bukrs eq company_code.

endif.

  • if sadr-adrnr ne t001-adrnr. "img.21nov02

  • select single * from sadr where adrnr eq t001-adrnr "img.21nov02

  • and natio eq space. "img.21nov02

if adrc-addrnumber ne t001-adrnr. "img.21nov02

select single * from adrc where addrnumber eq t001-adrnr"img.21nov02

and nation eq space. "img.21nov02

translate adrc-name1 to upper case. "img.21nov02

endif.

  • Calculate center and right positions for the first line

  • title_length = strlen( sadr-name1 ). "img.21nov02

title_length = strlen( adrc-name1 ). "img.21nov02

center_start = ( report_width - title_length ) / 2 + 1.

right_align = report_width - 15.

  • Write the first header line using the positions calculated

write:/ 'Program:', report_name(9).

if not sy-slset is initial. write: 'Var:', sy-slset. endif.

position center_start.

  • write sadr-name1. "img.21nov02

write adrc-name1. "img.21nov02

position right_align.

write: 'Date:',

run_date mm/dd/yyyy.

  • Calculate center and right positions for the second line

title_length = strlen( report_title ).

center_start = ( report_width - title_length ) / 2 + 1.

right_align = report_width - 15.

  • Write the second header line using the positions calculated

if ( w_sys_descr is initial ).

write: sy-sysid to w_sys_descr. " instance

write: '/' to w_sys_descr+10. " /

write: sy-mandt to w_sys_descr+12. " client

condense w_sys_descr.

endif.

write:/ 'System :', w_sys_descr.

  • write: / 'Run by :', sy-uname.

avl_text = report_width - 43.

if title_length > avl_text.

position 22.

prt_text = title_length - avl_text.

  • shift report_title right by prt_text places.

  • condense report_title.

write report_title.

else.

position center_start.

write report_title.

endif.

position right_align.

write: 'Time:', sy-uzeit using edit mask '__:__'.

  • write: 'Run Date :',

  • run_date mm/dd/yyyy.

*

  • Calculate center and right positions for the third line

title_length = strlen( sub_title ).

center_start = ( report_width - title_length ) / 2 + 1.

right_align = report_width - 15.

*

  • Write the second header line using the positions calculated

  • write:/ 'System :', w_sys_descr.

write: / 'Run by :', sy-uname.

if sub_title ne space.

avl_text = report_width - 43.

if title_length > avl_text.

position 22.

prt_text = title_length - avl_text.

  • shift sub_title right by prt_text places.

  • condense sub_title.

write sub_title.

else.

position center_start.

write sub_title.

endif.

endif.

position right_align.

write: 'Page:',

page_number using edit mask 'LL_______'.

  • write: 'Time:', sy-uzeit using edit mask '__:__'.

*

  • Finally, underline the header

uline.

*

ENDFUNCTION.

0 Kudos

Hi Shashank ,

Look at the code <b>'write:/ 'Program:', report_name(9).</b>'.

this is the reason why your program name is being truncated.

Please change it and tell me did you get the desired result.

Regards

Arun

Former Member
0 Kudos

hi,

Instead of using some funtion module use write statement in ur <b>top-of-page</b> event.

position your output with write statement.

eg.

uline.

write: / 20 sy-repid,

65 sy-datum.

......

uline.

Former Member
0 Kudos

Hi Shashank ,

Did you modify the code in the FM.

Reagrds

Arun

0 Kudos

not yet arun.

Former Member
0 Kudos

check the bolded line and change the write statement

FUNCTION Z_STANDARD_PAGE_HEADER.

*"----


""Local interface:

*" IMPORTING

*" REFERENCE(COMPANY_CODE) LIKE T001-BUKRS

*" REFERENCE(PAGE_NUMBER) LIKE SY-PAGNO DEFAULT SY-PAGNO

*" REFERENCE(REPORT_NAME) LIKE SY-CPROG DEFAULT SY-CPROG

*" REFERENCE(REPORT_TITLE) LIKE SY-TITLE DEFAULT SY-TITLE

*" REFERENCE(REPORT_WIDTH) LIKE SY-LINSZ DEFAULT SY-LINSZ

*" REFERENCE(RUN_DATE) LIKE SY-DATUM DEFAULT SY-DATUM

*" REFERENCE(SUB_TITLE) LIKE SY-TITLE OPTIONAL

*" EXPORTING

*" REFERENCE(OTHERS) LIKE SY-SUBRC

*"----


tables: t001,

  • sadr. "img.21nov02

adrc.

  • Working storage

data: center_start like sy-linsz,

right_align like sy-linsz,

title_length like sy-linsz,

avl_text(4) type n,

prt_text(4) type n,

w_sys_descr(15) type c.

  • Get name and address of Company based on Company Code

if t001-bukrs ne company_code.

select single * from t001 where bukrs eq company_code.

endif.

  • if sadr-adrnr ne t001-adrnr. "img.21nov02

  • select single * from sadr where adrnr eq t001-adrnr "img.21nov02

  • and natio eq space. "img.21nov02

if adrc-addrnumber ne t001-adrnr. "img.21nov02

select single * from adrc where addrnumber eq t001-adrnr"img.21nov02

and nation eq space. "img.21nov02

translate adrc-name1 to upper case. "img.21nov02

endif.

  • Calculate center and right positions for the first line

  • title_length = strlen( sadr-name1 ). "img.21nov02

title_length = strlen( adrc-name1 ). "img.21nov02

center_start = ( report_width - title_length ) / 2 + 1.

right_align = report_width - 15.

  • Write the first header line using the positions calculated

<b>write:/ 'Program:', report_name(9).</b>

<b>* replace this with

write:/ 'Program:', report_name.

  • </b>

if not sy-slset is initial. write: 'Var:', sy-slset. endif.

position center_start.

  • write sadr-name1. "img.21nov02

write adrc-name1. "img.21nov02

position right_align.

write: 'Date:',

run_date mm/dd/yyyy.

  • Calculate center and right positions for the second line

title_length = strlen( report_title ).

center_start = ( report_width - title_length ) / 2 + 1.

right_align = report_width - 15.

  • Write the second header line using the positions calculated

if ( w_sys_descr is initial ).

write: sy-sysid to w_sys_descr. " instance

write: '/' to w_sys_descr+10. " /

write: sy-mandt to w_sys_descr+12. " client

condense w_sys_descr.

endif.

write:/ 'System :', w_sys_descr.

  • write: / 'Run by :', sy-uname.

avl_text = report_width - 43.

if title_length > avl_text.

position 22.

prt_text = title_length - avl_text.

  • shift report_title right by prt_text places.

  • condense report_title.

write report_title.

else.

position center_start.

write report_title.

endif.

position right_align.

write: 'Time:', sy-uzeit using edit mask '__:__'.

  • write: 'Run Date :',

  • run_date mm/dd/yyyy.

*

  • Calculate center and right positions for the third line

title_length = strlen( sub_title ).

center_start = ( report_width - title_length ) / 2 + 1.

right_align = report_width - 15.

*

  • Write the second header line using the positions calculated

  • write:/ 'System :', w_sys_descr.

write: / 'Run by :', sy-uname.

if sub_title ne space.

avl_text = report_width - 43.

if title_length > avl_text.

position 22.

prt_text = title_length - avl_text.

  • shift sub_title right by prt_text places.

  • condense sub_title.

write sub_title.

else.

position center_start.

write sub_title.

endif.

endif.

position right_align.

write: 'Page:',

page_number using edit mask 'LL_______'.

  • write: 'Time:', sy-uzeit using edit mask '__:__'.

*

  • Finally, underline the header

uline.

*

ENDFUNCTION.

Former Member
0 Kudos

hi,

After making changes u activated that function group right.

if not activated that.

Former Member
0 Kudos

Please close this thread if your qury is solved

0 Kudos

I cant modify the Function module because it is under someone elses request .

can u just help to modify the codes in my program?