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: 

how to change header value dynamiclly in procedural alv report?

Former Member
0 Kudos
106

Hi experts,

I develop one report (using procedural alv ).I gave 3 input check boxes (ex : in 1st checkbox 10days in 2nd check box 20 days

in 3rd check box 30 days they entered like this in the input checkboxes in days 10,20,30.In o/p report 3 columns i maintained like this . Column1 column2 column 3

from 0 to 10 days from 11 to 20 days from 21 to 30 days.

I want to display alv report o/p like this in the respective columns.

For example they enter 15 25 35 (i/p)

o//p in alv report

Column1 column2 column 3

from 0 to 15 days from 16 to 25 days from 26 to 35 days.

i want to change days dynamically in alv header .Pls give me the code using procedural alv report.

If u want i will give u detail.pls help me in this.

1 ACCEPTED SOLUTION

MarcinPciak
Active Contributor
0 Kudos
56

I assume the main issue is chaniging ALV header dynamically, isn't it? For this you need to use field seltext_m of fieldcatalog for particular column. So you can contruct header dynamically by string concatenation like


parameters: pa_1st(2) type n,  "i.e. 15
                    pa_2nd(2) type n,  "i.e 25
                    pa_3rd(2) type n.  "i.e. 35

"first field
concatenate '0' 'to' pa_1st into it_fieldcatalog-seltext_m.

"next field
add 1 to pa_1st.
concatenate pa_1st 'to' pa_2nd into it_fieldcatalog-seltext_m.

"last field
add 1 to pa_2nd.
concatenate pa_2nd 'to' pa_3rd into it_fieldcatalog-seltext_m.

Refer [Sample ALV: Heading in ALV|http://www.sap-img.com/abap/sample-alv-heading-in-alv.htm] for more information.

Regards

Marcin

3 REPLIES 3

MarcinPciak
Active Contributor
0 Kudos
57

I assume the main issue is chaniging ALV header dynamically, isn't it? For this you need to use field seltext_m of fieldcatalog for particular column. So you can contruct header dynamically by string concatenation like


parameters: pa_1st(2) type n,  "i.e. 15
                    pa_2nd(2) type n,  "i.e 25
                    pa_3rd(2) type n.  "i.e. 35

"first field
concatenate '0' 'to' pa_1st into it_fieldcatalog-seltext_m.

"next field
add 1 to pa_1st.
concatenate pa_1st 'to' pa_2nd into it_fieldcatalog-seltext_m.

"last field
add 1 to pa_2nd.
concatenate pa_2nd 'to' pa_3rd into it_fieldcatalog-seltext_m.

Refer [Sample ALV: Heading in ALV|http://www.sap-img.com/abap/sample-alv-heading-in-alv.htm] for more information.

Regards

Marcin

0 Kudos
56

Hi marcin ,

Thank u for giving answer.

one more requirement in the same report is,

particular vendor some invoices r there in that some invoices overdue amount and some invoices net amt is there.

My question is ,

After completing one vendor (in alv report o/p) I want to subtotals for overdue amt and net amt.afer this it will go for

next vendor etc. I am used procedual alv report

0 Kudos
56

Actually this is a very common requirement. I believe you could find the answer for it yourself. Basically you need to set field do_sum = 'X' in fieldcatalog for those fields which are to be subtotalled. Additionally you need to fill table sort where you pass which fields have to be subtotalled.

Refer [this|http://www.sap-basis-abap.com/abap/alv-grid-list-with-sub-totals.htm].

Also next time please do a search before asking question. As I said this is basic one so you won't have any troubles with finding the answer yourself.

Regards

Marcin