07-31-2009 8:59 AM
Hi experts,
In ALV OO, when chose some rows, how to print or export to excel just with them? That is we dont print all of rows which display on ALV list, just print some rows which are chosen.
Thanks in advance.
07-31-2009 9:28 AM
Hai,
Here i am actually printing the header and item records, the header row is selected (gt_eqcrh) and the respective item records are in the table gt_eqcri.
Have a look at this code:
WHEN 'PRINT'.
// I have actually made it with the Table Controls but not ALV. So to read the contents of the selected record of ALV, use the
get_selected_rows method:) instead of READ statement//
READ table gt_eqcrh into gtw_eqcrh with key mark = 'X'.
IF sy-subrc = 0.
EXPORT gt_eqcrh to Memory ID 'EQH'.
EXPORT gt_eqcri to Memory ID 'EQI'.
ENDIF.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
layout = 'X_65_132'
line_count = 65
line_size = 132
destination = 'LOCL'
report = '/SAXAG/CM_DARLEHEN_PRINT'
list_name = 'NEW-LIST'
immediately = sy-primm
copies = '1'
with_structure = 'X'
IMPORTING
out_parameters = pripar
out_archive_parameters = arcpar
valid = val
EXCEPTIONS
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
OTHERS = 4.
IF val <> space AND sy-subrc = 0.
SUBMIT /SAXAG/CM_DARLEHEN_PRINT TO SAP-SPOOL
SPOOL PARAMETERS pripar
WITHOUT SPOOL DYNPRO.
My requirement was to print the content as if it were on a Normal List. Thats the reason why i have written a new program /SAXAG/CM_DARLEHEN_PRINT where i import the data from the previous program and write them on the Basic list, which will be printed.
Hope it helps you.
Best Regards,
rama