‎2009 Apr 28 8:03 AM
Hi experts,
I have a requirement in alv to display multiple header in alv. For every customer I need a header to be displayed in the alv and the documents related to the customer has to be displayed in the the below mentioned format.Likewise I need to have a header and a table to be displayed for each customer.
The output of the list should look like this.
Header1(first customer)
col1 col2 col3 col4
Header 2(second customer)
col1 col2 col3 col4
How this output can be achieved in alv?
Thanks & Regards,
Arun.
‎2009 Apr 28 8:07 AM
Hello,
I think for this a Heirarchical ALV will suffice, it wil give you the desired output
Sample Programs:
BCALV_TEST_HIERSEQ_LIST
BCALV_TEST_HIERSEQ_LIST_EVENTS
Regards,
Mansi.
‎2009 Apr 28 8:13 AM
Mansi,
The header which I have mentioned is not just a single line which we will use it in hierarchy.
The header part will contain 6 to 7 lines and I have a total value for the customer in the header part.
So hierarchy will not be a suitable one.
Thanks & Regards,
Arun
‎2009 Apr 28 8:50 AM
Hi,
If hierarchy does not fulfill your requirement means, then I think you can not use the ALV.
May be you can go for the classical report output.
Regards,
Santhosh
‎2009 Apr 28 8:52 AM
Santhosh,
I have already done the same requirment with classical report.
But I need to change it to the alv.
Whether there is any other option left out for using alv for this requirement?
Thanks & Regards,
Arun
‎2009 Apr 28 9:46 AM
It is not possible eith REUSE_ALV_GRID_DISPLAY. U might have to use object oriented ALV for this.
‎2009 Apr 28 9:49 AM
Vijeta,
If it is possible with oops alv, how can I do that?
Suggest me.
Thanks & Regards,
Arun.
‎2009 Apr 28 8:09 AM
Hi!
I don't know how it is possible with the ALV grid. But does the hierseq. list (class cl_salv_hierseq_table) match your requirements?
See demo applications:
- SALV_DEMO_HIERSEQ_COLUMN
- SALV_DEMO_HIERSEQ_EVENTS
- SALV_DEMO_HIERSEQ_FORM_EVENTS
- SALV_DEMO_HIERSEQ_FUNCTIONS
- SALV_DEMO_HIERSEQ_LAYOUT
- SALV_DEMO_HIERSEQ_POPUP
- SALV_DEMO_HIERSEQ_RECURSION
- SALV_DEMO_HIERSEQ_REFRESH
- SALV_DEMO_HIERSEQ_SELECTIONS
- SALV_DEMO_HIERSEQ_SIMPLE
Regards,
Florian
‎2009 Apr 28 8:11 AM
Hi,
This can be achieved by using the hierarchical ALV function module.
function module - REUSE_ALV_HIERSEQ_LIST_DISPLAY.
Here u need to populate all the header and item records separetely into internal tables and pass them accordingly.
I_TABNAME_HEADER will have the HEADER TABLE, and I_TABNAME_ITEM will have the item table.
IS_KEYINFO will have the keys common in header and item internal tables.
Finally T_OUTTAB_HEADER, T_OUTTAB_ITEM will have contents of the header and item contents.
Regards,
Santhosh.
‎2009 Apr 28 9:55 AM
Ur req can be achevied using REUSE_ALV_HIERSEQ_LIST_DISPLAY FM.
Hierarchical sequential list output
Functionality
This module outputs two internal tables as a formated hierarchical-sequential list.
Principle:
Pass an internal table containing the set of header information to be output.
Pass an internal table containing the set of item information to be output.
Pass a structure containing the general list layout details
Pass a field catalog in the form of an internal table. The field catalog describes the fields to be output in the list.
Notes
All interactions which are performed on the list refer directly to the internal output tables, e.g. sorting the list also sorts the passed internal output tables (passed by reference).
The expected output data quantity is an important consideration for the use of the tool or various generic functions (totals, subtotals).
The application must take account of this.
‎2009 Apr 28 9:59 AM
Hi shafi,
My header will be just like the contents in a top of page with 6 to 7 lines, which do have some values which is specific to a particular customer.
So heirarchy won't be possible.
If you have any other way of doing this, please let me know.
Thanks & Regards,
Arun
‎2009 Apr 28 10:43 AM
Hi Arun,
Are you expecting the ALV as, say example
customer 1 (some header details - customer number, customer name)
some details about customer (col1, col2 ....)
customer 2 (some header details - customer number, customer name)
some details about customer (col1, col2 ....)
for each customer display the details as header and item..
could you clarify this.
‎2009 Apr 28 10:48 AM
Vadhu,
The header part will contain say 5 lines.
Header is required for each customer.
Header
customer no date
customer name
Company code
Net value
Gross value
Item
col1 col2 col3 col4
Header (for the next customer)
Hope you understood my requirement.
Thanks & Regards,
Arun.
‎2009 Apr 28 11:19 AM
The Function Module, REUSE_ALV_HIERSEQ_LIST_DISPLAY.
You have to pass two internal tables (header and item).
Both should have common field. Eg customer no(but u know need to display that in item)
Field catalog for both tables, eg( I just gave one field example)
table_fieldcatalog-fieldname = 'MATNR'.
table_fieldcatalog-tabname = 'IT_HEADER'. (header table)
table_fieldcatalog-col_pos = '1'.
table_fieldcatalog-outputlen = 18.
table_fieldcatalog-ddictxt = 'S'.
table_fieldcatalog-seltext_s = text-005(heading - material number).
table_fieldcatalog-seltext_m = text-005.
table_fieldcatalog-seltext_l = text-005.
APPEND table_fieldcatalog.
table_fieldcatalog-fieldname = 'DATUM'.
table_fieldcatalog-tabname = 'IT_ITEM'. (Item table)
table_fieldcatalog-col_pos = '4'.
table_fieldcatalog-outputlen = 12.
table_fieldcatalog-ddictxt = 'S'.
table_fieldcatalog-seltext_s = text-009.
table_fieldcatalog-seltext_m = text-009.
table_fieldcatalog-seltext_l = text-009.
APPEND table_fieldcatalog.
then specify the link between header and item table as,
key_info-header01 = 'MATNR'.
key_info-item01 = 'MATNR'.
then call the function module,
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
i_callback_program = report_id
it_fieldcat = table_fieldcatalog[]
it_sort = t_sort
i_default = ' '
i_save = 'A'
is_variant = t_variant
i_tabname_header = 'IT_HEADER'
i_tabname_item = 'IT_ITEM'
is_keyinfo = key_info
it_events = t_events
TABLES
t_outtab_header = it_header
t_outtab_item = it_item
EXCEPTIONS
program_error = 1
OTHERS = 2.
Hope this will help you.
‎2009 Apr 28 11:29 AM
Vadhu,
U r right if I have a header in this format.
customer no customer name net value gross value
But in my case it is totally different.
My header should look like this. This header should repeat for each and every customer.
Line item will contain the relevant document for the particular customer.
Customer no date
Customer name Company code
net value
gross value
Hope u understood....
Thanks & Regards,
Arun.
‎2009 Apr 28 10:56 AM
Hi Arun,
ur requirement can be achieved by using function module reuse_alv_hierseq_alv_display
in this function module ,,, we have to pass key which are common for both header and item to KEYINFO parameter ,,, also we have to pass the data of the both internal tables to the function module.
For any further queries, pls let me know
Regards,
Jack
‎2009 Apr 28 11:01 AM
Hi Arun,
Go through this demo code: BALVBT01
In the FORM XTOP_OF_LIST.
you may edit as follows:
FORM XTOP_OF_LIST.
* BREAK-POINT.
WRITE: / 'X_TOP_OF_LIST'.
WRITE: / 'X_TOP_OF_LIST2'.
WRITE: / 'X_TOP_OF_LIST3'.
ENDFORM.Get back to me if u need any clarifications.
Regards.
‎2009 Apr 28 11:05 AM
Hi Arun,
See this code this will help u ,
no need of changes in this jus copy this and paste in ur system thats it this wil print two headers
TYPE-POOLS SLIS .
----
Data Declarations
----
CONSTANTS : C_LEN TYPE I VALUE 20 .
TYPES : BEGIN OF TY_T100 ,
SPRSL TYPE T100-SPRSL ,
ARBGB TYPE T100-ARBGB ,
MSGNR TYPE T100-MSGNR ,
TEXT TYPE T100-TEXT ,
FLINE TYPE T100-TEXT ,
END OF TY_T100 .
TYPES : BEGIN OF TY_WRD ,
TEXT TYPE CHAR20 ,
END OF TY_WRD .
DATA : IT_T100 TYPE TABLE OF TY_T100 ,
IT_SENTENCE TYPE TABLE OF TY_WRD ,
WA_T100 TYPE TY_T100 ,
WA_WORD TYPE TY_WRD ,
V_REPID TYPE SYST-REPID ,
V_TABIX TYPE SYST-TABIX .
DATA : IT_FLD TYPE SLIS_T_FIELDCAT_ALV ,
IT_EVT TYPE SLIS_T_EVENT ,
WA_FLD TYPE SLIS_FIELDCAT_ALV ,
WA_EVT TYPE SLIS_ALV_EVENT ,
WA_LAY TYPE SLIS_LAYOUT_ALV .
----
Initialization
----
INITIALIZATION .
V_REPID = SY-REPID .
----
Start of Selection
----
START-OF-SELECTION .
Get some test data to display in ALV List
SELECT *
INTO TABLE IT_T100
FROM T100
WHERE SPRSL = 'EN'
AND ARBGB = '00' .
LOOP AT IT_T100 INTO WA_T100.
V_TABIX = SY-TABIX .
CLEAR : IT_SENTENCE .
Word Wrap the text in multiple lines
CALL FUNCTION 'RKD_WORD_WRAP'
EXPORTING
TEXTLINE = WA_T100-TEXT
OUTPUTLEN = C_LEN
TABLES
OUT_LINES = IT_SENTENCE.
IF NOT IT_SENTENCE IS INITIAL .
READ TABLE IT_SENTENCE INTO WA_WORD INDEX 1 .
WA_T100-FLINE = WA_WORD-TEXT .
MODIFY IT_T100 FROM WA_T100 INDEX V_TABIX .
ENDIF.
ENDLOOP.
Prepare fieldcatelog
CLEAR WA_FLD .
WA_FLD-FIELDNAME = 'SPRSL' .
WA_FLD-REF_TABNAME = 'T100' .
WA_FLD-REF_FIELDNAME = 'SPRSL' .
APPEND WA_FLD TO IT_FLD .
CLEAR WA_FLD .
WA_FLD-FIELDNAME = 'ARBGB' .
WA_FLD-REF_TABNAME = 'T100' .
WA_FLD-REF_FIELDNAME = 'ARBGB' .
APPEND WA_FLD TO IT_FLD .
CLEAR WA_FLD .
WA_FLD-FIELDNAME = 'MSGNR' .
WA_FLD-REF_TABNAME = 'T100' .
WA_FLD-REF_FIELDNAME = 'MSGNR' .
APPEND WA_FLD TO IT_FLD .
CLEAR WA_FLD .
WA_FLD-FIELDNAME = 'FLINE' .
WA_FLD-INTTYPE = 'CHAR' .
WA_FLD-OUTPUTLEN = 20 .
WA_FLD-INTLEN = 20.
WA_FLD-SELTEXT_L = 'Text' .
WA_FLD-DDICTXT = 'L' .
APPEND WA_FLD TO IT_FLD .
Get event.. we will handle BEFORE and AFTER line output
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
IMPORTING
ET_EVENTS = IT_EVT.
READ TABLE IT_EVT INTO WA_EVT
WITH KEY NAME = SLIS_EV_AFTER_LINE_OUTPUT .
WA_EVT-FORM = SLIS_EV_AFTER_LINE_OUTPUT .
MODIFY IT_EVT FROM WA_EVT INDEX SY-TABIX .
READ TABLE IT_EVT INTO WA_EVT
WITH KEY NAME = SLIS_EV_TOP_OF_PAGE .
WA_EVT-FORM = SLIS_EV_TOP_OF_PAGE .
MODIFY IT_EVT FROM WA_EVT INDEX SY-TABIX .
WA_LAY-NO_COLHEAD = 'X' .
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = V_REPID
IT_FIELDCAT = IT_FLD
IS_LAYOUT = WA_LAY
IT_EVENTS = IT_EVT
TABLES
T_OUTTAB = IT_T100.
----
FORM top_of_page *
----
FORM TOP_OF_PAGE .
ULINE AT 1(58) .
FORMAT COLOR COL_HEADING .
WRITE: / SY-VLINE ,
02 'Header1' ,
10 SY-VLINE ,
11 'Header1' ,
31 SY-VLINE ,
32 'Header1' ,
37 SY-VLINE ,
38 'Header1' ,
58 SY-VLINE .
WRITE: / SY-VLINE ,
02 'Header2' ,
10 SY-VLINE ,
11 'Header2' ,
31 SY-VLINE ,
32 'Header2' ,
37 SY-VLINE ,
38 'Header2' ,
58 SY-VLINE .
ENDFORM. "top_of_page
----
FORM AFTER_LINE_OUTPUT *
----
FORM AFTER_LINE_OUTPUT USING RS_LINEINFO TYPE SLIS_LINEINFO .
CLEAR : IT_SENTENCE ,
WA_T100 .
READ TABLE IT_T100 INTO WA_T100 INDEX RS_LINEINFO-TABINDEX .
CHECK SY-SUBRC = 0 .
CALL FUNCTION 'RKD_WORD_WRAP'
EXPORTING
TEXTLINE = WA_T100-TEXT
OUTPUTLEN = C_LEN
TABLES
OUT_LINES = IT_SENTENCE.
DESCRIBE TABLE IT_SENTENCE LINES V_TABIX .
CHECK V_TABIX > 1 .
LOOP AT IT_SENTENCE INTO WA_WORD FROM 2 .
WRITE: / SY-VLINE ,
10 SY-VLINE ,
31 SY-VLINE ,
37 SY-VLINE ,
38 WA_WORD-TEXT ,
58 SY-VLINE .
ENDLOOP.
ENDFORM . "after_line_output
Thanks
Surendra Reddy
‎2009 Apr 28 1:51 PM
‎2009 Apr 28 1:52 PM
<<copy&paste_removed_by_moderator>>
Edited by: Vijay Babu Dudla on Apr 28, 2009 8:59 AM
‎2009 Apr 28 1:55 PM
<<copy&paste_removed_by_moderator>>
Edited by: Vijay Babu Dudla on Apr 28, 2009 9:00 AM