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 and date

Former Member
0 Kudos

hi,

this is my alv portion. I couldnt able to give top of page.I to display top as SCRAP Test and budat from selection screen as from and to date.

**&----


**

**& Form display_data

**&----


**

    • text

**----


**

    • --> p1 text

    • <-- p2 text

**----


*

FORM DISPLAY_DATA.

S_LAYOUT-ZEBRA = 'X' .

S_LAYOUT-COLWIDTH_OPTIMIZE = 'X' .

PERFORM FIELD_CATALOG TABLES IT_FIELDCAT

USING:

  • 'IT_FINAL' 'SNO' ' ' 'SNO' ' ' ' ',

'IT_FINAL5' 'LIFNR' ' ' 'VENDOR CODE' ' ' ' ',

'IT_FINAL5' 'NAME1' ' ' 'VENDOR DESCRIPTION' ' ' ' ',

'IT_FINAL5' 'OPEN' ' ' 'PREVIOUS STOCK' ' ' ' ',

'IT_FINAL5' 'WERKS' ' ' 'PLANT' 'X' ' ',

'IT_FINAL5' 'MATNR' ' ' 'MATERIAL NO' ' ' ' ',

'IT_FINAL5' 'MAKTX' ' ' 'MATERIAL DESCRIPTION' ' ' ' ',

'IT_FINAL5' 'MENGE2' ' ' 'NORMS' ' ' ' ',

'IT_FINAL5' 'QUAN' ' ' 'GRN QTY' ' ' ' ',

'IT_FINAL5' 'TRQ' ' ' 'TOTAL RECEIVABLE QTY' 'X' ' ',

'IT_FINAL5' 'IDNRK' ' ' 'RECEIVED MATERIAL' ' ' ' ',

'IT_FINAL5' 'MENGE_542' ' ' 'RECEIVED QUANTITY' 'X' ' ',

'IT_FINAL5' 'EXCESS' ' ' 'EXCESS/SHORTAGE' 'X' ' '.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = 'SY-CPROG'

  • I_GRID_TITLE =

  • I_GRID_SETTINGS =

  • I_CALLBACK_TOP_OF_PAGE = 'TOP'

IS_LAYOUT = S_LAYOUT

IT_FIELDCAT = IT_FIELDCAT[]

TABLES

T_OUTTAB = IT_FINAL5[]

  • 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.

ENDFORM. "DISPLAY_DATA

----


  • FORM FIELD_CATALOG *

----


  • ........ *

----


  • --> T_FIELD_CATALOG *

  • --> FP_TABNAME *

  • --> FP_FIELDNAME *

  • --> FP_KEY *

  • --> FP_TEXT *

----


FORM FIELD_CATALOG TABLES T_FIELD_CATALOG STRUCTURE IT_FIELDCAT

USING FP_TABNAME TYPE ANY

FP_FIELDNAME TYPE ANY

FP_KEY TYPE ANY

FP_TEXT TYPE ANY

FP_DO_SUM TYPE ANY

FP_EDIT TYPE ANY.

T_FIELD_CATALOG-TABNAME = FP_TABNAME.

T_FIELD_CATALOG-FIELDNAME = FP_FIELDNAME.

T_FIELD_CATALOG-KEY = FP_KEY.

T_FIELD_CATALOG-SELTEXT_L = FP_TEXT.

T_FIELD_CATALOG-DO_SUM = FP_DO_SUM .

T_FIELD_CATALOG-EDIT = FP_EDIT.

APPEND IT_FIELDCAT.

CLEAR IT_FIELDCAT.

ENDFORM. " display_data

3 REPLIES 3

I355602
Advisor
Advisor
0 Kudos

Hi,

Use this code, its working:-


*FOR TOP OF THE PAGE
DATA : it_top TYPE slis_t_listheader,
       wa_top TYPE slis_listheader.

*&---------------------------------------------------------------------*
*          DISPLAY RECORDS IN ALV GRID
*&---------------------------------------------------------------------*
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
   EXPORTING
    i_callback_program                = sy-repid
    i_callback_top_of_page            = 'TOP'
   TABLES
    t_outtab                          = it_ekpo
   EXCEPTIONS
    program_error                     = 1
    OTHERS                            = 2.

  IF sy-subrc <> 0.
  ENDIF.

*&---------------------------------------------------------------------*
*&      Form  top
*&---------------------------------------------------------------------*
*       TO WRITE THE HEADER
*----------------------------------------------------------------------*
FORM top.

  REFRESH it_top.
  wa_top-typ = 'S'.
  wa_top-key = text-001.
  wa_top-info = rep_id.
  APPEND wa_top TO it_top.
  CLEAR wa_top.

  wa_top-typ = 'S'.
  wa_top-key = <date>. "from selection screen.
  wa_top-info = rep_id.
  APPEND wa_top TO it_top.
  CLEAR wa_top.

"similarly you can pass as many details reqd in this internal table

  CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
      it_list_commentary       = it_top
*   I_LOGO                   =
*   I_END_OF_LIST_GRID       =
*   I_ALV_FORM               =
            .
ENDFORM.                    "top

Hope this helps you.

Thanks & Regards,

Tarun Gambhir

Edited by: Tarun Gambhir on Feb 25, 2009 5:06 PM

MarcinPciak
Active Contributor
0 Kudos

Hi,

Use the following code to display period in the top of page of ALV:


CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
   EXPORTING
     ...
     i_callback_top_of_page            = 'TOP_OF_PAGE'



FORM top_of_page.
DATA: ls_head TYPE slis_listheader,
        l_begda(10) TYPE c,
        l_endda(10) TYPE c,
        l_period(21) TYPE c.
       
  WRITE: begda TO l_begda DD/MM/YYYY,    "as begda use your selection screen begda parameter
              endda TO l_endda DD/MM/YYYY.    "same for endda

  CONCATENATE l_begda '-' l_endda INTO l_period.

  ls_head-typ  = 'S'.
  ls_head-key  = 'Period:'.
  ls_head-info = l_period.
  APPEND ls_head TO ft_listheader.

  CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
     EXPORTING
          it_list_commentary = it_alv_listheader.

ENDFORM.         

Regards

Marcin

Former Member
0 Kudos

closed