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: 

CODE

Former Member
0 Kudos

Hi,

I want to display BSIK-DMBTR field contents using ALV also

I want to display total = bsik-dmbtr + 1 using alv..

my final output list should contain

DMBTR TOTAL

______ ___________

100 101

200 201

. .

. .

. .

. .

pls let me know how to display the above...

the following is the same program without logic..

________________________________________

report zalv.

tables : bsik.

type-pools : slis.

DATA: it_fldcat TYPE slis_t_fieldcat_alv.

DATA: wa_fldcat TYPE slis_fieldcat_alv.

DATA : it_sort TYPE slis_t_sortinfo_alv.

DATA : wa_sort TYPE slis_sortinfo_alv.

data : begin of itab occurs 0,

dmbtr like bsik-dmbtr.

total type i,

end of itab.

bld_fcat 1 'DMBTR' 13 'Amt Document Curr' 'L'.

bld_fcat 2 'TOTAL' 20 'Total amount' 'L'.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' "Displaying data in grid format

EXPORTING

i_callback_program = sy-repid

it_fieldcat = it_fldcat "fieldcatalog

  • it_sort = it_sort[] "Sort

  • it_events = it_events

TABLES

t_outtab = itab "internal table to output

EXCEPTIONS

program_error = 1

OTHERS = 2.

IF sy-subrc <> 0.

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

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

ENDIF.

1 ACCEPTED SOLUTION

JozsefSzikszai
Active Contributor
0 Kudos

hi,

before the ALV call:

LOOP AT itab.

itab-total = itab-dmbtr + 1.

MODIFY itab.

ENDLOOP.

hope this helps

ec

5 REPLIES 5

JozsefSzikszai
Active Contributor
0 Kudos

hi,

before the ALV call:

LOOP AT itab.

itab-total = itab-dmbtr + 1.

MODIFY itab.

ENDLOOP.

hope this helps

ec

Former Member
0 Kudos

Hi,

You can do as below :

Once everything is done and before passing the internal table to ALV.

loop at gt_final.

gt_final-total = gt_final-dmbtr + 1.

modify gt_final.

clear gt_final.

endloop.

Thanks,

Sriram Ponna.

Former Member
0 Kudos

Hi Malika,

Before populating in to the final internal table just add 1 to the total field.

ie + 1 to your total field.

Regards,

DVNS

Former Member
0 Kudos

Hi,

U can add an extra field in the internal table.increment tht value and store it in tht internal table.

Thn in the fieldcatalog u can arraange this field and u can display it.

example:

data :begin of itab.

inculde structure dbtablename.

data : incr type i.

data : end of itab.

reward if useful

Former Member
0 Kudos

Why can't you have an additonal field "TOTAL" in your output table.

when you calculate DMBTR then in that piece of code , next line you can derive TOTAL as :

....

itab-DMBTR = gw_dmbtr.

itab-TOTAL = gw_dmbtr + 1.

...

append itab.

else you will have to unnecessarily make an additional loop on table itab and calculate DMBTR as suggested by other guys ont he forum.

.