2013 Dec 09 6:44 AM
Hi,
I am using Leave to list processing for dynamic display of checkboxes in PBO of screen. But I am unable to execute the PAI. My requirement is that when the user selects the checkbox, the value of the checkbox ( or checkboxes) should be read and PAI should be trigerred on 'Execute'. Can anybody please help ??
Regards,
Sharbani
2013 Dec 09 6:49 AM
Hi Sharbani
Simply do this--open the layout. Double click on checkboxes and properties window open--> Assign some value in FCTCODE. to all. so next time when you check any checkbox PAI will get triggered and you can check ok_code or sy-ucomm which checkbox has been checked/unchecked.
Nabheet
2013 Dec 09 7:02 AM
Hi Nabheet,
I am using dynamic display of the checkboxes , so screen attribute properties are not affecting. Can you pls suggest some other way out as I am using Leave to LIst Processing in PBO and want the PAI of the checkbox ticked.
Regards,
Sharbani
2013 Dec 09 7:09 AM
How are you displaying checkboxes on screen...? why are uyou using leave to list processing...?
Can you please let me know what exactly you want to do?
Nabheet
2013 Dec 09 8:10 AM
Hi,
I have written the following code in PBO.
LEAVE TO LIST-PROCESSING AND RETURN TO SCREEN 0.
SET PF-STATUS 'STATUS1'.
SUPPRESS DIALOG.
loop at it_email.
WRITE: / '' AS CHECKBOX, it_email-emailid.
endloop..
endmodule.
I want to display email IDs from an internal table to be displayed as checkbox in the screen and the user will be selecting the email IDs from the list and mail should be sent accordingly.
Please let me know the correct and optimized way to do so if I am going wrong anywhere.
Regards,
Sharbani
2013 Dec 09 8:31 AM
No need to create a screen in this case...
Check this sample code..reate PF status ZTMP1 with SEND Email button ok code as SEND
TYPES
:BEGIN OF lty_mara,
chk(1) TYPE c,
matnr TYPE matnr_d,
END OF lty_mara.
DATA:lt_mara TYPE STANDARD TABLE OF lty_mara,
lwa_mara TYPE lty_mara.
SELECT matnr UP TO 100 ROWS FROM mara INTO CORRESPONDING FIELDS OF TABLE lt_mara.
SET PF-STATUS 'ZTMP1'.
LOOP AT lt_mara INTO lwa_mara.
WRITE😕 lwa_mara-chk AS CHECKBOX, lwa_mara-matnr.
ENDLOOP.
AT USER-COMMAND.
CASE sy-ucomm.
WHEN 'SEND'.
DATA:lv_lines TYPE sy-tabix.
DESCRIBE LIST NUMBER OF LINES lv_lines.
DO lv_lines TIMES.
READ LINE sy-index LINE VALUE INTO lwa_mara .
IF lwa_mara-chk = 'X'.
"--Send email her
ENDIF.
ENDDO.
ENDCASE.
2013 Dec 09 9:15 AM
Well there is another solution
You can create a table control and use the internal table to display it directly with one additional column in table control as check box.
Regards
2013 Dec 09 8:54 AM
Hi Sharbani,
This is some sample code to get the selected data from list.
Please check the bold font, this is the part to get the selected data.
* To add check box at the first column of the list.
gwa_fieldcat-fieldname = 'FLAG'.
gwa_fieldcat-tabname = 'IT_ALV'.
gwa_fieldcat-seltext_l = ''.
gwa_fieldcat-outputlen = 2.
gwa_fieldcat-checkbox = gc_check.
gwa_fieldcat-edit = gc_check.
gwa_fieldcat-input = gc_check.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
it_fieldcat = gtt_fieldcat
i_callback_program = sy-repid
i_callback_pf_status_set = 'F_SET_PF_STATUS'
i_callback_user_command = 'F_USER_COMMAND' "form to execute user command
TABLES
t_outtab = it_alv.
* formto execute the user command
FORM f_user_command USING pv_command TYPE sy-ucomm
pv_selfield TYPE slis_selfield.
DATA : lcl_ref_grid TYPE REF TO cl_gui_alv_grid.
CASE pv_command.
"Print customer address
WHEN 'EXECUTE'.
"to reflect the data changed into internal table IT_ALV
IF lcl_ref_grid IS INITIAL.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = lcl_ref_grid.
ENDIF.
IF lcl_ref_grid IS NOT INITIAL.
CALL METHOD lcl_ref_grid->check_changed_data.
ENDIF.
" Process the selected data
LOOP AT it_alv ASSIGNING <fs_alv> WHERE flag EQ 'X'.
"Here to do whatever process you want based on the selected data from the list.
ENDLOOP.
Warm regards
Ice
2013 Dec 09 9:20 AM
I would suggest you go for ALV.
In the field catalog, have two fields - check box and email.
Also have a button - Send mail either using menu painter.
in the user command module, read all the ALV data using the FM GET_GLOBALS_FROM_SLVC_FULLSCR and the method
check_changed_data.
Loop at the ALV data table and append the email addresses that are checked to the email internal table which will be used as a parameter in the function module to send mail.
It will be simple.
Let me know if you want more details.