Skip to Content
0
Jul 10, 2020 at 06:38 PM

NO ERROR BUT COULD NOT ENTER START OF SELECTION help me to rectify

131 Views Last edit Jul 10, 2020 at 06:29 PM 3 rev



REPORT Z645PROG107.

tables Z01_CUST.

data : WA_CUST TYPE Z01_CUST,
t_cust type table of Z01_CUST.
data flag.

PARAMETER: p_cid TYPE int4 DEFAULT 1 .


SELECTION-SCREEN begin of block bk1 WITH FRAME TITLE t1.
SELECTION-SCREEN COMMENT 8(30) lb1.

parameter : p_c1 type z_CUST ,
p_c2 type z_CNAME ,
p_c3 type z_ADDRS ,
p_c4 TYPE z_EMAIL ,
p_c5 TYPE z_PHONENO .

SELECTION-SCREEN end of block bk1.

SELECTION-SCREEN skip 2.
SELECTION-SCREEN PUSHBUTTON 6(12) b1 USER-COMMAND fc1.
SELECTION-SCREEN PUSHBUTTON 20(12) b2 USER-COMMAND fc2.
SELECTION-SCREEN PUSHBUTTON 34(12) b3 USER-COMMAND fc3.
SELECTION-SCREEN PUSHBUTTON 48(12) b4 USER-COMMAND fc4.
SELECTION-SCREEN skip 2.
SELECTION-SCREEN PUSHBUTTON 13(12) b5 USER-COMMAND fc5.

AT SELECTION-SCREEN.

CASE flag.

WHEN 'fc1'.
screen-active = '0'.

FLAG = '1'.

WHEN 'fc2'.

FLAG = '2'.

WHEN 'fc3'.

FLAG = '3'.

WHEN 'fc4'.

FLAG = '4'.

WHEN 'fc5'.
FLAG = '5'.

ENDCASE.

START-OF-SELECTION.




CASE FLAG.

WHEN 'FC1'. " CREATE.

WA_CUST-CID = p_c1.
WA_CUST-CUSTOMER_NAME = p_c2.
WA_CUST-CUSTOMER_ADDRESS = p_c3.
WA_CUST-CUS_EMAIL = p_c4.
WA_CUST-CUS_PHONE = p_c5.
INSERT z01_cust FROM wa_cust.

IF sy-subrc = 0.
MESSAGE 'customer Record Inserted' TYPE 'I'.
ELSEIF sy-subrc <> 0 .
MESSAGE 'Wrong customer ID' TYPE 'E'.
EXIT.
ENDIF.

WHEN 'FC2'. "DISPLAY

SELECT *
FROM z01_cust
INTO TABLE t_cust
WHERE CID = p_cid.
IF sy-subrc = 0 .
LOOP AT t_cust INTO wa_cust.

WRITE: /3 'CID',
20 'CUSTOMER_NAME',
35 'CUSTOMER_ADDRESS',
70 'CUS_EMAIL',
90 'CUS_PHONE'.



WRITE:/3 WA_CUST-CID, 20 WA_CUST-CUSTOMER_NAME,35 WA_CUST-CUSTOMER_ADDRESS,70 WA_CUST-CUS_EMAIL,90 WA_CUST-CUS_PHONE.

ENDLOOP.
endif.
WHEN 'FC3'. " UPDATE

SELECT *
FROM Z01_CUST
INTO TABLE t_cust
WHERE CID = p_c1.
UPDATE Z01_CUST SET CID = p_c1
CUSTOMER_NAME = p_c2 CUSTOMER_ADDRESS = p_c3 CUS_EMAIL = p_c4
CUS_PHONE = p_c5
WHERE CID = P_C1.

IF sy-subrc = 0.
MESSAGE 'CUSTOMER Record Updated' TYPE 'I'.
ELSEIF sy-subrc <> 0 .
MESSAGE 'Wrong CUSTOMER ID' TYPE 'E'.
EXIT.
ENDIF.
EXIT.


WHEN 'FC4'. " DELETE.

DELETE FROM Z01_CUST WHERE CID = P_C1.
IF sy-subrc = 0.
MESSAGE 'CUSTOMER Record Deleted' TYPE 'I'.
ELSEIF sy-subrc <> 0 .
MESSAGE 'Wrong CUSTOMER ID' TYPE 'E'.
EXIT.
ENDIF.

WHEN 'FC5'.

WRITE / 'Button 5 was clicked'.

WHEN OTHERS.

WRITE / 'No Button was clicked'.
ENDCASE.

initialization.
lb1 = 'Enter the details of customer '.
t1 = 'Enter the data '.
b1 = 'CREATE'.
b2 = 'DISPLAY'.
b3 = 'UPDATE'.
b4 = 'DELETE'.

b5 = 'EXIT'.