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: 

Top_of_page in alv grid display

Former Member
0 Kudos

Hi,

I have used top_of_page event in my alv report.I want to display the count of materials displayed in the output,the user name and system date in the top of page.How can I display the count of materials in the ouput?Is there any system field for that?

1 ACCEPTED SOLUTION

agnihotro_sinha2
Active Contributor
0 Kudos

hi,

You have to count the material in the loop and store it in a global variable.

Use this global variable in the FORM of the top of page and u can display it.

pass below variable for other info.

username: sy-uname

progr name: sy-repid.

date: sy-datum

ags.

6 REPLIES 6

agnihotro_sinha2
Active Contributor
0 Kudos

hi,

You have to count the material in the loop and store it in a global variable.

Use this global variable in the FORM of the top of page and u can display it.

pass below variable for other info.

username: sy-uname

progr name: sy-repid.

date: sy-datum

ags.

Former Member
0 Kudos

describe the final output table to get count for the no. of materials, incase of material is the first field in the table.

Former Member
0 Kudos

1) Declare a Field w_count

2 )

Loop at itab.
    W_count = w_count + 1.
   Endloop.

Or

Describe table itab line W_count.

3) Use W_count in Top-of-Page for Alv.

Note: Not system Field available for the same.

Regards,

Gurpreet

Former Member
0 Kudos

Hi,

Use Describe statement to get the number of lines in output internal table. Display that number in header.

Former Member
0 Kudos

Hi,

steps:

1) First of all take the count of material into a variable(using DESCRIBE).

2) Write perform top_of_page

3) pass this perform to fm reuse_alv_grid_display

4)pass below variable for other info.

username: sy-uname

progr name: sy-repid.

date: sy-datum

Count : your variable

Edited by: AD on Apr 30, 2009 8:43 AM

Former Member
0 Kudos

you pass that variable value to top-of-page.

like,

&----


*& Form top_of_page

&----


  • Form to display report header.

----


FORM top_of_page. "#EC CALLED

DATA: l_rdate(11),

l_date(10).

l_date = sy-datum.

CALL FUNCTION 'CONVERSION_EXIT_IDATE_OUTPUT'

EXPORTING

input = l_date

IMPORTING

output = l_date.

CONCATENATE l_date0(2) c_hi l_date2(3) c_hi

l_date+5(4) INTO l_rdate.

FORMAT COLOR COL_POSITIVE ON.

WRITE: /30 text-013, 65 text-015,

70 l_rdate.

WRITE: /30 text-014, 65 sy-uzeit,

74 text-016.

WRITE: /30 p_keydat.

FORMAT COLOR COL_POSITIVE OFF.

FORMAT COLOR COL_GROUP ON.

WRITE: /2 text-012, 17 i_final_1-cname1.

READ TABLE i_bsid WITH KEY xref1 = i_final_1-xref1.

IF sy-subrc EQ 0.

IF i_final-xref1 = c_10.

WRITE: /2 text-017,

16 text-018.

ELSEIF i_final-xref1 = c_20.

WRITE: /2 text-017,

16 text-019.

ELSEIF i_final-xref1 = c_30.

WRITE: /2 text-017,

16 text-020.

ENDIF.

ENDIF.

FORMAT COLOR COL_GROUP OFF.

Regards,

Joan