Рет қаралды 618
-Took the Requirement.
-Creation of Program Based Upon the Requirement.
-Creation of Object Class and Authorization Object Through SU21 Transaction Code.
-Pass the Authorization Field ACTVT in the Authorization Object.
-Assigned the Values to Authorization Field ACTVT.
REPORT zdemo_authority_check.
TYPES : BEGIN OF lty_ono,
ono TYPE zdeono_28,
END OF lty_ono.
DATA : lwa_data TYPE zordh_28.
DATA : lt_ono TYPE TABLE OF lty_ono.
DATA : lwa_ono TYPE lty_ono.
TYPES : BEGIN OF lty_display,
odate TYPE zdeodate_28,
pm TYPE zdepm_28,
ta TYPE zdeta_28,
curr TYPE zdecur_28,
END OF lty_display.
DATA : lwa_display TYPE lty_display.
DATA : lv_objectid TYPE cdhdr-objectid.
DATA : lwa_old TYPE zordh_28.
PARAMETERS : p_ono TYPE zdeono_28 OBLIGATORY.
PARAMETERS : p_odate TYPE zdeodate_28 MODIF ID a1.
PARAMETERS : p_pm TYPE zdepm_28 MODIF ID a2.
PARAMETERS : p_ta TYPE zdeta_28 MODIF ID a3.
PARAMETERS : p_curr TYPE zdecur_28 MODIF ID a4.
PARAMETERS : p_r1 TYPE c RADIOBUTTON GROUP r1 USER-COMMAND abc .
PARAMETERS : p_r2 TYPE c RADIOBUTTON GROUP r1 .
PARAMETERS : p_r3 TYPE c RADIOBUTTON GROUP r1.
START-OF-SELECTION.
*Insert
IF p_r1 = 'X'.
lwa_data-ono = p_ono.
lwa_data-odate = p_odate.
lwa_data-pm = p_pm.
lwa_data-ta = p_ta.
lwa_data-curr = p_curr.
INSERT zordh_28 FROM lwa_data.
IF sy-subrc = 0.
WRITE : TEXT-000.
ELSE.
WRITE : TEXT-001.
ENDIF.
ENDIF.
*Delete.
IF p_r2 = 'X'.
SELECT SINGLE * FROM zordh_28 INTO lwa_data WHERE ono = p_ono.
lwa_data-ono = p_ono.
DELETE zordh_28 FROM lwa_data.
IF sy-subrc = 0.
WRITE : TEXT-002 , ' :' , p_ono.
ENDIF.
ENDIF.
*Update
IF p_r3 = 'X'.
lwa_data-ono = p_ono.
lwa_data-odate = p_odate.
lwa_data-pm = p_pm.
lwa_data-ta = p_ta.
lwa_data-curr = p_curr.
UPDATE zordh_28 FROM lwa_data.
IF sy-subrc = 0.
WRITE : TEXT-003, ' :' , p_ono.
ENDIF.
ENDIF.
AT SELECTION-SCREEN.
IF p_r1 = 'X'.
SELECT ono
FROM zordh_28
INTO TABLE lt_ono
WHERE ono = p_ono.
IF sy-subrc = 0.
MESSAGE e003(zmsg) WITH p_ono.
ENDIF.
ENDIF.
IF p_r2 = 'X'.
SELECT SINGLE ono
FROM zordh_28
INTO lwa_ono
WHERE ono = p_ono.
IF sy-subrc NE 0.
MESSAGE e004(zmsg) WITH p_ono.
ENDIF.
ENDIF.
IF p_r3 = 'X'.
SELECT SINGLE ono
FROM zordh_28
INTO lwa_ono
WHERE ono = p_ono.
IF sy-subrc NE 0.
MESSAGE e004(zmsg) WITH p_ono.
ELSE.
SELECT SINGLE odate pm ta curr
FROM zordh_28
INTO lwa_display
WHERE ono = p_ono.
ENDIF.
ENDIF.
AT SELECTION-SCREEN OUTPUT.
IF p_r2 = 'X'.
LOOP AT SCREEN.
IF screen-group1 = 'A1' OR screen-group1 = 'A2' OR screen-group1 = 'A3' OR screen-group1 = 'A4'.
screen-active = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
IF p_r3 = 'X'.
p_odate = lwa_display-odate.
p_pm = lwa_display-pm.
p_ta = lwa_display-ta.
p_curr = lwa_display-curr.
ENDIF.