Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Create a work area and insert ,delete,update buttons on selection-screen

Former Member
1,653

please help me to write the following codecode

(1) Create a work area of the folowing fields of the 'Z' table(employee/department)-

MANDT(03) type CLNT ,

EMPID (05) type CHAR ,

EMPNM(15) type CHAR ,

EMPDJ (08) type CHAR ,

EMPAD (30) type CHAR ,

EMPPH (15) type CHAR ,

DEPID (05) type CHAR .

Create a selection-screen equivalent of the above work area

(2) Also put 'INSERT' 'DELETE' and 'UPDATE' buttons on

the selection-screen

(3) Using INSERT statement insert selection-screen record

into DATABASE TABLE, when the user presses 'INSERT'

button on selection-screen

(4) Using UPDATE statement modify record of the DATABASE

TABLE, when the user presses 'UPDATE' button on

selection-screen

(5) Using DELETE statement delete the corresponding

DATABASE TABLE record, when the user

presses 'DELETE' button on selection-screen

(6) Use messages appropriately.

please help me to write the following codecode

(1) Create a work area of the folowing fields of the 'Z' table(employee/department)-

MANDT(03) type CLNT ,

EMPID (05) type CHAR ,

EMPNM(15) type CHAR ,

EMPDJ (08) type CHAR ,

EMPAD (30) type CHAR ,

EMPPH (15) type CHAR ,

DEPID (05) type CHAR .

Create a selection-screen equivalent of the above work area

(2) Also put 'INSERT' 'DELETE' and 'UPDATE' buttons on

the selection-screen

(3) Using INSERT statement insert selection-screen record

into DATABASE TABLE, when the user presses 'INSERT'

button on selection-screen

(4) Using UPDATE statement modify record of the DATABASE

TABLE, when the user presses 'UPDATE' button on

selection-screen

(5) Using DELETE statement delete the corresponding

DATABASE TABLE record, when the user

presses 'DELETE' button on selection-screen

(6) Use messages appropriately.

2 REPLIES 2
Read only

Former Member
0 Likes
684

Hi ravinder,

To get Buttons ofn Selection-screen.

tables: sscrfields.

SELECTION-SCREEN:

PUSHBUTTON 2(10) but1 USER-COMMAND cli1,

PUSHBUTTON 12(10) but2 USER-COMMAND cli2,

PUSHBUTTON 2(10) but3 USER-COMMAND cli3.

INITIALIZATION.

but1 = 'INSERT'.

but2 = 'DELETE'.

but3 = 'UPDATE'.

AT SELECTION-SCREEN.

CASE sscrfields.

WHEN 'CLI1'.

.........

WHEN 'CLI2'.

................

WHEN 'CLI3'.

..........................

ENDCASE.

Also check ythe following link

http://help.sap.com/saphelp_nw70/helpdata/EN/9f/dba81635c111d1829f0000e829fbfe/frameset.htm

Regards,

Ruthra

Read only

venkat_o
Active Contributor
0 Likes
684

Check this sample program.

REPORT zvenkat_test1.
TYPES:
      BEGIN OF t_empdet,
        mandt TYPE mandt ,
        empid(05) TYPE c ,
        empnm(15) TYPE c ,
        empdj(08) TYPE c ,
        empad(30) TYPE c ,
        empph(15) TYPE c ,
        depid(05) TYPE c ,
      END OF t_empdet.
DATA:
      w_empdet TYPE t_empdet.
DATA:
      i_empdet TYPE STANDARD TABLE OF t_empdet.
PARAMETERS:
           mandt     TYPE mandt ,
           empid(05) TYPE c ,
           empnm(15) TYPE c ,
           empdj(08) TYPE c ,
           empad(30) TYPE c ,
           empph(15) TYPE c ,
           depid(05) TYPE c .

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE title1.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN PUSHBUTTON 10(8) text_001 USER-COMMAND com1.
SELECTION-SCREEN PUSHBUTTON 20(8) text_002 USER-COMMAND com2.
SELECTION-SCREEN PUSHBUTTON 30(8) text_003 USER-COMMAND com3.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK b1 .

INITIALIZATION.
  text_001 = 'INSERT'.
  text_002 = 'DELETE'.
  text_003 = 'MODIFY'.

AT SELECTION-SCREEN.
  w_empdet-mandt = mandt.
  w_empdet-empid = empid.
  w_empdet-empnm = empnm.
  w_empdet-empdj = empdj.
  w_empdet-empad = empad.
  w_empdet-empph = empph.
  w_empdet-depid = depid.
  CASE sy-ucomm .
    WHEN 'COM1'."Insert
      INSERT zempdet FROM w_empdet.
    WHEN 'COM2'."Delete
      DELETE zempdet FROM w_empdet.
    WHEN 'COM3'."Modify
      UPDATE zempdet SET mandt = w_empdet-mandt
                         empid = w_empdet-empid.
  ENDCASE.
I hope that it gives u some idea. Regards, Venkat.O