‎2008 Jun 19 6:41 AM
Hi,
I have developed a module pool program which contains a table control in it.
I have a requriement where in I need to print the conents of the table control.
Please could anyone help me out with this.
Regards,
Sushanth H.S.
‎2008 Jun 19 6:43 AM
‎2008 Jun 19 7:14 AM
hi,
you can use below mentioned function module to convert table controls internal table into a spool.
& from spool number received you can take print from SP01.
Function module is 'SLVC_TABLE_PS_TO_SPOOL'.
‎2008 Jun 19 9:11 AM
Hi,
When I use the function module SLVC_TABLE_PS_TO_SPOOL, it is giving me a short dump.
The reason for this is that the internal table of the table control is not of type LVC_S_1022 .
Please can you help me with this.
Regards,
Sushanth H.S.
‎2008 Jun 19 9:42 AM
You could simply try writing the data to a list (usual leave to list-processing approach), but preceeding the output with a "new-page print on" type setup... the code below was borrowed from the online help... in your cae, just loop at the internal table tha represents the table control contents and list that out.
Jonathan
report demo.
data: spfli_wa type spfli,
sflight_wa type sflight.
data: print_parameters type pri_params,
valid_flag type c length 1.
start-of-selection.
call function 'GET_PRINT_PARAMETERS'
importing
out_parameters = print_parameters
valid = valid_flag
exceptions
invalid_print_params = 2
others = 4.
if valid_flag = 'X' and sy-subrc = 0.
select carrid connid
from spfli
into corresponding fields of spfli_wa.
write: / spfli_wa-carrid, spfli_wa-connid.
hide: spfli_wa-carrid, spfli_wa-connid.
endselect.
else.
...
endif.
at line-selection.
new-page print on parameters print_parameters
no dialog.
select *
from sflight
into sflight_wa
where carrid = spfli_wa-carrid and
connid = spfli_wa-connid.
write: / sflight_wa-carrid, sflight_wa-connid,
sflight_wa-fldate ...
endselect.
new-page print off.
‎2008 Jun 19 10:12 AM
Hi,
In the Table control screen (main screen) place print/print preview button. if this is selected, provide an ALV list output withe the table contrao contents. The ALV will have the standard print functionality, using that we can print the data.
Standard SAP is also foloowing the same way, if you observe ant table maintenace view (SM30) it will have the table control, There if you perform print, it will take you to the ALV list output in next screen. There you can print the data.
Thanks,
Rajinikanth.
‎2008 Jun 20 12:31 PM
hi frnds
my requirement is in table control if i enter the data it should go and sit in DB table.
now the problem is wer to write code in pbo r pai.
plz gve the sample code........
Do we need create a structure for dat......
?
‎2008 Jun 24 4:08 AM
Hi,
You will have to write the code in the PAI for the given task.
I will just write the pseudocode for you.
For example:-
In PAI,
CASE SY-UCOMM.
WHEN 'ENTER'.
IF IT IS A NEW ENTRY.
INSERT DATABASE TABLE FROM THE INTERNAL TABLE.
(YOU WILL HAVE TO DECLARE AN INTERNAL TABLE
WHOSE DATA TYPE IS THE SAME AS THE DATABASE
TABLE ).
IF SY-SUBRC = 0.
COMMIT WORK.
ELSE.
ROLLBACK WORK.
ENDIF.
ELSE.
UPDATE DATABASE TABLE FROM INTERNAL TABLE.
IF SY-SUBRC = 0 .
COMMIT WORK.
ELSE
DELETE FROM DATABASE TABLE WHERE KEY =
TABLE-CONTROL ENTRY.
INSERT FROM DATABASE TABLE WHERE KEY =
TABLE-CONTROL ENTRY.
IF SY-SUBRC = 0 .
COMMIT WORK.
ELSE.
ROLLBACK WORK.
ENDIF.
ENDIF.