User Commend in Alv Reports and edit alv reports
FORM f_user_command USING vl_ucomm LIKE sy-ucomm "#EC CALLED
rs_selfield TYPE slis_selfield.
DATA: lv_case TYPE sy-ucomm.
DATA: gd_repid LIKE sy-repid,
ref_grid TYPE REF TO cl_gui_alv_grid.
DATA: lv_approval1 TYPE char10,
lv_approval2 TYPE char10,
lv_approval3 TYPE char10.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = ref_grid.
CALL METHOD ref_grid->check_changed_data.
lv_case = sy-ucomm.
CASE lv_case.
WHEN 'SELECTALL'.
LOOP AT gt_zbatch_h2h INTO gs_zbatch_h2h.
gs_zbatch_h2h-check = 'X'. " ' '.
MODIFY gt_zbatch_h2h FROM gs_zbatch_h2h TRANSPORTING check.
COMMIT WORK.
ENDLOOP.
rs_selfield-refresh = 'X'.
WHEN 'DESELECT'.
LOOP AT gt_zbatch_h2h INTO gs_zbatch_h2h.
gs_zbatch_h2h-check = ' '. " ' '.
MODIFY gt_zbatch_h2h FROM gs_zbatch_h2h TRANSPORTING check.
COMMIT WORK.
ENDLOOP.
rs_selfield-refresh = 'X'.
WHEN 'APPROVED'.
gt_zbatch_h2h1 = gt_zbatch_h2h.
DELETE gt_zbatch_h2h1 WHERE check IS INITIAL.
IF gt_zbatch_h2h1 IS NOT INITIAL.
LOOP AT gt_zbatch_h2h1 INTO gs_zbatch_h2h1.
CLEAR: gs_zbatch_h2h1-rejection_reason.
IF gs_zbatch_h2h1-approval_one = sy-uname AND gs_zbatch_h2h1-rejection_id IS INITIAL.
CONCATENATE sy-datlo sy-timlo INTO lv_approval1.
gs_zbatch_h2h-app1_tmsp = lv_approval1.
MODIFY gt_zbatch_h2h1 FROM gs_zbatch_h2h1 TRANSPORTING app1_tmsp rejection_reason.
ELSE.
MESSAGE 'You Can not approved it rejected ' TYPE 'E'.
ENDIF.
IF gs_zbatch_h2h1-approval_two = sy-uname
AND gs_zbatch_h2h1-rejection_id IS INITIAL
AND gs_zbatch_h2h1-app1_tmsp IS NOT INITIAL.
CONCATENATE sy-datlo sy-timlo INTO lv_approval2.
gs_zbatch_h2h1-aap2_tmsp = lv_approval2.
MODIFY gt_zbatch_h2h1 FROM gs_zbatch_h2h1 TRANSPORTING aap2_tmsp rejection_reason.
ELSE.
MESSAGE 'You Can not approved it rejected ' TYPE 'E'.
ENDIF.
IF gs_zbatch_h2h1-approval_three = sy-uname
AND gs_zbatch_h2h1-rejection_id IS INITIAL
AND gs_zbatch_h2h1-app1_tmsp IS NOT INITIAL
AND gs_zbatch_h2h1-aap2_tmsp IS NOT INITIAL.
CONCATENATE sy-datlo sy-timlo INTO lv_approval2.
gs_zbatch_h2h1-app3_timsp = lv_approval3.
MODIFY gt_zbatch_h2h1 FROM gs_zbatch_h2h1 TRANSPORTING app3_timsp rejection_reason.
ELSE.
MESSAGE 'You Can not approved it rejected ' TYPE 'E'.
ENDIF.
ENDLOOP.
MODIFY zbatch_h2h FROM TABLE gt_zbatch_h2h1.
IF sy-subrc EQ 0.
MESSAGE text-006 TYPE 'S'.
ENDIF.
ELSE.
MESSAGE text-004 TYPE 'E'.
ENDIF.
WHEN 'REJECTED'.
gt_zbatch_h2h1 = gt_zbatch_h2h.
DELETE gt_zbatch_h2h1 WHERE check IS INITIAL.
IF gt_zbatch_h2h1 IS NOT INITIAL.
LOOP AT gt_zbatch_h2h1 INTO gs_zbatch_h2h1.
CLEAR: gs_zbatch_h2h1-rejection_reason.
IF gs_zbatch_h2h1-app3_timsp IS INITIAL AND gs_zbatch_h2h1-rejection_id IS INITIAL.
CONCATENATE sy-datlo sy-timlo INTO lv_approval1.
gs_zbatch_h2h1-rej_tmsp = lv_approval1.
gs_zbatch_h2h1-rejection_id = sy-uname.
MODIFY gt_zbatch_h2h1 FROM gs_zbatch_h2h1 TRANSPORTING rejection_id rej_tmsp.
ELSE.
MESSAGE 'alredy rejected your payment' TYPE 'E'.
ENDIF.
ENDLOOP.
MODIFY zbatch_h2h FROM TABLE gt_zbatch_h2h1.
ELSE.
MESSAGE text-004 TYPE 'E'.
ENDIF.
WHEN OTHERS.
ENDCASE.
ENDFORM. "f_user_command
Comments
Post a Comment