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

concatenate with space initially

Former Member
0 Likes
1,643

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.

9 REPLIES 9
Read only

nabheetscn
SAP Champion
SAP Champion
0 Likes
1,563

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

Read only

0 Likes
1,563

this is good ..

i think you can set colors too ,

remember i did this long back...

Read only

adrian_mejido
Contributor
0 Likes
1,563

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.

Read only

Former Member
0 Likes
1,563

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

Read only

Former Member
0 Likes
1,563

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.

Read only

0 Likes
1,563

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

Read only

0 Likes
1,563

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.

Read only

0 Likes
1,563

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.

Read only

sriharsha_parayatham
Participant
0 Likes
1,563

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.