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: 

Alv...

Former Member
0 Kudos

experts!!

this is my first time in creating an alv..

i have 4 fields (field1 , field2 ,field3 , field4)

scenario:: field 3 is dynamic meaning no exact number of fields::

example:

name address phone no1. phone2 phone 3. remarks

name = field1

address = field2

phone no1 , phone2 , phone3...etc.. = field3(dynamic::).

remarks = field4.

how would I start this?

could you help me guys on this..

Please..

3 REPLIES 3

Former Member
0 Kudos

If you are going with OOPs ALV check standard program in SE38 as BCALV * and RSDEMO * which will give you all types of ALV programs

Reward points if find useful..........

Regards,

Minal

gopi_narendra
Active Contributor
0 Kudos

I suppose you are looking for something that should dynamically increase the columns of the ALV.

Please check this blog

/people/rich.heilman2/blog/2005/07/27/dynamic-internal-tables-and-structures--abap

Regards

Gopi

Former Member
0 Kudos

hi, selma!

this might give you an idea what to do:

DATA: ls_fieldcat TYPE slis_fieldcat_alv.

REFRESH f_fieldcat.

*/name

CLEAR ls_fieldcat.

ls_fieldcat-col_pos = 1.

ls_fieldcat-fieldname = 'NAME'.

ls_fieldcat-seltext_m = 'Name'.

APPEND ls_fieldcat TO f_fieldcat.

*/ address

"CLEAR ls_fieldcat.

ADD 1 TO ls_fieldcat-col_pos.

ls_fieldcat-fieldname = 'ADDRESS'.

ls_fieldcat-seltext_m = 'Address'.

APPEND ls_fieldcat TO f_fieldcat.

*/ phone no1

ADD 1 TO ls_fieldcat-col_pos.

ls_fieldcat-fieldname = 'PHONE'.

ls_fieldcat-seltext_m = 'Phone1'.

APPEND ls_fieldcat TO f_fieldcat.

DATA: lt_sort TYPE slis_sortinfo_alv.

ADD 1 TO lt_sort-spos.

lt_sort-fieldname = 'NAME'.

APPEND lt_sort TO f_sort.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = gy_repid

is_layout = gs_layout

it_fieldcat = it_fieldcat

it_sort = it_sort

TABLES

t_outtab = it_data

EXCEPTIONS

program_error = 1

OTHERS = 2.

try this link, too:

<a href="http://www.sapdevelopment.co.uk/reporting/alv/alvlist_code.htm">ALV development (ALV_LIST)</a>