Application Development and Automation 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: 
Read only

alv list display problem

Former Member
0 Likes
1,211

hi all,

i have succeded to make a program for alv list.

i had to display the ALV LIST for a bank book

in a fashion that i got the opening balance at the beginning of list sorted according to document date

and closing balance immediatly after the end of one document date.

the closing balance of the above would be the opening balance for the list of next date and then list display

and then closing balance

till you encounter the end.

i have absolutely no clue on how to sort and display opening and closing balance according to date.

i would appreciate any help from ur side

thanks in advance

gaurav angrass

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,173

hi

while displaying the alv, we use the FM like 'RESUSE_ALV_*_DISPLAY'.

In this FM, you can pass the parameter IT_SORT with sort-field and set sort-up field as 'x'.

So, while alv will be sorted by the field mentioned in sort-field.

Regards,

Richa

hi all,

i have succeded to make a program for alv list.

i had to display the ALV LIST for a bank book

in a fashion that i got the opening balance at the beginning of list sorted according to document date

and closing balance immediatly after the end of one document date.

the closing balance of the above would be the opening balance for the list of next date and then list display

and then closing balance

till you encounter the end.

i have absolutely no clue on how to sort and display opening and closing balance according to date.

i would appreciate any help from ur side

thanks in advance

gaurav angrass

8 REPLIES 8
Read only

Former Member
0 Likes
1,173

Hi Gaurav,

you need to use sort table .

build the sort table and pass it .

check this example for sort usage.


REPORT  ZTEST_ALV                           .
TYPE-POOLS: SLIS.
DATA:
  LS_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
  LT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
  LT_SORT     TYPE SLIS_T_SORTINFO_ALV,
  LS_SORT     TYPE SLIS_SORTINFO_ALV.

DATA: BEGIN OF ITAB OCCURS 0,
       LIFNR LIKE LFA1-LIFNR,
       MATNR LIKE MARA-MATNR,
      END OF ITAB.
ITAB-LIFNR = 'C1000'.
ITAB-MATNR = '12345'.
APPEND ITAB.
CLEAR ITAB.

ITAB-LIFNR = 'C1000'.
ITAB-MATNR = '12678'.
APPEND ITAB.
CLEAR ITAB.
ITAB-LIFNR = 'C2000'.
ITAB-MATNR = '12345'.
APPEND ITAB.
CLEAR ITAB.
ITAB-LIFNR = 'C2000'.
ITAB-MATNR = '12345'.
APPEND ITAB.
CLEAR ITAB.
ITAB-LIFNR = 'C2000'.
ITAB-MATNR = '12678'.
APPEND ITAB.
CLEAR ITAB.
ITAB-LIFNR = 'C2000'.
ITAB-MATNR = '12679'.
APPEND ITAB.
CLEAR ITAB.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
  EXPORTING
    I_PROGRAM_NAME         = SY-REPID
    I_INTERNAL_TABNAME     = 'ITAB'
    I_INCLNAME             = SY-REPID
  CHANGING
    CT_FIELDCAT            = LT_FIELDCAT
  EXCEPTIONS
    INCONSISTENT_INTERFACE = 1
    PROGRAM_ERROR          = 2
    OTHERS                 = 3.
IF SY-SUBRC <> 0.
  MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
          WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LS_SORT-FIELDNAME = 'LIFNR'.
LS_SORT-UP        = 'X'.
ls_sort-group = 'UL'.
APPEND LS_SORT TO LT_SORT.
CLEAR LS_SORT.
LS_SORT-FIELDNAME = 'MATNR'.
LS_SORT-UP        = 'X'.
*ls_sort-group = '*'.
APPEND LS_SORT TO LT_SORT.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
  EXPORTING
    IT_FIELDCAT = LT_FIELDCAT
    IT_SORT     = LT_SORT
  TABLES
    T_OUTTAB    = ITAB.

regards

vijay

Read only

Former Member
0 Likes
1,174

hi

while displaying the alv, we use the FM like 'RESUSE_ALV_*_DISPLAY'.

In this FM, you can pass the parameter IT_SORT with sort-field and set sort-up field as 'x'.

So, while alv will be sorted by the field mentioned in sort-field.

Regards,

Richa

Read only

0 Likes
1,173

Thanks

First of all i do want grid display but list display.

roughly required format is

(top-of-list)opening balance

-


23.02.2006(alv list sorted by date)

-


(end of list )closing balance :y

(top-of-list)opening balance : y(same as above closing balance)

-


24.02.2006(continuation of above list with other date)

-


(end of list )closing balance :z

and so on till list is ended.

i am not able to get the above format alv list

my question is still the same and i have already

generated a ALv List but not able to proceed further in getting the above format.

if i sort my list by date then also i do not get the above format.

if u can help me in this regard ?.

kindly send any sample code or any documentation help

thanks in advance

regards

Gaurav Angrass

Read only

0 Likes
1,173

i am awaiting a reply of my post

thanks

Read only

0 Likes
1,173

Hi Gaurav,

I think you can use REUSE_ALV_BLOCK_LIST_DISPLAY..

a sample of the same..

data : begin of str,
       client like mara-mandt,
       mat like mara-matnr,
       end of str,
       tab like standard table of str.

data :wa2 type slis_alv_event ,
      tab2 like standard table of wa2,
      wa1 type   slis_layout_alv,
      wa type line of slis_t_fieldcat_alv,
       tab1 like standard table of wa.
       wa-fieldname = 'CLIENT'.
       wa-tabname = 'TAB'.
       wa-ref_fieldname = 'MANDT'.
       wa-ref_tabname = 'MARA'.
       wa-seltext_l = 'CLIENT'.
       append wa to tab1.

        wa-fieldname = 'MAT'.
       wa-tabname = 'TAB'.
       wa-ref_fieldname = 'MATNR'.
       wa-ref_tabname = 'MARA'.
       wa-seltext_l = 'MATERIAL'.
       append wa to tab1.

       wa1-no_colhead = 'X'.
       wa2-name = 'top-of-page'.
       append wa2 to tab2.

select mandt matnr up to 30 rows from mara into table tab.


CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
  EXPORTING
    I_CALLBACK_PROGRAM             = sy-cprog
*   I_CALLBACK_PF_STATUS_SET       = ' '
*   I_CALLBACK_USER_COMMAND        = ' '
*   IT_EXCLUDING                   =
          .

CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
  EXPORTING
    IS_LAYOUT                        = wa1
    IT_FIELDCAT                      = tab1
    I_TABNAME                        = 'TAB'
    IT_EVENTS                        = tab2
*   IT_SORT                          =
*   I_TEXT                           = ' '
  TABLES
    T_OUTTAB                         = tab
* EXCEPTIONS
*   PROGRAM_ERROR                    = 1
*   MAXIMUM_OF_APPENDS_REACHED       = 2
*   OTHERS                           = 3
          .
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
  EXPORTING
    IS_LAYOUT                        = wa1
    IT_FIELDCAT                      = tab1
    I_TABNAME                        = 'TAB'
    IT_EVENTS                        = tab2
*   IT_SORT                          =
*   I_TEXT                           = ' '
  TABLES
    T_OUTTAB                         = tab
* EXCEPTIONS
*   PROGRAM_ERROR                    = 1
*   MAXIMUM_OF_APPENDS_REACHED       = 2
*   OTHERS                           = 3
          .
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.


CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'
* EXPORTING
*   I_INTERFACE_CHECK             = ' '
*   IS_PRINT                      =
*   I_SCREEN_START_COLUMN         = 0
*   I_SCREEN_START_LINE           = 0
*   I_SCREEN_END_COLUMN           = 0
*   I_SCREEN_END_LINE             = 0
* IMPORTING
*   E_EXIT_CAUSED_BY_CALLER       =
*   ES_EXIT_CAUSED_BY_USER        =
* 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.

regards

satesh

Read only

0 Likes
1,173

sort the table by date, by building sort table as suggested by vijay.

for top_of_page and end_of_list, u need to handle those events.

PERFORM EVENTS.

FORM EVENTS.

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

EXPORTING

i_list_type = 0

IMPORTING

et_events = p_events.

READ TABLE p_events WITH KEY name = slis_ev_top_of_page

INTO ls_event.

IF sy-subrc = 0.

MOVE top_of_page TO ls_event-form.

MODIFY P_event FROM LS_events INDEX SY-TABIX.

ENDIF.

READ TABLE p_events WITH KEY name = slis_ev_top_of_page

READ TABLE p_events WITH KEY name = slis_ev_end_of_list

INTO ls_event.

INTO ls_event.

IF sy-subrc = 0.

MOVE END_OF_LIST TO ls_event-form.

MODIFY P_event FROM LS_events INDEX SY-TABIX.

ENDIF.

&----


*& Form top_of_page

&----


  • text

----


FORM top_of_page.

DATA : text(40),txtdt(40),comp(30) .

v_comp = S_BUKRS.

CLEAR string.

string = DATE(PASS THE OPENING DATE).

wa_header-typ = 'H'.

wa_header-info = string.

APPEND wa_header TO heading.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

i_logo = 'ENJOYSAP_LOGO'

it_list_commentary = heading.

CLEAR heading.

ENDFORM. "top_of_page

&----


& Form END_OF_LIST&----


*

  • text

----


FORM END_OF_LIST.

wa_header-typ = 'H'.

wa_header-info = DATE(PASS CLOSING DATE VARIABLE).

APPEND wa_header TO heading.

CLEAR string.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

i_logo = 'ENJOYSAP_LOGO'

it_list_commentary = heading

i_end_of_list_grid = 'X'.

ENDFORM. "END_OF_LIST

Read only

0 Likes
1,173

HI Gaurav,

if you dint get as to how to proceed with BLOCKs..

1.just append the block with using

CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'

in which you pass..

I_TABNAME = 'TAB'

so use you condition to fill the TAB like

select * from <table> into table TAB where dat = <dat>.

fill the tab and

Call 'REUSE_ALV_BLOCK_LIST_APPEND'..

hope it will do..

regards

satesh

Read only

0 Likes
1,173

THANKS SATESH

YOUR SUGGESTION SOLVED MY PROBLEM.

I DO NOT EXACTLY KNOW HOW TO ASSIGN POINTS .I HAVE TRIED TO ASSIGN POINTS TO U .

IF U DIDN'T GOT THE POINTS PLS TELL ME THE PROCEDURE TO GIVE POINTS.