2014 Jan 29 8:22 AM
Hi all,
this is naresh.
i want a solution to my issue.
requirement is header in ALV GRID should be as follows.
________________________________________________________________
contribution list
company name scorg
employer number 12345 year 2013
month 12
number of employess 10
________________________________________________________________
i can able to print the text and values but not in this format.
alignments and spaces r missing starting and between those values.
can any1 share the code for this?
thanks,
naresh.
Hi all,
this is naresh.
i want a solution to my issue.
requirement is header in ALV GRID should be as follows.
________________________________________________________________
contribution list
company name scorg
employer number 12345 year 2013
month 12
number of employess 10
________________________________________________________________
i can able to print the text and values but not in this format.
alignments and spaces r missing starting and between those values.
can any1 share the code for this?
thanks,
naresh.
2014 Jan 29 8:24 AM
Hi Naresh
In case you want to have an aligned table like header use I_HTML_TOP_OF_PAGE. Search on SCN for details
Nabheet
2014 Jan 30 2:02 PM
this is good ..
i think you can set colors too ,
remember i did this long back...
2014 Jan 29 8:38 AM
Hi Naresh,
If you want to concatenate spaces on the left or on the right, you can't use a CHAR variable, because It won't works.
To add spaces, you should try to use a STRING variable.
Best regards.
2014 Jan 29 8:44 AM
Hi Naresh,
use this code...
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
* is_layout = gW_layout
* I_CALLBACK_TOP_OF_PAGE = 'F_TOP_OF_PAGE'
i_callback_html_top_of_page = 'F_TOP_OF_PAGE' " Please give this
* I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
* I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'
it_fieldcat = gt_fieldcat
* IT_EVENTS = GT_EVENT
TABLES
t_outtab = gt_final
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.
FORM f_top_of_page 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,
date1 TYPE sy-datum.
TYPES: BEGIN OF tab_text,
text TYPE sdydo_text_element,
END OF tab_text.
DATA: i_text TYPE TABLE OF tab_text,
w_text TYPE tab_text.
DATA: lv_month(2) TYPE c,
lv_year(4) TYPE c,
lv_month_name TYPE t247-ktx.
CALL FUNCTION 'CACS_DATE_GET_YEAR_MONTH'
EXPORTING
i_date = pnpdisbd
IMPORTING
e_month = lv_month
e_year = lv_year.
SELECT SINGLE ktx FROM t247
INTO lv_month_name
WHERE mnr EQ lv_month
AND spras = sy-langu.
CALL METHOD r_top->initialize_document.
CALL METHOD r_top->vertical_split
EXPORTING
split_area = r_top
split_width = '80%'
IMPORTING
right_area = c_area.
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.
CALL METHOD r_top->add_gap
EXPORTING
width = 80.
text = 'ABC COMPANY LTD'.
CALL METHOD r_top->add_text
EXPORTING
text = text
sap_style = 'HEADING'
sap_emphasis = 'STRONG'.
CALL METHOD r_top->new_line.
CALL METHOD r_top->new_line.
CALL METHOD r_top->add_gap
EXPORTING
width = 90.
CONCATENATE 'Income Tax Report for Month of '
lv_month_name '-'
lv_year
INTO text SEPARATED BY space.
CALL METHOD r_top->add_text
EXPORTING
text = text
sap_fontsize = 'MEDIUM'
sap_emphasis = 'STRONG'.
ENDFORM. " F_TOP_OF_PAGE
It resolves your issue
Thanks
Vijay SR
2014 Jan 29 9:37 AM
Hi all,
i am sharing screen shot. like this the data need to print at header part in ALV GRID.
have any solutions?
thanks,
naresh.
2014 Jan 29 9:42 AM
Hi Naresh,
Have a look into the URL:
http://wiki.scn.sap.com/wiki/display/ABAP/Displaying+TOP-OF-PAGE+at+Right,+Center+and+Left
Hope it might help you. Revert back in case of queries.
With Regards,
Giriesh M
2014 Jan 29 11:57 AM
Hi giriesh,
helpful information.
i am able to get top as centre only.
down part iam unable to get as what i required.
down part is not right or left aligned completely but it is only single line but need spaces between them.
please do the needful.
regards,
naresh.
2014 Jan 30 6:20 AM
Hi Giriesh,
i am sorry, i gone to that code properly and able to get my requirement, but the header part is not printing in the spool.
in ALV, the header part got exact to my requirement but while priniting header is missing.
can u help regarding this?
regards,
Naresh.
2014 Jan 30 2:00 PM
break the area into two containers ,
and display your text using labels or , any thing you want ,
when conventional things don't work for your solution , think otherwise.
two containers in the top area side by side for your texts ,
another in the second row to display alv ,
but this wont work if you are using older fms to display , use oo alv with custom containers.