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 HEADER

Former Member
0 Likes
846

Hi All

I want to display company name in middle of the reportin header. can it be possible? Generally it is printed left aligned.

I M POSTING SECOND TIME AS NO BODY REPLIED.

PLs help.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
814

Sameer,

Pls reward points and close thread if solved and contribute to "Food For Points" by closing all threads if solved

Hi All

I want to display company name in middle of the reportin header. can it be possible? Generally it is printed left aligned.

I M POSTING SECOND TIME AS NO BODY REPLIED.

PLs help.

5 REPLIES 5
Read only

abdulazeez12
Active Contributor
0 Likes
814

I dont think it is possible..

Try this way..

Give spaces before the tilte of the report and pass this as the title..

like title = ' Report Header'.

then [pass this title in the function module..

Read only

Former Member
0 Likes
814

Hi,

I think this is not possible to print in the middle of the screen in ALV.

Thanks,

Sriram Ponna.

Read only

Former Member
0 Likes
814

Hi Sameer,

i have one solution.Try this u can get the output u want.

First execute the following code,so that u can understand the concept,later make changes u want.

TABLES VBAK.

TYPE-POOLS SLIS.

  • Data Declaration

TYPES: BEGIN OF T_VBAK,

VBELN TYPE VBAK-VBELN,

ERDAT TYPE VBAK-ERDAT,

ERNAM TYPE VBAK-ERNAM,

AUDAT TYPE VBAK-AUDAT,

VBTYP TYPE VBAK-VBTYP,

NETWR TYPE VBAK-NETWR,

VKORG TYPE VBAK-VKORG,

VKGRP TYPE VBAK-VKGRP,

END OF T_VBAK.

DATA IT_VBAK TYPE STANDARD TABLE OF T_VBAK INITIAL SIZE 0.

  • ALV Data Declaration

DATA: FLDCAT TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,

GD_LAYOUT TYPE SLIS_LAYOUT_ALV,

GD_REPID TYPE SY-REPID,

  • I_EVENTS TYPE SLIS_T_EVENT,

  • W_EVENTS LIKE LINE OF I_EVENTS.

START-OF-SELECTION.

PERFORM DATA_RETRIEVAL.

PERFORM BLD_FLDCAT.

PERFORM BLD_LAYOUT.

PERFORM DISPLAY_ALV_REPORT.

  • Build Field Catalog for ALV Report

FORM BLD_FLDCAT.

FLDCAT-FIELDNAME = 'VBELN'.

FLDCAT-SELTEXT_M = 'Sales Document'.

FLDCAT-COL_POS = 0.

*FLDCAT-EMPHASIZE = 'C411'.

FLDCAT-OUTPUTLEN = 20.

FLDCAT-KEY = 'X'.

*FLDCAT-NO_OUT = 'X'. "It hides the field from display

APPEND FLDCAT TO FLDCAT.

CLEAR FLDCAT.

FLDCAT-FIELDNAME = 'ERDAT'.

FLDCAT-SELTEXT_L = 'Record Date created'.

FLDCAT-COL_POS = 1.

FLDCAT-KEY = 'X'.

FLDCAT-JUST = 'R'. "Right(R)/Left(L)/Center(C) Justification

APPEND FLDCAT TO FLDCAT.

CLEAR FLDCAT.

FLDCAT-FIELDNAME = 'ERNAM'.

FLDCAT-SELTEXT_L = 'Cteated Object Person Name'.

FLDCAT-COL_POS = 2.

APPEND FLDCAT TO FLDCAT.

CLEAR FLDCAT.

FLDCAT-FIELDNAME = 'AUDAT'.

FLDCAT-SELTEXT_M = 'Document Date'.

FLDCAT-COL_POS = 3.

FLDCAT-EMPHASIZE = 'C110'.

APPEND FLDCAT TO FLDCAT.

CLEAR FLDCAT.

FLDCAT-FIELDNAME = 'VBTYP'.

FLDCAT-SELTEXT_L = 'SD Document category'.

FLDCAT-COL_POS = 4.

APPEND FLDCAT TO FLDCAT.

CLEAR FLDCAT.

FLDCAT-FIELDNAME = 'NETWR'.

FLDCAT-SELTEXT_L = 'Net Value of the SO in Document Currency'.

FLDCAT-COL_POS = 5.

FLDCAT-OUTPUTLEN = 60.

FLDCAT-DO_SUM = 'X'.

FLDCAT-DATATYPE = 'CURR'.

APPEND FLDCAT TO FLDCAT.

CLEAR FLDCAT.

FLDCAT-FIELDNAME = 'VKORG'.

FLDCAT-SELTEXT_L = 'Sales Organization'.

FLDCAT-COL_POS = 6.

APPEND FLDCAT TO FLDCAT.

CLEAR FLDCAT.

FLDCAT-FIELDNAME = 'VKGRP'.

FLDCAT-SELTEXT_M = 'Sales Group'.

FLDCAT-COL_POS = 7.

FLDCAT-EMPHASIZE = 'C801'.

APPEND FLDCAT TO FLDCAT.

CLEAR FLDCAT.

ENDFORM.

  • Build Layout for ALV Grid Report

FORM BLD_LAYOUT.

GD_LAYOUT-NO_INPUT = 'X'.

GD_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.

ENDFORM.

  • Display report using ALV grid

FORM DISPLAY_ALV_REPORT.

DATA T_EVENT TYPE SLIS_T_EVENT.

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

EXPORTING

I_LIST_TYPE = 0

IMPORTING

ET_EVENTS = T_EVENT.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

GD_REPID = SY-REPID.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = GD_REPID

IS_LAYOUT = GD_LAYOUT

I_CALLBACK_HTML_TOP_OF_PAGE = 'TOP_OF_PAGE_SPLIT'

IT_FIELDCAT = FLDCAT[]

I_SAVE = 'X'

TABLES

T_OUTTAB = IT_VBAK

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.

  • Retrieve data from VBAK table and populate itab IT_VBAK

FORM DATA_RETRIEVAL.

SELECT VBELN ERDAT ERNAM AUDAT VBTYP NETWR VKORG

UP TO 20 ROWS

FROM VBAK

INTO TABLE IT_VBAK.

ENDFORM.

FORM TOP_OF_PAGE_SPLIT USING R_TOP TYPE REF TO CL_DD_DOCUMENT.

DATA: S_TAB TYPE SDYDO_TEXT_TABLE,

C_AREA TYPE REF TO CL_DD_AREA,

TEXT TYPE SDYDO_TEXT_ELEMENT.

DATA: BEGIN OF TAB_TEXT OCCURS 0,

TEXT TYPE SDYDO_TEXT_ELEMENT,

END OF TAB_TEXT.

CALL METHOD R_TOP->INITIALIZE_DOCUMENT.

CALL METHOD R_TOP->VERTICAL_SPLIT

EXPORTING

SPLIT_AREA = R_TOP

SPLIT_WIDTH = '70%'

IMPORTING

RIGHT_AREA = C_AREA.

IF SY-SUBRC <> 0.

    • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO*

    • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.*

ENDIF.

TAB_TEXT-TEXT = 'GEMS TECHNO SOLUTIONS PVT LIMITED'.

APPEND TAB_TEXT.

TAB_TEXT-TEXT = 'PLOT NO.100,SECTOR 1'.

APPEND TAB_TEXT.

TAB_TEXT-TEXT = 'MVP DOUBLE ROAD'.

APPEND TAB_TEXT.

TAB_TEXT-TEXT = 'MVP COLONY,VIZAG'.

APPEND TAB_TEXT.

S_TAB[] = TAB_TEXT[].

CALL METHOD C_AREA->ADD_TEXT

EXPORTING

TEXT_TABLE = S_TAB

FIX_LINES = 'X'

SAP_FONTSIZE = CL_DD_DOCUMENT=>MEDIUM

SAP_EMPHASIS = CL_DD_DOCUMENT=>STRONG.

TEXT = 'REPORT:'.

CALL METHOD R_TOP->ADD_TEXT

EXPORTING

TEXT = TEXT

SAP_EMPHASIS = 'STRONG'.

CALL METHOD R_TOP->ADD_GAP

EXPORTING

WIDTH = 2.

TEXT = SY-REPID.

CALL METHOD R_TOP->ADD_TEXT

EXPORTING

TEXT = TEXT

SAP_STYLE = 'KEY'.

CALL METHOD R_TOP->NEW_LINE.

TEXT = 'DATE:'.

CALL METHOD R_TOP->ADD_TEXT

EXPORTING

TEXT = TEXT

SAP_EMPHASIS = 'STRONG'.

CALL METHOD R_TOP->ADD_GAP

EXPORTING

WIDTH = 8.

TEXT = SY-DATUM.

CALL METHOD R_TOP->ADD_TEXT

EXPORTING

TEXT = TEXT

SAP_STYLE = 'KEY'.

CALL METHOD R_TOP->NEW_LINE.

ENDFORM.

The above code devides the header and print the data in both left and right side.

If u need any help then i wl give u.

Reward points if it is useful,

Thank you,

chandu.

Edited by: Chandu Valluri on Jan 4, 2008 7:14 PM

Edited by: Chandu Valluri on Jan 4, 2008 7:16 PM

Read only

Former Member
0 Likes
814

Sameer,

Chk my blog

/people/community.user/blog/2007/05/07/alignment-of-data-in-top-of-page-in-alv-grid

Read only

Former Member
0 Likes
815

Sameer,

Pls reward points and close thread if solved and contribute to "Food For Points" by closing all threads if solved