‎2007 Nov 05 2:48 PM
Hi guys,
I have a requirement where im asked to print data from the table control onto the printer. Any body who has got this kind of requirement earlier or has dealt with these kind of issues, need your valuable ideas on this. This is a bit urgent for me.
Im using a dialog program.
Thanks,
Venkat
‎2007 Nov 05 2:52 PM
Try with this FM : FITRV_PRINT_TABLE_CONTROL_DATA
DATA: pgm LIKE sy-repid,
tc TYPE cxtab_control.
pgm = sy-repid.
tc = table_control. " Your table control name
CALL FUNCTION 'FITRV_PRINT_TABLE_CONTROL_DATA'
EXPORTING
table_control = tc
callback_program = pgm
callback_top_of_list = 'PRINT_TRIP_HEADER' " Make this perform for header
get_curr_quan_fields_from_ddic = ddic_fields " pass blank
optimize_column_width = optimize "pass blank
window_title = title " pass blank
TABLES
print_data = ptab " your data tab
EXCEPTIONS
column_information_missing = 1
printing_not_possible = 2
OTHERS = 3.Regards,
Naimesh Patel
‎2007 Nov 05 3:02 PM
HI Nimesh,
This looks ok and works well, but the problem is its not printing the header data, all the headings its leaving that place as blank. Do you have any suggestion for this. This is the code is used.
DATA: pgm LIKE sy-repid,
tc TYPE cxtab_control.
pgm = sy-repid.
tc = tab.
CALL FUNCTION 'FITRV_PRINT_TABLE_CONTROL_DATA'
EXPORTING
TABLE_CONTROL = tc
CALLBACK_PROGRAM = pgm
CALLBACK_TOP_OF_LIST = 'TABLE_TOP_OF_LIST'
CALLBACK_TOP_OF_PAGE =
CALLBACK_END_OF_PAGE =
CALLBACK_END_OF_LIST =
OPTIMIZE_COLUMN_WIDTH = 'X'
GET_CURR_QUAN_FIELDS_FROM_DDIC = 'X'
WINDOW_TITLE = 'PRINT TABLE'
PRINT_IMMEDIATELY = 'X'
TABLES
PRINT_DATA = ITAB
EXCEPTIONS
COLUMN_INFORMATION_MISSING = 1
PRINTING_NOT_POSSIBLE = 2
OTHERS = 3
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Thanks,
Venkat
‎2007 Nov 05 3:12 PM
Have you created a form with name 'TABLE_TOP_OF_LIST' ?
Like:
FORM TABLE_TOP_OF_LIST.
write: /(10) 'I am title'.
endform.
Regards,
Naimesh Patel
‎2007 Nov 05 3:19 PM
But nimesh there is a blank header line being printed at the top how to prevent that from printing.
Thanks,
Venkat.
‎2007 Nov 05 3:25 PM
Sorry, yes i did create a subroutine with that name but i was thinking instead we could print that thing in the blank header itself. Actually what is happening now is,
I have all the data lines which has data in it, but along with that i also have a blank header line with that, this line is additional line with all spaces in them. I was thinking that we could some how print the headers in them instead of using subroutine which would pirnt above the table .
‎2007 Nov 05 3:30 PM
Sorry, I don't have much idea about that.
Regards,
Naimesh Patel
‎2015 Sep 18 1:31 PM
Hi everybody,
I know that the problem has been solved a couple years ago by copying and adjusting FM, but for anybody that googles out this thread there's an easier workaround.
The thing with blank header is that most probably table control displays data from internal table declared with TYPES in the program (at least that was my case). FM FITRV_PRINT_TABLE_CONTROL_DATA makes its own "FIELDCATALOG_MERGE" (so do speak) and tries to find display characteristics in DDIC, but it can't find any.
There are 2 fixes:
- base your table control on DDIC
- if you can't for some reason, before FM call replace your program structure name with DDIC structure name. It's kept in tc parameter (table control). It has a field COLS, which is a table of columns from your table control. Each line in COLS has a field SCREEN, and there there's field NAME, where "[STRUCT]-[FIELD]" sits. Just replace STRUCT with your DDIC structure name and you're good to go.
‎2007 Nov 06 2:45 PM
I copied and changed the same function module to suit to my needs and that helped solve my problem