08-13-2008 8:27 PM
Hi,
How can I display table in report?
Can anyone provide me a sample code for it?
For example I have table named my_table. It has three column and three entries.
Data: name TYPE SYUNAME,
start_date TYPE SYDATE,
end_date TYPE SYDATE.
name start_date end_date
MBOORE 01.07.2008 31.07.2008
JDUFFY 15.07.2008 10.08.2008
JVNSOLD 01.06.2008 20.07.2008
DATA my_table TYPE TABLE OF my_table WITH HEADER LINE.
LOOP AT my_table INTO my_table.
WRITE:/ sy-vline,
my_table-name,
10 sy-vline,
my_table-start_date,
20 sy-vline,
my_table-end_date,
20 sy-vline.
uline.
ENDLOOP.
How can I display the colomn name(name, start_date, end_date) also in report?
Thanks,
Anup
08-19-2008 3:54 AM
Hi, anup
Sorry for replying you so late.
I have read your code and you said you want to search a general way to display the report header.
Actually it's unneccessary to use two forms "display_header1", "display_header2". You can just use one
form "display_header" to display different situation. In the form you can use variables instead of hard code.
I see you have three local variables "username, start_date, end_date", maybe you can change them into
global variables and define one more variable "function_result". And in the form you can write code like this:
FORM display_header.
w_header-typ = 'H'.
"After you run the function, function_result variable should be given value.
w_header-info = function_result.
APPEND w_header TO i_header.
CLEAR w_header.
w_header-typ = 'S'.
CONCATENATE 'Where User Name - ' username INTO w_header-info.
APPEND w_header TO i_header.
CLEAR w_header.
w_header-typ = 'S'.
CONCATENATE 'Start Date - ' start_date INTO w_header-info.
APPEND w_header TO i_header.
CLEAR w_header.
w_header-typ = 'S'.
CONCATENATE 'End Date - ' end_date INTO w_header-info.
APPEND w_header TO i_header.
CLEAR w_header.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = i_header
.
ENDFORM. "display_header
08-13-2008 9:04 PM
Use TOP-OF-PAGE event for your requirement. Check Online help for more info about it.
Like:
TOP-OF-PAGE.
WRITE:/ sy-vline,
'Name',
10 sy-vline,
'Start Date',
20 sy-vline,
'End Date',
30 sy-vline.
Regards,
Naimesh Patel
08-13-2008 9:05 PM
Hi,
Data:begin of my_table occurs 0,
name TYPE SYUNAME,
start_date TYPE SYDATE,
end_date TYPE SYDATE,
end of mY_table.
my_table-name = 'MBOORE'.
Move '01082008' to my_table-start_date.
Move '31082008' to my_table-end_date.
append my_table.
clear: my_table.
my_table-name = 'JDUFFY'.
Move '15072008' to my_table-start_date.
Move '10082008' to my_table-end_date.
append my_table.
clear: my_table.
my_table-name = 'JVNSOLD'.
Move '15072008' to my_table-start_date.
Move '10082008' to my_table-end_date.
append my_table.
clear: my_table.
write:/ sy-uline(50).
write:/ sy-vline, 3 'Name', 17 sy-vline, 19 'Start date',
30 sy-vline, 32 'Enddate', 50 sy-vline.
LOOP AT my_table INTO my_table.
write:/ sy-uline(50).
WRITE:/ sy-vline, 3 my_table-name, 17 sy-vline, 19
my_table-start_date,
30 sy-vline, 32 my_table-end_date, 50 sy-vline.
ENDLOOP.
write:/ sy-uline(50).
Regards,
Venkatesh
08-13-2008 9:05 PM
Hi,
Data:begin of my_table occurs 0,
name TYPE SYUNAME,
start_date TYPE SYDATE,
end_date TYPE SYDATE,
end of mY_table.
my_table-name = 'MBOORE'.
Move '01082008' to my_table-start_date.
Move '31082008' to my_table-end_date.
append my_table.
clear: my_table.
my_table-name = 'JDUFFY'.
Move '15072008' to my_table-start_date.
Move '10082008' to my_table-end_date.
append my_table.
clear: my_table.
my_table-name = 'JVNSOLD'.
Move '15072008' to my_table-start_date.
Move '10082008' to my_table-end_date.
append my_table.
clear: my_table.
write:/ sy-uline(50).
write:/ sy-vline, 3 'Name', 17 sy-vline, 19 'Start date',
30 sy-vline, 32 'Enddate', 50 sy-vline.
LOOP AT my_table INTO my_table.
write:/ sy-uline(50).
WRITE:/ sy-vline, 3 my_table-name, 17 sy-vline, 19
my_table-start_date,
30 sy-vline, 32 my_table-end_date, 50 sy-vline.
ENDLOOP.
write:/ sy-uline(50).
regards,
Venkatesh
08-14-2008 3:54 AM
Hi,
Thanks for a very good sample code.
I have one doubt. In my real scenario I have 10-12 column. I did in the way you suggested. I am able to see only first 5-6 column name on screen due to big length. How can I add scrolling option there? So can see all column.
Thanks again,
Anup Garg
08-13-2008 9:35 PM
08-14-2008 3:50 AM
Hi,
Can you please let me know about ALV report? From where I can get this format detail. It will be very-2 helpful if get any sample ALV report?
Thanks,
Anup Garg
08-14-2008 4:02 AM
before loop statement use
write:/1 sy-vline,2 'Name',
20 sy-vline,30 'startsate',
40 sy-vline,50 'enddate' .
ok bye...
08-14-2008 4:08 AM
Hi
Maybe you can try to display using ALV. In this way you need't consider about scrolling. It will do this
automatically. Here is the sample code for ALV.
TYPE-POOLS: slis.
TYPES:
BEGIN OF ty_test,
name TYPE syuname,
start_date TYPE sydate,
end_date TYPE sydate,
END OF ty_test.
TYPES:
ty_tb_test TYPE STANDARD TABLE OF ty_test.
DATA:
i_test TYPE ty_tb_test,
w_test TYPE ty_test,
i_fieldcat TYPE slis_t_fieldcat_alv,
w_fieldcat TYPE LINE OF slis_t_fieldcat_alv.
START-OF-SELECTION.
PERFORM fill_data.
PERFORM field_define.
PERFORM display_alv.
FORM fill_data.
w_test-name = 'MBOORE'.
w_test-start_date = '20080701'.
w_test-end_date = '20080731'.
APPEND w_test to i_test.
CLEAR w_test.
w_test-name = 'JDUFFY'.
w_test-start_date = '20080715'.
w_test-end_date = '20080810'.
APPEND w_test to i_test.
CLEAR w_test.
w_test-name = 'JVNSOLD'.
w_test-start_date = '20080601'.
w_test-end_date = '20080720'.
APPEND w_test to i_test.
CLEAR w_test.
ENDFORM.
FORM field_define.
w_fieldcat-fieldname = 'NAME'."
w_fieldcat-seltext_l = 'name'."name of column displayed in alv report
APPEND w_fieldcat TO i_fieldcat.
CLEAR w_fieldcat.
w_fieldcat-fieldname = 'START_DATE'.
w_fieldcat-seltext_l = 'start_date'.
APPEND w_fieldcat TO i_fieldcat.
CLEAR w_fieldcat.
w_fieldcat-fieldname = 'END_DATE'.
w_fieldcat-seltext_l = 'end_date'.
APPEND w_fieldcat TO i_fieldcat.
CLEAR w_fieldcat.
ENDFORM.
FORM display_alv.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
IT_FIELDCAT = i_fieldcat
TABLES
t_outtab = i_test
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.
08-14-2008 12:38 PM
Hi,
Thanks a lot, I am able to display table in ALV format.
I have one more requirement.
Actually I am preparing a report for testing 10 function module.
For that I have created 10 radio button(fun1, fun2, etc). If I select first radio button say fun1 and excute, it should show the outut of that function module. Input for that function module I have hard coded so user need not to enter it. I have created all possible test cases(Success test cases and failed test case) for the function module.
My requirement is this when it show the ouput table of any test case in ALV format. It should write test case detail in proper format at top of the table.
Say
This test case has been passed.
Where User Name - MBOORE
Start Date - 01.07.2008
End Date - 31.07.2008
Is there any general format or function for these, every time call that only passing variable. Where variable value will be assigned as per test cases.
Thanks,
Anup Garg
08-14-2008 4:30 AM
08-14-2008 12:49 PM
hi
i give one example
FORM DISPLAY_DOCNUMBERS.
SKIP 2.
WRITE:/1 'Following document numbers are generated!'.
WRITE:/1(18) SY-ULINE.
WRITE:/1(1) SY-VLINE,
2(5) 'Plant',
7(1) SY-VLINE,
8(10) 'Doc.Number',
18(1) SY-VLINE.
WRITE:/1(18) SY-ULINE.
LOOP AT T_WERKS.
WRITE:/1(1) SY-VLINE,
2(5) T_WERKS-WERKS,
7(1) SY-VLINE,
8(10) T_WERKS-BELNR,
18(1) SY-VLINE.
ENDLOOP.
WRITE:/1(18) SY-ULINE.
ENDFORM. " DISPLAY_DOCNUMBERS
08-15-2008 3:29 AM
Hi, anup
I am not very clear about your requirement. From your description what I knows is that you want to
display the input details in the head of ALV report. For this point you can reference the following code. But
I can't understand what's your meaning about get input from each test case as variant.
TYPE-POOLS: slis.
TYPES:
BEGIN OF ty_test,
name TYPE syuname,
start_date TYPE sydate,
end_date TYPE sydate,
END OF ty_test.
TYPES:
ty_tb_test TYPE STANDARD TABLE OF ty_test.
DATA:
i_test TYPE ty_tb_test,
w_test TYPE ty_test,
i_fieldcat TYPE slis_t_fieldcat_alv,
w_fieldcat TYPE LINE OF slis_t_fieldcat_alv,
i_header TYPE slis_t_listheader,
w_header TYPE LINE OF slis_t_listheader.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
PARAMETERS: name TYPE syuname,
start TYPE sydate,
end TYPE sydate.
SELECTION-SCREEN END OF BLOCK b1.
START-OF-SELECTION.
PERFORM fill_data.
PERFORM field_define.
PERFORM display_alv.
******************************************************************************
*This form is used to fill the output data. Here you can use the internal
*table returned from function module. This internal table contains the result
*after function module execute.
******************************************************************************
FORM fill_data.
w_test-name = 'MBOORE'.
w_test-start_date = '20080701'.
w_test-end_date = '20080731'.
APPEND w_test to i_test.
CLEAR w_test.
w_test-name = 'JDUFFY'.
w_test-start_date = '20080715'.
w_test-end_date = '20080810'.
APPEND w_test to i_test.
CLEAR w_test.
w_test-name = 'JVNSOLD'.
w_test-start_date = '20080601'.
w_test-end_date = '20080720'.
APPEND w_test to i_test.
CLEAR w_test.
ENDFORM.
FORM field_define.
w_fieldcat-fieldname = 'NAME'."
w_fieldcat-seltext_l = 'name'."name of column displayed in alv report
APPEND w_fieldcat TO i_fieldcat.
CLEAR w_fieldcat.
w_fieldcat-fieldname = 'START_DATE'.
w_fieldcat-seltext_l = 'start_date'.
APPEND w_fieldcat TO i_fieldcat.
CLEAR w_fieldcat.
w_fieldcat-fieldname = 'END_DATE'.
w_fieldcat-seltext_l = 'end_date'.
APPEND w_fieldcat TO i_fieldcat.
CLEAR w_fieldcat.
ENDFORM.
FORM display_alv.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_top_of_page = 'DISPLAY_HEADER'
IT_FIELDCAT = i_fieldcat
TABLES
t_outtab = i_test
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.
FORM display_header.
w_header-typ = 'H'.
w_header-info = 'This test case has been passed'."result of executing function module can be judged.
APPEND w_header TO i_header.
CLEAR w_header.
w_header-typ = 'S'.
CONCATENATE 'Where User Name - ' name INTO w_header-info.
APPEND w_header TO i_header.
CLEAR w_header.
w_header-typ = 'S'.
CONCATENATE 'Start Date - ' start INTO w_header-info.
APPEND w_header TO i_header.
CLEAR w_header.
w_header-typ = 'S'.
CONCATENATE 'End Date - ' end INTO w_header-info.
APPEND w_header TO i_header.
CLEAR w_header.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = i_header
* I_LOGO =
* I_END_OF_LIST_GRID =
* I_ALV_FORM =
.
ENDFORM.
08-15-2008 10:54 AM
Hi Alex,
Thanks for code. Now I am able to display the heading at top of the output.
I am not providing input through selection screen, it is hard coded. For example I am sending code where I am testing one function module for two test cases. Similarly I need to do for 10 function module. I am looking for general way. Here for test case one I am calling display_header1 and for second test case display_header2
Here Timespec_id type GUID_32.
REPORT ZRPA_FM_TSET_ALV_REPORT.
TYPE-POOLS: slis.
DATA: i_header TYPE slis_t_listheader,
w_header TYPE LINE OF slis_t_listheader.
DATA: ET_TIMESPEC TYPE TABLE OF ZTIMESPEC_STR WITH HEADER LINE.
SELECTION-SCREEN begin of block choice with frame title function.
PARAMETERS: t_reload RADIOBUTTON GROUP test,
t_lstget RADIOBUTTON GROUP test.
SELECTION-SCREEN end of block choice.
IF NOT t_reload IS INITIAL.
PERFORM test_fun1.
ENDIF.
IF NOT t_lstget IS INITIAL.
PERFORM test_fun2.
ENDIF.
&----
*& Form test_fun1
&----
text
----
FORM test_fun1 .
DATA:
i_test TYPE TABLE OF ZTIMESPEC_STR,
i_fieldcat TYPE slis_t_fieldcat_alv,
w_fieldcat TYPE LINE OF slis_t_fieldcat_alv.
DATA: username TYPE SYUNAME,
start_date TYPE SYSTDATLO,
end_date TYPE SYSTDATLO.
username = 'MBOORE'.
start_date = '20080701'.
end_date = '20080831'.
CALL FUNCTION 'Z_TIMESPEC_RELOAD'
EXPORTING
USERNAME = username
START_DATE = start_date
END_DATE = end_date
TABLES
ET_TIMESPEC = ET_TIMESPEC.
append LINES OF ET_TIMESPEC to i_test.
w_fieldcat-fieldname = 'TIMESPEC_ID'."
w_fieldcat-seltext_l = 'TIMESPEC_ID'."name of column displayed in alv report
APPEND w_fieldcat TO i_fieldcat.
CLEAR w_fieldcat.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_top_of_page = 'DISPLAY_HEADER'
IT_FIELDCAT = i_fieldcat
TABLES
t_outtab = i_test
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.
refresh ET_TIMESPEC.
username = 'JDUFFY'.
start_date = '20080710'.
end_date = '20080831'.
CALL FUNCTION 'Z_TIMESPEC_RELOAD'
EXPORTING
USERNAME = username
START_DATE = start_date
END_DATE = end_date
TABLES
ET_TIMESPEC = ET_TIMESPEC.
REFRESH i_test.
CLEAR i_header.
append LINES OF ET_TIMESPEC to i_test.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_top_of_page = 'DISPLAY_HEADER2'
IT_FIELDCAT = i_fieldcat
TABLES
t_outtab = i_test
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. "test_fun1
&----
*& Form display_header
&----
text
----
FORM display_header.
w_header-typ = 'H'.
w_header-info = 'This test case has been passed'."result of executing function module can be judged.
APPEND w_header TO i_header.
CLEAR w_header.
w_header-typ = 'S'.
MOVE 'Where User Name - MBOORE' to w_header-info.
APPEND w_header TO i_header.
CLEAR w_header.
w_header-typ = 'S'.
MOVE 'Start Date - 20080701' TO w_header-info.
APPEND w_header TO i_header.
CLEAR w_header.
w_header-typ = 'S'.
MOVE 'End Date - 20080801' TO w_header-info.
APPEND w_header TO i_header.
CLEAR w_header.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = i_header
I_LOGO =
I_END_OF_LIST_GRID =
I_ALV_FORM =
.
ENDFORM. "display_header
&----
*& Form display_header2
&----
text
----
FORM display_header2.
w_header-typ = 'H'.
w_header-info = 'This test case has been passed'."result of executing function module can be judged.
APPEND w_header TO i_header.
CLEAR w_header.
w_header-typ = 'S'.
MOVE 'Where User Name - JDUFFY' to w_header-info.
APPEND w_header TO i_header.
CLEAR w_header.
w_header-typ = 'S'.
MOVE 'Start Date - 20080710' TO w_header-info.
APPEND w_header TO i_header.
CLEAR w_header.
w_header-typ = 'S'.
MOVE 'End Date - 20080831' TO w_header-info.
APPEND w_header TO i_header.
CLEAR w_header.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = i_header
I_LOGO =
I_END_OF_LIST_GRID =
I_ALV_FORM =
.
ENDFORM. "displ
Code for function Z_TIMESPEC_RELOAD
Here ZTIMESPEC_STR has one component
Component Component type Data type Length
TIMESPEC_ID GUID_32 CHAR 32
FUNCTION Z_TIMESPEC_RELOAD.
*"----
""Local Interface:
*" IMPORTING
*" VALUE(USERNAME) TYPE SYUNAME OPTIONAL
*" VALUE(START_DATE) TYPE SYSTDATLO OPTIONAL
*" VALUE(END_DATE) TYPE END_DATE OPTIONAL
*" TABLES
*" ET_TIMESPEC STRUCTURE ZTIMESPEC_STR
*"----
DATA: BUSINESS_PARTNER TYPE GUID_32,
BP_GUID TYPE TABLE OF CRM_LRP_BP WITH HEADER LINE,
IUSER TYPE TABLE OF USR01 WITH HEADER LINE,
BEG_TSTMP TYPE TIMESTAMP,
END_TSTMP TYPE TIMESTAMP,
ET_RES_TIMEINT TYPE TABLE OF CRM_LRP_RES_TIMEINT ,
es_res_timeint type CRM_LRP_RES_TIMEINT,
lt_timespec type table of ZTIMESPEC_STR,
ls_timespec type ZTIMESPEC_STR,
str type string.
IF username = 'CURRENT'.
CALL FUNCTION 'CRM_LRP_GET_BP_FOR_USER'
EXPORTING
USER_NAME = USERNAME
TABLES
BUSINESS_PARTNER = BP_GUID
EXCEPTIONS
USER_NOT_FOUND = 1
WEGID_NOT_FOUND = 2
NO_ACTIVE_PLANVERSION = 3
NO_RESOURCES_FOUND = 4
OTHERS = 5.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
if BP_GUID is not initial.
READ TABLE BP_GUID INDEX 1.
BUSINESS_PARTNER = BP_GUID-ID.
endif.
ELSEIF username <> ' '.
condense username.
translate username to upper case.
SELECT * FROM USR01 INTO TABLE IUSER WHERE BNAME = USERNAME.
IF SY-SUBRC <> 0.
EXIT.
ENDIF.
CALL FUNCTION 'CRM_LRP_GET_BP_FOR_USER'
EXPORTING
USER_NAME = USERNAME
TABLES
BUSINESS_PARTNER = BP_GUID
EXCEPTIONS
USER_NOT_FOUND = 1
WEGID_NOT_FOUND = 2
NO_ACTIVE_PLANVERSION = 3
NO_RESOURCES_FOUND = 4
OTHERS = 5.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
if BP_GUID is not initial.
READ TABLE BP_GUID INDEX 1.
BUSINESS_PARTNER = BP_GUID-ID.
endif.
ELSE.
BUSINESS_PARTNER = ' '.
ENDIF.
if business_partner is not initial.
concatenate start_date '000000' into str.
beg_tstmp = str.
endif.
if business_partner is not initial.
concatenate end_date '235900' into str.
end_tstmp = str.
endif.
data: IT_RESOURCE_KEY TYPE /SAPAPO/LRP_KEY_TAB,
lt_resource_sys TYPE /SAPAPO/LRP_RESOURCE_LIST,
et_invalid_resource_key TYPE /SAPAPO/LRP_GUID_EXT_TAB.
it_resource_key[] = BP_GUID[].
TRY.
CALL METHOD /sapapo/cl_lrp_resource_fct=>find_by_external_keys
EXPORTING
resource_keys = it_resource_key
IMPORTING
resources = lt_resource_sys
invalid_keys = et_invalid_resource_key.
data: l_resource TYPE REF TO /sapapo/if_lrp_resource,
l_resource_key TYPE /sapapo/lrp_guid_ext.
LOOP AT lt_resource_sys INTO l_resource.
l_resource_key = l_resource->get_external_key( ).
ENDLOOP.
DATA: SUPWD type ref to /SAPAPO/IF_LRP_SUPWD,
WDTIME type ref to /SAPAPO/IF_LRP_SUPWD_TIME.
SUPWD ?= l_resource->GET_SUPPLIED_PROFILE( ).
if supwd is not INITIAL.
WDTIME ?= SUPWD->GET_WDTIME( ).
endif.
*----
find the corresponding LRP resources by FIND_IN_RANGE
*----
DATA: timespecs TYPE /sapapo/lrp_if_sup_timespc_tab,
timespec_single Type REF TO /SAPAPO/IF_LRP_SUP_TIMESPC.
CLEAR:
ET_TIMESPEC[],
lt_timespec[].
CALL METHOD /sapapo/cl_lrp_sup_timespc_fct=>FIND_IN_RANGE
EXPORTING
I_WDTIME = WDTIME
I_BEG_TSTMP = beg_tstmp
I_END_TSTMP = end_tstmp
I_EXCEED_RANGE = ''
I_EXCEPTIONS_ONLY = ''
RECEIVING
ET_TIMESPEC = timespecs.
LOOP at timespecs into timespec_single.
ls_timespec-TIMESPEC_ID = timespec_single->GET_EXTERNAL_KEY( ).
append ls_timespec to lt_timespec.
ENDLOOP.
sort lt_timespec.
delete adjacent duplicates from lt_timespec .
ET_TIMESPEC[] = lt_timespec[].
CATCH /SAPAPO/CX_LRP_ERROR.
ENDTRY.
ENDFUNCTION.
Thanks,
Anup
08-19-2008 3:54 AM
Hi, anup
Sorry for replying you so late.
I have read your code and you said you want to search a general way to display the report header.
Actually it's unneccessary to use two forms "display_header1", "display_header2". You can just use one
form "display_header" to display different situation. In the form you can use variables instead of hard code.
I see you have three local variables "username, start_date, end_date", maybe you can change them into
global variables and define one more variable "function_result". And in the form you can write code like this:
FORM display_header.
w_header-typ = 'H'.
"After you run the function, function_result variable should be given value.
w_header-info = function_result.
APPEND w_header TO i_header.
CLEAR w_header.
w_header-typ = 'S'.
CONCATENATE 'Where User Name - ' username INTO w_header-info.
APPEND w_header TO i_header.
CLEAR w_header.
w_header-typ = 'S'.
CONCATENATE 'Start Date - ' start_date INTO w_header-info.
APPEND w_header TO i_header.
CLEAR w_header.
w_header-typ = 'S'.
CONCATENATE 'End Date - ' end_date INTO w_header-info.
APPEND w_header TO i_header.
CLEAR w_header.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = i_header
.
ENDFORM. "display_header
08-19-2008 1:59 PM
Hi Alex,
Thanks a lot for your patience and help.
I will try this and will let you know.
Thanks again,
Anup Garg