2008 Jul 24 1:19 PM
hello everyone,
i want to create a spool req no for selected records ,after clicking user defined button on application tool bar of alv grid display, i can create request number for all records ,but i cannot for selected records.can any one help me out.
thanks and regards,
gopaludu
hello everyone,
i want to create a spool req no for selected records ,after clicking user defined button on application tool bar of alv grid display, i can create request number for all records ,but i cannot for selected records.can any one help me out.
thanks and regards,
gopaludu
2008 Jul 25 4:28 AM
Hi,
I don't know if there is a way to print only selected records of an ALV grid. But you can delete the unselected records and display only the selected ones then create a spool req for them.
Regards,
Teddy
2008 Jul 25 5:59 AM
Hi,
Check the following sample code.
WHEN 'PRINT'.
CLEAR : wa_final_prnt, wt_final_prnt[].
wa_final_prnt-loevm = text-S25."'Deletion flag'.
wa_final_prnt-crsid = text-s01."'CRSID'.
wa_final_prnt-ktokd = text-s02."'Acct Grp'.
wa_final_prnt-name1 = text-s03. "'Name1'.
wa_final_prnt-name2 = text-s04. "'Name2'.
wa_final_prnt-name3 = text-s05. "'Name3'.
wa_final_prnt-name4 = text-s06. "'Name4'.
wa_final_prnt-stras = text-s07."'Street'.
wa_final_prnt-ort01 = text-s08."'City'.
wa_final_prnt-regio = text-s09."'Region'.
wa_final_prnt-pstlz = text-s10."'Postal Code'.
wa_final_prnt-pfach = text-s11."'PO Box'.
wa_final_prnt-land1 = text-s12."'Country'.
wa_final_prnt-telf1 = text-s13."'Phone'.
wa_final_prnt-loc_nr = text-s14."'Locator ID'.
wa_final_prnt-sblock = text-s15."'Sales Order Block CD'.
wa_final_prnt-dblock = text-s16."'Delivery Block CD'.
wa_final_prnt-bblock = text-s17."'Billing CD'.
wa_final_prnt-cle_id_nr = text-s18."'CLE ID'.
wa_final_prnt-cle_nm = text-s19."'CLE Name'.
wa_final_prnt-op_cust_nr = text-s20."'CBN'.
wa_final_prnt-changed_on = text-s21."'Changed On'.
wa_final_prnt-changed_by = text-s22."'Changed By'.
wa_final_prnt-salesrep = text-s23."'NPS Verified By'.
wa_final_prnt-rpl = text-s24."'RPL Number'.
wa_final_prnt-vkorg = text-s31.
wa_final_prnt-resp_offc = text-s32.
wa_final_prnt-bukrs = text-s33.
wa_final_prnt-stceg = text-s34.
wa_final_prnt-class = text-s27."'Classfication Code'.
wa_final_prnt-ort02 = text-s28.
wa_final_prnt-bezei = text-s29.
wa_final_prnt-z9cidid = text-s30.
wa_final_prnt-sep1 = ' '.
wa_final_prnt-sep2 = ' '.
wa_final_prnt-sep3 = ' '.
wa_final_prnt-sep4 = ' '.
wa_final_prnt-sep5 = ' '.
wa_final_prnt-sep6 = ' '.
wa_final_prnt-sep7 = ' '.
wa_final_prnt-sep8 = ' '.
wa_final_prnt-sep9 = ' '.
wa_final_prnt-sep10 = ' '.
wa_final_prnt-sep11 = ' '.
wa_final_prnt-sep12 = ' '.
wa_final_prnt-sep13 = ' '.
wa_final_prnt-sep14 = ' '.
wa_final_prnt-sep15 = ' '.
wa_final_prnt-sep16 = ' '.
wa_final_prnt-sep17 = ' '.
wa_final_prnt-sep18 = ' '.
wa_final_prnt-sep19 = ' '.
wa_final_prnt-sep20 = ' '.
wa_final_prnt-sep21 = ' '.
wa_final_prnt-sep22 = ' '.
wa_final_prnt-sep23 = ' '.
wa_final_prnt-sep24 = ' '.
wa_final_prnt-sep25 = ' '.
wa_final_prnt-sep26 = ' '.
wa_final_prnt-sep27 = ' '.
wa_final_prnt-sep28 = ' '.
wa_final_prnt-sep29 = ' '.
wa_final_prnt-sep30 = ' '.
wa_final_prnt-sep31 = ' '.
APPEND wa_final_prnt TO wt_final_prnt.
CLEAR wa_final_prnt.
APPEND wa_final_prnt TO wt_final_prnt.
LOOP AT wt_final INTO wa_final.
CLEAR wa_final_prnt.
CONCATENATE wa_final-changed_on+4(2) '/'
wa_final-changed_on+6(2) '/'
wa_final-changed_on+0(4)
INTO wa_final_prnt-changed_on.
wa_final_prnt-loevm = wa_final-mfd.
wa_final_prnt-crsid = wa_final-crsid.
wa_final_prnt-ktokd = wa_final-ktokd.
wa_final_prnt-bukrs = wa_final-bukrs.
wa_final_prnt-resp_offc = wa_final-resp_offc.
wa_final_prnt-vkorg = wa_final-vkorg.
wa_final_prnt-name1 = wa_final-name1.
wa_final_prnt-name2 = wa_final-name2.
wa_final_prnt-name3 = wa_final-name3.
wa_final_prnt-name4 = wa_final-name4.
wa_final_prnt-stras = wa_final-stras.
wa_final_prnt-ort01 = wa_final-ort01.
wa_final_prnt-regio = wa_final-regio.
wa_final_prnt-bezei = wa_final-bezei.
wa_final_prnt-ort02 = wa_final-ort02.
wa_final_prnt-z9cidid = wa_final-z9cidid.
wa_final_prnt-stceg = wa_final-stceg.
wa_final_prnt-pstlz = wa_final-pstlz.
wa_final_prnt-pfach = wa_final-pfach.
wa_final_prnt-land1 = wa_final-land1.
wa_final_prnt-telf1 = wa_final-telf1.
wa_final_prnt-loc_nr = wa_final-loc_nr.
wa_final_prnt-cle_id_nr = wa_final-cle_id_nr.
wa_final_prnt-cle_nm = wa_final-cle_nm.
wa_final_prnt-op_cust_nr = wa_final-op_cust_nr.
wa_final_prnt-changed_by = wa_final-changed_by.
wa_final_prnt-salesrep = wa_final-salesrep.
wa_final_prnt-rpl = wa_final-rpl.
wa_final_prnt-sblock = wa_final-sblock.
wa_final_prnt-dblock = wa_final-dblock.
wa_final_prnt-bblock = wa_final-bblock.
wa_final_prnt-class = wa_final-class.
wa_final_prnt-sep1 = ' '.
wa_final_prnt-sep2 = ' '.
wa_final_prnt-sep3 = ' '.
wa_final_prnt-sep4 = ' '.
wa_final_prnt-sep5 = ' '.
wa_final_prnt-sep6 = ' '.
wa_final_prnt-sep7 = ' '.
wa_final_prnt-sep8 = ' '.
wa_final_prnt-sep9 = ' '.
wa_final_prnt-sep10 = ' '.
wa_final_prnt-sep11 = ' '.
wa_final_prnt-sep12 = ' '.
wa_final_prnt-sep13 = ' '.
wa_final_prnt-sep14 = ' '.
wa_final_prnt-sep15 = ' '.
wa_final_prnt-sep16 = ' '.
wa_final_prnt-sep17 = ' '.
wa_final_prnt-sep18 = ' '.
wa_final_prnt-sep19 = ' '.
wa_final_prnt-sep20 = ' '.
wa_final_prnt-sep21 = ' '.
wa_final_prnt-sep22 = ' '.
wa_final_prnt-sep23 = ' '.
wa_final_prnt-sep24 = ' '.
wa_final_prnt-sep25 = ' '.
wa_final_prnt-sep26 = ' '.
wa_final_prnt-sep27 = ' '.
wa_final_prnt-sep28 = ' '.
wa_final_prnt-sep29 = ' '.
wa_final_prnt-sep30 = ' '.
wa_final_prnt-sep31 = ' '.
APPEND wa_final_prnt TO wt_final_prnt.
ENDLOOP.
CALL FUNCTION 'RSPO_SX_OUTPUT_TEXTDATA'
EXPORTING
name = gv_name
dest = gv_dest
rows = gv_rows
startrow = gv_startrow
pages = gv_pages
rqtitle = 'Z9CS - STD Search Results'
rqcopies = gv_rqcopies
rqowner = gv_rqowner
immediately = gv_immediate
IMPORTING
rqid = gv_rqid
TABLES
text_data = wt_final_prnt
EXCEPTIONS
OTHERS = 1.
CLEAR : wa_final_prnt, wt_final_prnt[].
Here wt_final_prnt is the internal table for whose contents i am generating the Request number, instead populate it with records which are selected in the ALV list.
Note: gv_rqid will have the request number.
Hope this will help you,
Regards,
Ram.
2008 Jul 25 5:59 AM
Hi,
Check the following sample code.
WHEN 'PRINT'.
CLEAR : wa_final_prnt, wt_final_prnt[].
wa_final_prnt-loevm = text-S25."'Deletion flag'.
wa_final_prnt-crsid = text-s01."'CRSID'.
wa_final_prnt-ktokd = text-s02."'Acct Grp'.
wa_final_prnt-name1 = text-s03. "'Name1'.
wa_final_prnt-name2 = text-s04. "'Name2'.
wa_final_prnt-name3 = text-s05. "'Name3'.
wa_final_prnt-name4 = text-s06. "'Name4'.
wa_final_prnt-stras = text-s07."'Street'.
wa_final_prnt-ort01 = text-s08."'City'.
wa_final_prnt-regio = text-s09."'Region'.
wa_final_prnt-pstlz = text-s10."'Postal Code'.
wa_final_prnt-pfach = text-s11."'PO Box'.
wa_final_prnt-land1 = text-s12."'Country'.
wa_final_prnt-telf1 = text-s13."'Phone'.
wa_final_prnt-loc_nr = text-s14."'Locator ID'.
wa_final_prnt-sblock = text-s15."'Sales Order Block CD'.
wa_final_prnt-dblock = text-s16."'Delivery Block CD'.
wa_final_prnt-bblock = text-s17."'Billing CD'.
wa_final_prnt-cle_id_nr = text-s18."'CLE ID'.
wa_final_prnt-cle_nm = text-s19."'CLE Name'.
wa_final_prnt-op_cust_nr = text-s20."'CBN'.
wa_final_prnt-changed_on = text-s21."'Changed On'.
wa_final_prnt-changed_by = text-s22."'Changed By'.
wa_final_prnt-salesrep = text-s23."'NPS Verified By'.
wa_final_prnt-rpl = text-s24."'RPL Number'.
wa_final_prnt-vkorg = text-s31.
wa_final_prnt-resp_offc = text-s32.
wa_final_prnt-bukrs = text-s33.
wa_final_prnt-stceg = text-s34.
wa_final_prnt-class = text-s27."'Classfication Code'.
wa_final_prnt-ort02 = text-s28.
wa_final_prnt-bezei = text-s29.
wa_final_prnt-z9cidid = text-s30.
wa_final_prnt-sep1 = ' '.
wa_final_prnt-sep2 = ' '.
wa_final_prnt-sep3 = ' '.
wa_final_prnt-sep4 = ' '.
wa_final_prnt-sep5 = ' '.
wa_final_prnt-sep6 = ' '.
wa_final_prnt-sep7 = ' '.
wa_final_prnt-sep8 = ' '.
wa_final_prnt-sep9 = ' '.
wa_final_prnt-sep10 = ' '.
wa_final_prnt-sep11 = ' '.
wa_final_prnt-sep12 = ' '.
wa_final_prnt-sep13 = ' '.
wa_final_prnt-sep14 = ' '.
wa_final_prnt-sep15 = ' '.
wa_final_prnt-sep16 = ' '.
wa_final_prnt-sep17 = ' '.
wa_final_prnt-sep18 = ' '.
wa_final_prnt-sep19 = ' '.
wa_final_prnt-sep20 = ' '.
wa_final_prnt-sep21 = ' '.
wa_final_prnt-sep22 = ' '.
wa_final_prnt-sep23 = ' '.
wa_final_prnt-sep24 = ' '.
wa_final_prnt-sep25 = ' '.
wa_final_prnt-sep26 = ' '.
wa_final_prnt-sep27 = ' '.
wa_final_prnt-sep28 = ' '.
wa_final_prnt-sep29 = ' '.
wa_final_prnt-sep30 = ' '.
wa_final_prnt-sep31 = ' '.
APPEND wa_final_prnt TO wt_final_prnt.
CLEAR wa_final_prnt.
APPEND wa_final_prnt TO wt_final_prnt.
LOOP AT wt_final INTO wa_final.
CLEAR wa_final_prnt.
CONCATENATE wa_final-changed_on+4(2) '/'
wa_final-changed_on+6(2) '/'
wa_final-changed_on+0(4)
INTO wa_final_prnt-changed_on.
wa_final_prnt-loevm = wa_final-mfd.
wa_final_prnt-crsid = wa_final-crsid.
wa_final_prnt-ktokd = wa_final-ktokd.
wa_final_prnt-bukrs = wa_final-bukrs.
wa_final_prnt-resp_offc = wa_final-resp_offc.
wa_final_prnt-vkorg = wa_final-vkorg.
wa_final_prnt-name1 = wa_final-name1.
wa_final_prnt-name2 = wa_final-name2.
wa_final_prnt-name3 = wa_final-name3.
wa_final_prnt-name4 = wa_final-name4.
wa_final_prnt-stras = wa_final-stras.
wa_final_prnt-ort01 = wa_final-ort01.
wa_final_prnt-regio = wa_final-regio.
wa_final_prnt-bezei = wa_final-bezei.
wa_final_prnt-ort02 = wa_final-ort02.
wa_final_prnt-z9cidid = wa_final-z9cidid.
wa_final_prnt-stceg = wa_final-stceg.
wa_final_prnt-pstlz = wa_final-pstlz.
wa_final_prnt-pfach = wa_final-pfach.
wa_final_prnt-land1 = wa_final-land1.
wa_final_prnt-telf1 = wa_final-telf1.
wa_final_prnt-loc_nr = wa_final-loc_nr.
wa_final_prnt-cle_id_nr = wa_final-cle_id_nr.
wa_final_prnt-cle_nm = wa_final-cle_nm.
wa_final_prnt-op_cust_nr = wa_final-op_cust_nr.
wa_final_prnt-changed_by = wa_final-changed_by.
wa_final_prnt-salesrep = wa_final-salesrep.
wa_final_prnt-rpl = wa_final-rpl.
wa_final_prnt-sblock = wa_final-sblock.
wa_final_prnt-dblock = wa_final-dblock.
wa_final_prnt-bblock = wa_final-bblock.
wa_final_prnt-class = wa_final-class.
wa_final_prnt-sep1 = ' '.
wa_final_prnt-sep2 = ' '.
wa_final_prnt-sep3 = ' '.
wa_final_prnt-sep4 = ' '.
wa_final_prnt-sep5 = ' '.
wa_final_prnt-sep6 = ' '.
wa_final_prnt-sep7 = ' '.
wa_final_prnt-sep8 = ' '.
wa_final_prnt-sep9 = ' '.
wa_final_prnt-sep10 = ' '.
wa_final_prnt-sep11 = ' '.
wa_final_prnt-sep12 = ' '.
wa_final_prnt-sep13 = ' '.
wa_final_prnt-sep14 = ' '.
wa_final_prnt-sep15 = ' '.
wa_final_prnt-sep16 = ' '.
wa_final_prnt-sep17 = ' '.
wa_final_prnt-sep18 = ' '.
wa_final_prnt-sep19 = ' '.
wa_final_prnt-sep20 = ' '.
wa_final_prnt-sep21 = ' '.
wa_final_prnt-sep22 = ' '.
wa_final_prnt-sep23 = ' '.
wa_final_prnt-sep24 = ' '.
wa_final_prnt-sep25 = ' '.
wa_final_prnt-sep26 = ' '.
wa_final_prnt-sep27 = ' '.
wa_final_prnt-sep28 = ' '.
wa_final_prnt-sep29 = ' '.
wa_final_prnt-sep30 = ' '.
wa_final_prnt-sep31 = ' '.
APPEND wa_final_prnt TO wt_final_prnt.
ENDLOOP.
CALL FUNCTION 'RSPO_SX_OUTPUT_TEXTDATA'
EXPORTING
name = gv_name
dest = gv_dest
rows = gv_rows
startrow = gv_startrow
pages = gv_pages
rqtitle = 'Z9CS - STD Search Results'
rqcopies = gv_rqcopies
rqowner = gv_rqowner
immediately = gv_immediate
IMPORTING
rqid = gv_rqid
TABLES
text_data = wt_final_prnt
EXCEPTIONS
OTHERS = 1.
CLEAR : wa_final_prnt, wt_final_prnt[].
Here wt_final_prnt is the internal table for whose contents i am generating the Request number, instead populate it with records which are selected in the ALV list.
Note: gv_rqid will have the request number.
Hope this will help you,
Regards,
Ram.
2008 Jul 25 6:05 AM
hi,
For showing specific fields , you have to append field catlog row by row .( without using 'REUSE_ALV_FIELDCATALOG_MERGE' ).
Let say your field catlog name is 'X_FIELDCAT', then you can code like this,
x_fieldcat-col_pos = 1. ( column position)
x_fieldcat-fieldname = 'ZVBELN'.
x_fieldcat-tabname = 'ITAB'.
x_fieldcat-seltext_m = 'SALES ORDER'.
append x_fieldcat.
x_fieldcat-col_pos = 2.
x_fieldcat-fieldname = 'ZPOSNR'.
x_fieldcat-tabname = 'ITAB'.
x_fieldcat-seltext_m = 'ITEM'.
append x_fieldcat.
.
.
.
.
.
Once you have appended all those fields which you want to display, Then pass your field catlog in FM ' 'REUSE_ALV_GRID_DISPLAY'
2008 Jul 25 6:20 AM
Hi Gopaludu.
I would like to suggest a few references,
[SAP HELP - Standard Reference for Selecting and Displaying spool and output requests - Snapshots |http://help.sap.com/saphelp_nw04/helpdata/en/d9/4a8f0851ea11d189570000e829fbbd/content.htm]
[SAP HELP - Standard Reference for Outputting Spool Requests|http://help.sap.com/saphelp_nw04/helpdata/en/d9/4a8f3c51ea11d189570000e829fbbd/content.htm]
Hope that's usefull.
Good Luck & Regards.
Harsh Dave
2008 Jul 25 6:27 AM
Hi
Write the following code for the AT USER-COMMAND EVENT for that button.
Code:
DATA ref_grid TYPE REF TO cl_gui_alv_grid.
IF ref_grid IS INITIAL.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = ref_grid.
ENDIF.
IF ref_grid IS NOT INITIAL.
CALL METHOD ref_grid->check_changed_data.
ENDIF.
LOOP AT git_output INTO gs_output WHERE chkbox EQ 'X'.
.......
( Here the interanal table should have the field "chkbox" which displays the checkbox in the grid and
the end user selects the records by checking the corresponding checkbox. )
ENDLOOP.
Now you can pass this data to the SPOOL Request.
Hope this would help you.
Murthy
2008 Dec 16 11:13 AM
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |