Application Development 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: 

Need sample table control program

Former Member
0 Kudos

Hi Friends,

Can any one give me the sample table control program for changing,displaying and creating multiple entries for fields in a table.when i click new entries it should allow me to create multiple values instead of one.Change should allow me to change the field value and display should to display the field values in disable mode.Sure i will reward points for the correct program.

It is very urgent requirement.

Rgds,

Rama

1 ACCEPTED SOLUTION

Former Member
0 Kudos

hi,

looking at your requirement.

i think instead of breaking your head.

Just create the table maintenance in your se11,

use the 2 step process and give 2 screen nos.

then in se38 create a simple program and call the function module

VIEW_MAINTENANCE_CALL

and pass the parameters

Action = 'S' or as per your requirement

view_name = z table name

TABLES

  • DBA_SELLIST =

EXCL_CUA_FUNCT = I_VIMEXCLFUN

contains the functions codes of what you want to do.

just append them into the function modules.

Thanks,

Murali

15 REPLIES 15

Former Member
0 Kudos

see below example demo_dynpro_tabcont_loop_at

andreas_mann3
Active Contributor
0 Kudos

Hi,

look here (with se38):

DEMO_DYNPRO_TABLE_CONTROL_1

DEMO_DYNPRO_TABLE_CONTROL_2

Andreas

Former Member
0 Kudos

Hi,

you can see the Example programs in SAP itself.

goto <b>SE38 --> Environment --> Examples --> ABAP exa</b>mples

then

press <b>BC-ABAP Programming --> ABAP User Dialogs --> SCREENS</b>

in this on e see <b>Processing screen</b> and <b>Complex Screen elements</b>

You will get all the programs here with e Sample example. hope you get what you want here

Regards

Sudheer

0 Kudos

I need sample table control program for creating multiple entries for the table.For example zemployee is the table.If i click on create new entries it should allow me to create multiple records instead of 1.If i click on change button it should allow me to change the existing records & it should not allow me to create new records and for display it should allow me to display the records in disable mode.

The existing SAP examples doesn't have create entries.So Can any one send me the sample program for the above.

0 Kudos

Hi Ramadevi,

Please try this test program :

http://members.aol.com/_ht_a/skarkada/sap/table_control/table_control.htm

Hopr this helps you.

0 Kudos

hi

refer the following part:

  • Process Before Output Event , this will fires before output and also

  • after giving any input from user

PROCESS BEFORE OUTPUT.

  • This module contains the PF status of screen and also input help

  • fields binding

MODULE status_0100.

  • In this step we are moving data from internal table to table control

  • work area to display

LOOP WITH CONTROL tc1.

MODULE read_table_control.

ENDLOOP.

*----


  • Process After user input

PROCESS AFTER INPUT.

*This module will fires when the user presses exit or back or cancel

  • buttons

MODULE exit_screen AT EXIT-COMMAND.

*This will help to validate header level details

CHAIN.

FIELD : wk_werks,

wk_plant,

wk_shift,

wk_dept,

wk_date.

MODULE data_validation.

ENDCHAIN.

  • This will help to validate table control fields validation

LOOP WITH CONTROL tc1.

CHAIN.

FIELD :

it_tc1-matnr,

it_tc1-vornr,

it_tc1-opdes,

it_tc1-plnnr,

it_tc1-plnal,

it_tc1-arbpl,

it_tc1-pernr,

it_tc1-sertype,

it_tc1-quantity,

it_tc1-time,

it_tc1-targqty,

it_tc1-rejqty,

it_tc1-ot,

it_tc1-remarks.

MODULE validate_data .

ENDCHAIN.

ENDLOOP.

  • This module uses when the user presses any button

MODULE user_command_0100.

  • This module is used to get the F4 help for screen fields

PROCESS ON VALUE-REQUEST.

FIELD wk_shift MODULE shift_values.

FIELD wk_dept MODULE dept_values.

FIELD it_tc1-pernr MODULE pernr_values.

FIELD it_tc1-vornr MODULE vornr_values.

FIELD it_tc1-sertype MODULE sertype_values.

and the coding inside would look like this!!

PROGRAM zppm001_proddet MESSAGE-ID zpp .

TABLES : zppt001_prod, " PRODUCTION INCENTIVE DETAILS TABLE

t001w, " PLANT MASTER TABLE

mapl, " MATERIAL TASK LIST TABLE

plas, " TASK LIST

plpo, " TASK LIST / OPERATIONS

crhd, " WORK CENTER HEADER

tc37a, " SHIFT DEFINITION

t552a, " MONTHLY WORK SCHEDULE

pa0001, " ORG.ASSIGNMENT

pa0000, " ACTION INFO TYPE

hrp1008, " ORG.UNITS

hrp1000. " DEPARTMENT TEXTS

  • Table control Declaration

CONTROLS tc1 TYPE TABLEVIEW USING SCREEN 100.

  • Table control column declaration

DATA: cols LIKE LINE OF tc1-cols.

&----


*Internal Table Declaration

&----


DATA : BEGIN OF it_tc1,

sel,

matnr LIKE zppt001_prod-matnr,

plnnr LIKE zppt001_prod-plnnr,

plnal LIKE mapl-plnal,

vornr LIKE zppt001_prod-vornr,

opdes LIKE plpo-ltxa1,

arbpl LIKE zppt001_prod-arbpl,

targqty LIKE zppt001_prod-quantity,

sertype LIKE zppt001_prod-sertype,

pernr LIKE pa0000-pernr,

quantity LIKE zppt001_prod-quantity,

time LIKE zppt001_prod-time,

downtime LIKE zppt001_prod-downtime,

rejqty LIKE zppt001_prod-quantity,

ot,

remarks LIKE zppt001_prod-remarks,

END OF it_tc1.

  • Internal table for Table control

DATA : it_tc1_temp LIKE it_tc1 OCCURS 0 WITH HEADER LINE.

  • Work area used to for COPY & PASTE buttons

DATA : wk_tc1 LIKE it_tc1.

  • Internal table to store production details before saving into database

  • table

DATA : it_zppt001 LIKE zppt001_prod OCCURS 0 WITH HEADER LINE.

  • Internal table for Material tasklist details

DATA : BEGIN OF it_mapl OCCURS 0,

matnr LIKE mapl-matnr,

werks LIKE mapl-werks,

plnty LIKE mapl-plnty,

plnnr LIKE mapl-plnnr,

plnal LIKE mapl-plnal,

zkriz LIKE mapl-zkriz,

zaehl LIKE mapl-zaehl,

loekz LIKE mapl-loekz,

END OF it_mapl.

  • Internal table for operations of tasklist

DATA : BEGIN OF it_plas OCCURS 0,

plnty LIKE plas-plnty,

plnnr LIKE plas-plnnr,

plnal LIKE plas-plnal,

plnfl LIKE plas-plnfl,

plnkn LIKE plas-plnkn,

zaehl LIKE plas-zaehl,

loekz LIKE plas-loekz,

END OF it_plas.

  • Internal table for operation tasklist activity

DATA : BEGIN OF it_plpo OCCURS 0,

plnty LIKE plpo-plnty,

plnnr LIKE plpo-plnnr,

plnkn LIKE plpo-plnkn,

zaehl LIKE plpo-zaehl,

loekz LIKE plpo-loekz,

vornr LIKE plpo-vornr,

arbid LIKE plpo-arbid,

ltxa1 LIKE plpo-ltxa1,

usr04 LIKE plpo-usr04,

END OF it_plpo.

  • Internal table for Work Centre

DATA : BEGIN OF it_crhd OCCURS 0,

objty LIKE crhd-objty,

objid LIKE crhd-objid,

arbpl LIKE crhd-arbpl,

END OF it_crhd.

&----


  • DATA DECLARATION

&----


DATA : v_ucomm LIKE sy-ucomm,

v_lines TYPE i,

wk_date LIKE zppt001_prod-audat,

wk_werks LIKE zppt001_prod-werks,

wk_plant LIKE t001w-name1,

wk_dept LIKE zppt001_prod-orgeh,

wk_pernr LIKE zppt001_prod-pernr,

wk_empname LIKE pa0001-ename,

wk_deptname LIKE hrp1000-stext,

wk_start LIKE t550a-sobeg,

wk_end LIKE t550a-soend,

wk_motpr LIKE t550a-motpr,

wk_shift LIKE t550a-tprog,

v_persa LIKE hrp1008-persa,

v_btrtl LIKE hrp1008-btrtl.

DATA : wk_year(4) TYPE c,

wk_month(2) TYPE c,

wk_day(2) TYPE c,

wk_days(31) TYPE c,

wk_flag,

wk_tot_rec TYPE i,

wk_persk LIKE pa0001-persk.

&----


  • Internal Table Declaration for F4 help for screen fields

&----


  • Structure for Shift help

TYPES : BEGIN OF values,

motpr LIKE t550a-motpr,

sobeg LIKE t550a-sobeg,

soend LIKE t550a-soend,

tprog LIKE t550a-tprog,

END OF values.

  • Structure for Material help

TYPES : BEGIN OF values1,

maktx LIKE makt-maktx,

matnr LIKE makt-matnr,

END OF values1.

  • Structure for Department help

TYPES : BEGIN OF values2,

stext LIKE hrp1000-stext,

objid LIKE hrp1000-objid,

END OF values2.

  • Structure for Employee help

TYPES : BEGIN OF values3,

ename LIKE pa0001-ename,

pernr LIKE pa0001-pernr,

END OF values3.

  • Structure for Operation help

TYPES : BEGIN OF values4,

matnr LIKE mapl-matnr,

plnnr LIKE mapl-plnnr,

plnal LIKE mapl-plnal,

arbpl LIKE crhd-arbpl,

usr04 LIKE plpo-usr04,

ltxa1 LIKE plpo-ltxa1,

vornr LIKE plpo-vornr,

END OF values4.

  • Structure for type of employee help ( Operator , Helper or Others )

TYPES : BEGIN OF values5,

sno TYPE i,

text LIKE zppt001_prod-plnnr,

sertype LIKE zppt001_prod-sertype,

END OF values5.

  • Internal tables used in F4 help

DATA : BEGIN OF it_matnr OCCURS 0,

matnr LIKE mara-matnr,

END OF it_matnr.

DATA : BEGIN OF it_hrp1008 OCCURS 0,

objid LIKE hrp1008-objid,

END OF it_hrp1008.

DATA : BEGIN OF it_pa0001 OCCURS 0,

pernr LIKE pa0001-pernr,

ename LIKE pa0001-ename,

END OF it_pa0001.

DATA : BEGIN OF it_pa0000 OCCURS 0,

pernr LIKE pa0000-pernr,

END OF it_pa0000.

DATA: progname LIKE sy-repid,

dynnum LIKE sy-dynnr,

dynpro_values TYPE TABLE OF dynpread,

field_value LIKE LINE OF dynpro_values,

values_tab TYPE TABLE OF values WITH HEADER LINE,

values_tab1 TYPE TABLE OF values1 WITH HEADER LINE,

values_tab2 TYPE TABLE OF values2 WITH HEADER LINE,

values_tab3 TYPE TABLE OF values3 WITH HEADER LINE,

values_tab4 TYPE TABLE OF values4 WITH HEADER LINE,

values_tab5 TYPE TABLE OF values5 WITH HEADER LINE.

DATA : person_tab LIKE rhldapp OCCURS 0 WITH HEADER LINE,

orgunits LIKE rhldapo OCCURS 0 WITH HEADER LINE.

DATA : return_tab LIKE ddshretval OCCURS 0 WITH HEADER LINE.

&----


*& Module STATUS_0100 OUTPUT

&----


  • text

----


MODULE status_0100 OUTPUT.

  • PF status of screen ( Application tool bar settings )

SET PF-STATUS 'ZPPM_TOOL'.

SET TITLEBAR 'ZPPM_TITLE'.

progname = sy-repid.

dynnum = sy-dynnr.

CLEAR: field_value, dynpro_values.

  • Screen Fields for F4 help

field_value-fieldname = 'WK_SHIFT'.

APPEND field_value TO dynpro_values.

field_value-fieldname = 'IT_TC1-MATNR'.

APPEND field_value TO dynpro_values.

field_value-fieldname = 'WK_DEPT'.

APPEND field_value TO dynpro_values.

field_value-fieldname = 'IT_TC1-PERNR'.

APPEND field_value TO dynpro_values.

field_value-fieldname = 'IT_TC1-VORNR'.

APPEND field_value TO dynpro_values.

field_value-fieldname = 'IT_TC1-SERTYPE'.

APPEND field_value TO dynpro_values.

tc1-lines = 400.

  • Moving the cursor field by field

IF wk_werks IS INITIAL.

SET CURSOR FIELD 'WK_WERKS'.

ELSEIF wk_date IS INITIAL.

SET CURSOR FIELD 'WK_DATE'.

ELSEIF wk_shift IS INITIAL.

SET CURSOR FIELD 'WK_SHIFT'.

ELSEIF wk_dept IS INITIAL.

SET CURSOR FIELD 'WK_DEPT'.

ELSE.

ENDIF.

  • Making the table control inactive , till the header data

  • entered completely.

IF wk_werks IS INITIAL OR

wk_date IS INITIAL OR

wk_shift IS INITIAL OR

wk_dept IS INITIAL.

LOOP AT tc1-cols INTO cols WHERE index GT 0.

cols-screen-input = '0'.

MODIFY tc1-cols FROM cols INDEX sy-tabix.

ENDLOOP.

ELSE.

LOOP AT tc1-cols INTO cols WHERE index GE 0.

IF cols-index = '1' OR

cols-index = '8' OR

cols-index = '9' OR

cols-index = '10' OR

cols-index = '11' OR

cols-index = '12' OR

cols-index = '13' OR

cols-index = '14' OR

cols-index = '15'.

cols-screen-input = '1'.

ELSE.

cols-screen-input = '0'.

ENDIF.

MODIFY tc1-cols FROM cols INDEX sy-tabix.

ENDLOOP.

ENDIF.

ENDMODULE. " STATUS_0100 OUTPUT

&----


*& Module READ_TABLE_CONTROL OUTPUT

&----


  • text

----


MODULE read_table_control OUTPUT.

READ TABLE it_tc1_temp INTO it_tc1 INDEX tc1-current_line.

ENDMODULE. " READ_TABLE_CONTROL OUTPUT

&----


*& Module USER_COMMAND_0100 INPUT

&----


  • text

----


MODULE user_command_0100 INPUT.

CLEAR v_ucomm.

v_ucomm = sy-ucomm.

CASE v_ucomm.

  • When the user presses the SAVE Button, the following action will

  • taken.

  • Moving all entered data to internal table and then modifying the data

  • in the database table

WHEN 'WK_SAV'.

it_zppt001-mandt = sy-mandt.

it_zppt001-werks = wk_werks.

it_zppt001-audat = wk_date.

it_zppt001-tprog = wk_shift.

it_zppt001-orgeh = wk_dept.

IF NOT it_tc1_temp[] IS INITIAL.

LOOP AT it_tc1_temp WHERE quantity GT 0.

it_zppt001-matnr = it_tc1_temp-matnr.

it_zppt001-plnnr = it_tc1_temp-plnnr.

it_zppt001-plnal = it_tc1_temp-plnal.

it_zppt001-vornr = it_tc1_temp-vornr.

it_zppt001-arbpl = it_tc1_temp-arbpl.

it_zppt001-sertype = it_tc1_temp-sertype.

it_zppt001-pernr = it_tc1_temp-pernr.

it_zppt001-targqty = it_tc1_temp-targqty.

it_zppt001-quantity = it_tc1_temp-quantity.

it_zppt001-time = it_tc1_temp-time.

it_zppt001-downtime = it_tc1_temp-downtime.

it_zppt001-rejqty = it_tc1_temp-rejqty.

it_zppt001-otime = it_tc1_temp-ot.

it_zppt001-remarks = it_tc1_temp-remarks.

APPEND it_zppt001.

ENDLOOP.

ENDIF.

DESCRIBE TABLE it_zppt001 LINES v_lines.

IF v_lines GT 0.

MODIFY zppt001_prod FROM TABLE it_zppt001.

IF sy-subrc EQ 0.

COMMIT WORK.

MESSAGE s003.

ELSE.

ROLLBACK WORK.

MESSAGE e004.

ENDIF.

ENDIF.

REFRESH : it_tc1_temp.

CLEAR : it_tc1_temp.

CLEAR : wk_pernr.

  • When User presses the DELETE button , the selected rows will be

  • deleted.

WHEN 'DELETE'.

DELETE it_tc1_temp WHERE sel = 'X'.

  • When User presses the CLEAR button , all the fields should be clear.

WHEN 'WK_CLR' .

CLEAR wk_werks.

CLEAR wk_date.

CLEAR wk_shift.

CLEAR wk_dept.

CLEAR it_tc1_temp .

CLEAR wk_plant.

CLEAR wk_pernr.

CLEAR wk_start.

CLEAR wk_end.

CLEAR : wk_empname,

wk_deptname.

REFRESH it_tc1_temp .

  • When the User presses the exit button, the program should terminate.

WHEN 'WK_EXIT'.

LEAVE PROGRAM.

  • When the user presses the COPY button, that row details

  • should be stored in work area

WHEN 'COPY'.

READ TABLE it_tc1_temp WITH KEY sel = 'X'.

IF sy-subrc EQ 0.

CLEAR wk_tc1.

MOVE-CORRESPONDING it_tc1_temp TO wk_tc1.

MOVE space TO wk_tc1-pernr.

it_tc1_temp-sel = ' '.

MODIFY it_tc1_temp TRANSPORTING sel WHERE sel = 'X'.

ENDIF.

  • When the user presses the PASTE button, that copied row should

  • be pasted on that row

WHEN 'PASTE'.

READ TABLE it_tc1_temp WITH KEY sel = 'X'.

MOVE-CORRESPONDING wk_tc1 TO it_tc1_temp.

APPEND it_tc1_temp.

ENDCASE.

ENDMODULE. " USER_COMMAND_0100 INPUT

&----


*& Module DATA_VALIDATION INPUT

&----


  • text

----


MODULE data_validation INPUT.

SELECT SINGLE name1 FROM t001w INTO wk_plant WHERE werks = wk_werks.

IF sy-subrc NE 0.

MESSAGE e000(zpp) WITH wk_werks.

SET CURSOR FIELD 'WK_WERKS'.

ELSE.

SET CURSOR FIELD 'WK_DATE'.

ENDIF.

  • To get the Work Schedule details

IF wk_werks = '1010'.

wk_motpr = '93'.

ELSEIF wk_werks = '1020'.

wk_motpr = '92'.

ELSEIF wk_werks = '1030'.

wk_motpr = '94'.

ELSEIF wk_werks = '1040'.

wk_motpr = '97'.

ELSEIF wk_werks = '1050'.

wk_motpr = '95'.

ELSEIF wk_werks = '1060'.

wk_motpr = '91'.

ELSEIF wk_werks = '1070'.

wk_motpr = '96'.

ELSEIF wk_werks = '1080'.

wk_motpr = '98'.

ENDIF.

REFRESH: values_tab.

CLEAR : values_tab.

  • Getting the Plant shift details

SELECT motpr

tprog

sobeg

soend FROM t550a INTO CORRESPONDING FIELDS OF

TABLE values_tab WHERE

motpr = wk_motpr AND

begda LE sy-datum AND

endda GE sy-datum.

  • Validating the Shift

IF NOT wk_shift IS INITIAL.

READ TABLE values_tab WITH KEY tprog = wk_shift.

IF sy-subrc NE 0.

MESSAGE e002 WITH text-013.

ELSE.

wk_start = values_tab-sobeg.

wk_end = values_tab-soend.

ENDIF.

ENDIF.

  • Validating the Department

IF NOT wk_dept IS INITIAL.

READ TABLE values_tab2 WITH KEY objid = wk_dept.

IF sy-subrc NE 0.

MESSAGE e002 WITH text-012.

ELSE.

wk_deptname = values_tab2-stext.

ENDIF.

ENDIF.

ENDMODULE. " DATA_VALIDATION INPUT

&----


*& Module VALIDATE_DATA INPUT

&----


  • text

----


MODULE validate_data INPUT.

READ TABLE it_tc1_temp INDEX tc1-current_line.

IF sy-subrc EQ 0.

  • If record exits in table control , modify the contents

MODIFY it_tc1_temp FROM it_tc1 INDEX tc1-current_line.

ELSE.

  • If new record append the record to table control

  • If user gives the material, the table control should get

  • all the operations of that material as row wise.

SELECT matnr

werks

plnty

plnnr

plnal

zkriz

zaehl

loekz FROM mapl INTO TABLE it_mapl

WHERE matnr = it_tc1-matnr

AND werks = wk_werks

AND plnty = 'N'

AND loekz NE 'X'.

IF sy-subrc EQ 0.

SELECT plnty

plnnr

plnal

plnfl

plnkn

zaehl

loekz FROM plas INTO TABLE it_plas

FOR ALL ENTRIES IN it_mapl

WHERE plnty = it_mapl-plnty AND

plnnr = it_mapl-plnnr AND

plnal = it_mapl-plnal AND

loekz NE 'X'.

SELECT plnty

plnnr

plnkn

zaehl

loekz

vornr

arbid

ltxa1

usr04 FROM plpo INTO TABLE it_plpo

FOR ALL ENTRIES IN it_plas

WHERE plnty = it_plas-plnty

AND plnnr = it_plas-plnnr

AND plnkn = it_plas-plnkn

AND zaehl = it_plas-zaehl

AND loekz NE 'X'.

IF sy-subrc EQ 0.

SORT it_plpo BY vornr.

SELECT objty

objid

arbpl FROM crhd INTO TABLE it_crhd

FOR ALL ENTRIES IN it_plpo

WHERE objty = 'A'

AND objid = it_plpo-arbid.

ENDIF.

ENDIF.

  • Appending all the operation of material to table control internal

  • table

LOOP AT it_mapl.

it_tc1-plnnr = it_mapl-plnnr.

it_tc1-plnal = it_mapl-plnal.

LOOP AT it_plpo WHERE plnty = it_mapl-plnty

AND plnnr = it_mapl-plnnr.

it_tc1-vornr = it_plpo-vornr.

it_tc1-opdes = it_plpo-ltxa1.

it_tc1-targqty = it_plpo-usr04.

READ TABLE it_crhd WITH KEY objid = it_plpo-arbid.

IF sy-subrc EQ 0.

it_tc1-arbpl = it_crhd-arbpl.

ENDIF.

it_tc1-sertype = 'L'.

APPEND it_tc1 TO it_tc1_temp.

ENDLOOP.

ENDLOOP.

ENDIF.

  • Displaying the Employee name

IF NOT it_tc1-pernr IS INITIAL.

READ TABLE values_tab3 WITH KEY pernr = it_tc1-pernr.

IF sy-subrc EQ 0.

wk_empname = values_tab3-ename.

ELSE.

MESSAGE e002 WITH text-011.

ENDIF.

ENDIF.

  • If production Qty is there, checking the employee code and time

IF NOT it_tc1-quantity IS INITIAL.

IF it_tc1-pernr EQ ' '.

MESSAGE e002 WITH text-005.

ENDIF.

IF it_tc1-time EQ ' '.

MESSAGE e002 WITH text-007.

ENDIF.

ENDIF.

  • Checking whether rejection quantity is less than the production qty

IF NOT it_tc1-quantity IS INITIAL AND

NOT it_tc1-rejqty IS INITIAL.

IF it_tc1-quantity LT it_tc1-rejqty.

MESSAGE e002 WITH text-014.

ENDIF.

ENDIF.

ENDMODULE. " VALIDATE_DATA INPUT

&----


*& Module SHIFT_VALUES INPUT

&----


  • text

----


MODULE shift_values INPUT.

  • Getting the Work Schedule rule for the plant

CLEAR : wk_motpr.

IF wk_werks = '1010'.

wk_motpr = '93'.

ELSEIF wk_werks = '1020'.

wk_motpr = '92'.

ELSEIF wk_werks = '1030'.

wk_motpr = '94'.

ELSEIF wk_werks = '1040'.

wk_motpr = '97'.

ELSEIF wk_werks = '1050'.

wk_motpr = '95'.

ELSEIF wk_werks = '1060'.

wk_motpr = '91'.

ELSEIF wk_werks = '1070'.

wk_motpr = '96'.

ELSEIF wk_werks = '1080'.

wk_motpr = '98'.

ENDIF.

CLEAR : values_tab.

REFRESH : values_tab.

  • Getting the Shift for the Plant

SELECT motpr

tprog

sobeg

soend FROM t550a INTO CORRESPONDING FIELDS OF

TABLE values_tab WHERE

motpr = wk_motpr AND

begda LE sy-datum AND

endda GE sy-datum.

  • F4 help for Shift

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'WK_SHIFT'

dynpprog = progname

dynpnr = dynnum

dynprofield = 'WK_SHIFT'

value_org = 'S'

TABLES

value_tab = values_tab

return_tab = return_tab

EXCEPTIONS

parameter_error = 1

no_values_found = 2

OTHERS = 3.

ENDMODULE. " SHIFT_VALUES INPUT

&----


*& Module MATNR_VALUES INPUT

&----


  • text

----


MODULE matnr_values INPUT.

  • Selection of Materials in that plant

SELECT matnr FROM marc

INTO TABLE it_matnr

WHERE werks = wk_werks.

IF sy-subrc EQ 0.

SELECT matnr maktx FROM makt

INTO CORRESPONDING FIELDS OF TABLE values_tab1

FOR ALL ENTRIES IN it_matnr

WHERE matnr = it_matnr-matnr

AND spras = 'E'.

ENDIF.

  • F4 help for Material

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'IT_TC1-MATNR'

dynpprog = progname

dynpnr = dynnum

dynprofield = 'IT_TC1-MATNR'

value_org = 'S'

TABLES

value_tab = values_tab1

return_tab = return_tab

EXCEPTIONS

parameter_error = 1

no_values_found = 2

OTHERS = 3.

ENDMODULE. " MATNR_VALUES INPUT

&----


*& Module DEPT_VALUES INPUT

&----


  • text

----


MODULE dept_values INPUT.

  • Getting the personal area , sub area details of plant

IF wk_werks = '1020'.

v_persa = 'OMHR'.

v_btrtl = '0001'.

ELSEIF wk_werks = '1010'.

v_persa = 'OMHR'.

v_btrtl = '0002'.

ELSEIF wk_werks = '1030'.

v_persa = 'OMHR'.

v_btrtl = '0003'.

ELSEIF wk_werks = '1040'.

v_persa = 'OMHR'.

v_btrtl = '0006'.

ELSEIF wk_werks = '1050'.

v_persa = 'OMHR'.

v_btrtl = '0004'.

ELSEIF wk_werks = '1070'.

v_persa = 'OMHR'.

v_btrtl = '0005'.

ELSEIF wk_werks = '1080'.

v_persa = 'OMHR'.

v_btrtl = '0007'.

ELSEIF wk_werks = '1060'.

v_persa = 'OMBN'.

v_btrtl = '0001'.

ENDIF.

SELECT objid FROM hrp1008

INTO TABLE it_hrp1008

WHERE plvar EQ '01' AND

otype EQ 'O' AND begda LE sy-datum AND

endda GE sy-datum AND

persa = v_persa AND btrtl = v_btrtl.

  • Getting the department details

IF NOT it_hrp1008[] IS INITIAL.

SELECT objid stext FROM hrp1000

INTO CORRESPONDING FIELDS OF

TABLE values_tab2 FOR ALL ENTRIES IN

it_hrp1008 WHERE plvar EQ '01' AND

otype EQ 'O' AND objid = it_hrp1008-objid AND

begda LE sy-datum AND endda GE sy-datum.

ENDIF.

  • F4 help for department

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'WK_DEPT'

dynpprog = progname

dynpnr = dynnum

dynprofield = 'WK_DEPT'

value_org = 'S'

TABLES

value_tab = values_tab2

return_tab = return_tab

EXCEPTIONS

parameter_error = 1

no_values_found = 2

OTHERS = 3.

CLEAR values_tab3.

REFRESH values_tab3.

ENDMODULE. " DEPT_VALUES INPUT

&----


*& Module PERNR_VALUES INPUT

&----


  • text

----


MODULE pernr_values INPUT.

CLEAR : values_tab3.

REFRESH : values_tab3.

CLEAR : person_tab , orgunits.

REFRESH : person_tab , orgunits.

  • Getting all the departments that are lying under given department

  • Getting all the employees lying in all departments

CALL FUNCTION 'RH_DIR_ORG_STRUC_GET'

EXPORTING

act_orgunit = wk_dept

act_plvar = '01'

act_date = wk_date

sort_flag = ''

add_flag_pdata = ''

TABLES

org_units = orgunits

person_tab = person_tab

  • org_pers_rel = org_pers_rel

EXCEPTIONS

no_active_plvar = 1

OTHERS = 2

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

LOOP AT person_tab.

values_tab3-ename = person_tab-editname.

values_tab3-pernr = person_tab-objid.

APPEND values_tab3.

CLEAR values_tab3.

ENDLOOP.

LOOP AT orgunits.

SELECT pernr ename FROM pa0001 INTO TABLE

it_pa0001 WHERE begda LE wk_date AND

endda GE wk_date AND

orgeh EQ orgunits-orgid AND

persk IN ('I1','I2','I3','I4','I5',

'W1','W2','W3','W4','W5').

IF NOT it_pa0001[] IS INITIAL.

SELECT pernr FROM pa0000 INTO TABLE it_pa0000

FOR ALL ENTRIES IN it_pa0001

WHERE pernr = it_pa0001-pernr

AND begda LE wk_date AND

endda GE wk_date AND

stat2 EQ '3'.

ENDIF.

LOOP AT it_pa0000.

READ TABLE it_pa0001 WITH KEY pernr = it_pa0000-pernr.

IF sy-subrc EQ 0.

values_tab3-ename = it_pa0001-ename.

values_tab3-pernr = it_pa0001-pernr.

APPEND values_tab3.

CLEAR values_tab3.

ENDIF.

ENDLOOP.

CLEAR : it_pa0000 , it_pa0001.

REFRESH : it_pa0000 , it_pa0001.

ENDLOOP.

SORT values_tab3 BY ename.

  • F4 help for employee

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'IT_TC1-PERNR'

dynpprog = progname

dynpnr = dynnum

dynprofield = 'IT_TC1-PERNR'

value_org = 'S'

TABLES

value_tab = values_tab3

return_tab = return_tab

EXCEPTIONS

parameter_error = 1

no_values_found = 2

OTHERS = 3.

ENDMODULE. " PERNR_VALUES INPUT

&----


*& Module EXIT_SCREEN INPUT

&----


  • text

----


MODULE exit_screen INPUT.

  • If user presses BACK OR CANCEL OR EXIT button, leave the program.

CASE sy-ucomm.

WHEN 'BACK' OR 'CANC' OR 'EXIT' OR 'WK_EXIT'.

LEAVE PROGRAM.

ENDCASE.

ENDMODULE. " EXIT_SCREEN INPUT

&----


*& Module VORNR_VALUES INPUT

&----


  • text

----


MODULE vornr_values INPUT.

  • Getting the operation codes for given material

CLEAR : values_tab4.

REFRESH : values_tab4.

LOOP AT it_mapl.

values_tab4-matnr = it_mapl-matnr.

values_tab4-plnnr = it_mapl-plnnr.

values_tab4-plnal = it_mapl-plnal.

LOOP AT it_plpo WHERE plnty = it_mapl-plnty

AND plnnr = it_mapl-plnnr.

values_tab4-vornr = it_plpo-vornr.

values_tab4-ltxa1 = it_plpo-ltxa1.

values_tab4-usr04 = it_plpo-usr04.

READ TABLE it_crhd WITH KEY objid = it_plpo-arbid.

IF sy-subrc EQ 0.

values_tab4-arbpl = it_crhd-arbpl.

ENDIF.

APPEND values_tab4.

ENDLOOP.

ENDLOOP.

SORT values_tab4 BY vornr.

DELETE ADJACENT DUPLICATES FROM values_tab4 COMPARING vornr.

  • F4 help for operation code

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'IT_TC1-VORNR'

dynpprog = progname

dynpnr = dynnum

dynprofield = 'IT_TC1-VORNR'

value_org = 'S'

TABLES

value_tab = values_tab4

return_tab = return_tab

EXCEPTIONS

parameter_error = 1

no_values_found = 2

OTHERS = 3.

ENDMODULE. " VORNR_VALUES INPUT

&----


*& Module TYPE_VALUES INPUT

&----


  • text

----


MODULE sertype_values INPUT.

  • Different type of employee services like Operator, Helper or others

CLEAR : values_tab5.

REFRESH : values_tab5.

values_tab5-sno = 1.

values_tab5-text = 'Operator'.

values_tab5-sertype = 'L'.

APPEND values_tab5.

values_tab5-sno = 2.

values_tab5-text = 'Helper'.

values_tab5-sertype = 'H'.

APPEND values_tab5.

values_tab5-sno = 3.

values_tab5-text = 'Other work'.

values_tab5-sertype = 'O'.

APPEND values_tab5.

  • F4 help for different Service types

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'IT_TC1-SERTYPE'

dynpprog = progname

dynpnr = dynnum

dynprofield = 'IT_TC1-SERTYPE'

value_org = 'S'

TABLES

value_tab = values_tab5

return_tab = return_tab

EXCEPTIONS

parameter_error = 1

no_values_found = 2

OTHERS = 3.

ENDMODULE. " TYPE_VALUES INPUT

modify it according to ur need!!

PLease reward points by clicking on the star if it helps!!

Regards

Gunjan

abdul_hakim
Active Contributor
0 Kudos

Hi,

Type ABAPDOCU in the command field you will demo program for all the functionalities..

REgards,

Abdul

Former Member
0 Kudos

hi,

looking at your requirement.

i think instead of breaking your head.

Just create the table maintenance in your se11,

use the 2 step process and give 2 screen nos.

then in se38 create a simple program and call the function module

VIEW_MAINTENANCE_CALL

and pass the parameters

Action = 'S' or as per your requirement

view_name = z table name

TABLES

  • DBA_SELLIST =

EXCL_CUA_FUNCT = I_VIMEXCLFUN

contains the functions codes of what you want to do.

just append them into the function modules.

Thanks,

Murali

0 Kudos

Murali Can you please explain me clearly with an example.It is very urgent requirement.

0 Kudos
REPORT ZTAB_MAINT
       NO STANDARD PAGE HEADING
       MESSAGE-ID ZZ.

*----------------------------------------------------------------------*
*                   T Y P E  D E C L A R A T I O N S
*----------------------------------------------------------------------*
*--Types declaration for selection to be passed as parameter into
*--VIEW_MAINTENANCE_CALL FM
TYPES: BEGIN OF TP_RANGETAB.
        INCLUDE STRUCTURE VIMSELLIST.
TYPES: END OF TP_RANGETAB.
*----------------------------------------------------------------------*
*                D A T A  D E C L A R A T I O N S
*----------------------------------------------------------------------*
DATA: V_MATNR TYPE ZATP-MATNR,              " Material Number
      V_WERKS TYPE ZATP-WERKS,              " Plant
      V_KONOB TYPE ZATP-KONOB,              " Product allocation object
      V_ZCPLT TYPE ZATP-ZCPLT.              " Plant
*----------------------------------------------------------------------*
*        I N T E R N A L  T A B L E  D E C L A R A T I O N S
*----------------------------------------------------------------------*
* Internal table to subroutine code
*Internal table used as selection for VIEW_MAINTENANCE_CALL FM
DATA: IT_RANGETAB TYPE STANDARD TABLE OF TP_RANGETAB WITH HEADER LINE.
*--Internal table used for getting the tablefields
DATA: BEGIN OF IT_HEADER OCCURS 1.
        INCLUDE STRUCTURE VIMDESC.
DATA: END   OF IT_HEADER.
*--Name Tabel
DATA: BEGIN OF IT_NAMTAB OCCURS 50.
        INCLUDE STRUCTURE VIMNAMTAB.
DATA: END   OF IT_NAMTAB.
*--Used for handling 'BT' option
DATA: BEGIN OF IT_MATNR OCCURS 0,
        MATNR TYPE ZATP-MATNR,
      END OF IT_MATNR.
*--Used for handling 'BT' option
DATA: BEGIN OF IT_WERKS OCCURS 0,
        WERKS TYPE ZTAB-WERKS,
      END OF IT_WERKS.
*--Used for handling 'BT' option
DATA: BEGIN OF IT_KONOB OCCURS 0,
        KONOB TYPE ZTAB-KONOB,
      END OF IT_KONOB.
*--Used for handling 'BT' option
DATA: BEGIN OF IT_ZCPLT OCCURS 0,
        ZCPLT TYPE ZATP-ZCPLT,
      END OF IT_ZCPLT.
*----------------------------------------------------------------------*
*                    I N P U T  S C R E E N
*----------------------------------------------------------------------*
SELECTION-SCREEN BEGIN OF BLOCK SELSCR WITH FRAME TITLE TEXT-001.
RANGES: R_MATNR FOR V_MATNR.
RANGES: R_WERKS FOR V_WERKS.
RANGES: R_KONOB FOR V_KONOB.
RANGES: R_ZCPLT FOR V_ZCPLT.
* Select Options
SELECT-OPTIONS: S_MATNR FOR V_MATNR NO-EXTENSION,     " Material
                S_WERKS FOR V_WERKS NO-EXTENSION,     " Plant
                S_KONOB FOR V_KONOB NO-EXTENSION,
                                        " Product allocation object
                S_ZCPLT FOR V_ZCPLT NO-EXTENSION.     " Plant
SELECTION-SCREEN END OF BLOCK SELSCR.
*----------------------------------------------------------------------*
*              A T  S E L E C T I O N  S C R E E N
*----------------------------------------------------------------------*
AT SELECTION-SCREEN.
* Validate user inputs
  PERFORM FRM_VALIDATIONS.
*----------------------------------------------------------------------*
*             S T A R T  O F  S E L E C T I O N
*----------------------------------------------------------------------*
START-OF-SELECTION.
* Fetch Data from Data Base
  PERFORM FRM_GET_DATA.
*----------------------------------------------------------------------*
*                      S U B  R O U T I N E S
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*&      Form  frm_get_data
*&---------------------------------------------------------------------*
*       Call the function module VIEW_MAINTENNACE_CALL to get data
*       based on selection criteria
*----------------------------------------------------------------------*
FORM FRM_GET_DATA .
  CALL FUNCTION 'VIEW_GET_DDIC_INFO'
    EXPORTING
      VIEWNAME = 'ZTAB'
    TABLES
      X_HEADER = IT_HEADER
      X_NAMTAB = IT_NAMTAB
      SELLIST  = IT_RANGETAB
    EXCEPTIONS
      NO_TVDIR_ENTRY = 1
      TABLE_NOT_FOUND = 2.
  IF SY-SUBRC <> 0.
    MESSAGE E002 WITH 'Error in ZTAB table'(005).
  ENDIF.
  CLEAR: IT_RANGETAB,
         IT_RANGETAB[].
  LOOP AT IT_NAMTAB.
    CASE IT_NAMTAB-VIEWFIELD.
      WHEN 'MATNR'.
        CLEAR IT_RANGETAB.
        IT_RANGETAB-VIEWFIELD = 'MATNR'.
        IT_RANGETAB-TABIX     = SY-TABIX.
        IT_RANGETAB-DDIC      = IT_NAMTAB-READONLY.
        LOOP AT S_MATNR.
          CASE S_MATNR-OPTION.
            WHEN 'EQ'.
              IT_RANGETAB-AND_OR    = 'AND'.
              IT_RANGETAB-OPERATOR  = 'EQ'.
              IT_RANGETAB-VALUE     = S_MATNR-LOW.
              APPEND IT_RANGETAB.
            WHEN 'BT'.
              IT_RANGETAB-AND_OR    = 'AND'.
              IT_RANGETAB-OPERATOR = 'GE'.
              IT_RANGETAB-VALUE     = S_MATNR-LOW.
              APPEND IT_RANGETAB.
              IT_RANGETAB-AND_OR    = 'AND'.
              IT_RANGETAB-OPERATOR = 'LE'.
              IT_RANGETAB-VALUE     = S_MATNR-HIGH.
              APPEND IT_RANGETAB.
            WHEN 'NB'.
              CLEAR: R_MATNR,
                     R_MATNR[].
              R_MATNR-SIGN = 'I'.
              R_MATNR-OPTION = 'BT'.
              R_MATNR-LOW = S_MATNR-LOW.
              R_MATNR-HIGH = S_MATNR-HIGH.
              APPEND R_MATNR.
              SELECT MATNR
                     INTO TABLE IT_MATNR
                     FROM ZTAB
                     WHERE MATNR IN R_MATNR.
              DELETE ADJACENT DUPLICATES FROM IT_MATNR COMPARING MATNR
.
              LOOP AT IT_MATNR.
                IT_RANGETAB-AND_OR    = 'AND'.
                IT_RANGETAB-OPERATOR = 'NE'.
                IT_RANGETAB-VALUE    = IT_MATNR-MATNR.
                APPEND IT_RANGETAB.
              ENDLOOP.
            WHEN 'NE'.
              IT_RANGETAB-AND_OR    = 'AND'.
              IT_RANGETAB-OPERATOR  = 'NE'.
              IT_RANGETAB-VALUE     = S_MATNR-LOW.
              APPEND IT_RANGETAB.
            WHEN OTHERS.
              IT_RANGETAB-AND_OR    = 'AND'.
              IT_RANGETAB-OPERATOR = S_MATNR-OPTION.
              IT_RANGETAB-VALUE    = S_MATNR-LOW.
              APPEND IT_RANGETAB.
          ENDCASE.
        ENDLOOP.

      WHEN 'WERKS'.
        CLEAR IT_RANGETAB.
        IT_RANGETAB-VIEWFIELD = 'WERKS'.
        IT_RANGETAB-TABIX     = SY-TABIX.
        IT_RANGETAB-DDIC      = IT_NAMTAB-READONLY.
        LOOP AT S_WERKS.
          CASE S_WERKS-OPTION.
            WHEN 'EQ'.
              IT_RANGETAB-AND_OR    = 'AND'.
              IT_RANGETAB-OPERATOR  = 'EQ'.
              IT_RANGETAB-VALUE     = S_WERKS-LOW.
              APPEND IT_RANGETAB.
            WHEN 'BT'.
              IT_RANGETAB-AND_OR    = 'AND'.
              IT_RANGETAB-OPERATOR = 'GE'.
              IT_RANGETAB-VALUE     = S_WERKS-LOW.
              APPEND IT_RANGETAB.
              IT_RANGETAB-AND_OR    = 'AND'.
              IT_RANGETAB-OPERATOR = 'LE'.
              IT_RANGETAB-VALUE     = S_WERKS-HIGH.
              APPEND IT_RANGETAB.
            WHEN 'NB'.
              CLEAR: R_WERKS,
                     R_WERKS[].
              R_WERKS-SIGN = 'I'.
              R_WERKS-OPTION = 'BT'.
              R_WERKS-LOW = S_WERKS-LOW.
              R_WERKS-HIGH = S_WERKS-HIGH.
              APPEND R_WERKS.
              SELECT WERKS
                     INTO TABLE IT_WERKS
                     FROM ZTAB
                     WHERE WERKS IN R_WERKS.
              DELETE ADJACENT DUPLICATES FROM IT_WERKS COMPARING WERKS
.
              LOOP AT IT_WERKS.
                IT_RANGETAB-AND_OR    = 'AND'.
                IT_RANGETAB-OPERATOR = 'NE'.
                IT_RANGETAB-VALUE    = IT_WERKS-WERKS.
                APPEND IT_RANGETAB.
              ENDLOOP.
            WHEN 'NE'.
              IT_RANGETAB-AND_OR    = 'AND'.
              IT_RANGETAB-OPERATOR  = 'NE'.
              IT_RANGETAB-VALUE     = S_WERKS-LOW.
              APPEND IT_RANGETAB.
            WHEN OTHERS.
              IT_RANGETAB-AND_OR    = 'AND'.
              IT_RANGETAB-OPERATOR = S_WERKS-OPTION.
              IT_RANGETAB-VALUE    = S_WERKS-LOW.
              APPEND IT_RANGETAB.
          ENDCASE.
        ENDLOOP.

      WHEN 'KONOB'.
        CLEAR IT_RANGETAB.
        IT_RANGETAB-VIEWFIELD = 'KONOB'.
        IT_RANGETAB-TABIX     = SY-TABIX.
        IT_RANGETAB-DDIC      = IT_NAMTAB-READONLY.
        LOOP AT S_KONOB.
          CASE S_KONOB-OPTION.
            WHEN 'EQ'.
              IT_RANGETAB-AND_OR    = 'AND'.
              IT_RANGETAB-OPERATOR  = 'EQ'.
              IT_RANGETAB-VALUE     = S_KONOB-LOW.
              APPEND IT_RANGETAB.
            WHEN 'BT'.
              IT_RANGETAB-AND_OR    = 'AND'.
              IT_RANGETAB-OPERATOR = 'GE'.
              IT_RANGETAB-VALUE     = S_KONOB-LOW.
              APPEND IT_RANGETAB.
              IT_RANGETAB-AND_OR    = 'AND'.
              IT_RANGETAB-OPERATOR = 'LE'.
              IT_RANGETAB-VALUE     = S_KONOB-HIGH.
              APPEND IT_RANGETAB.
            WHEN 'NB'.
              CLEAR: R_KONOB,
                     R_KONOB[].
              R_KONOB-SIGN = 'I'.
              R_KONOB-OPTION = 'BT'.
              R_KONOB-LOW = S_KONOB-LOW.
              R_KONOB-HIGH = S_KONOB-HIGH.
              APPEND R_KONOB.
              SELECT KONOB
                     INTO TABLE IT_KONOB
                     FROM ZTAB
                     WHERE KONOB IN R_KONOB.
              DELETE ADJACENT DUPLICATES FROM IT_KONOB COMPARING KONOB
.
              LOOP AT IT_KONOB.
                IT_RANGETAB-AND_OR    = 'AND'.
                IT_RANGETAB-OPERATOR = 'NE'.
                IT_RANGETAB-VALUE    = IT_KONOB-KONOB.
                APPEND IT_RANGETAB.
              ENDLOOP.
            WHEN 'NE'.
              IT_RANGETAB-AND_OR    = 'AND'.
              IT_RANGETAB-OPERATOR  = 'NE'.
              IT_RANGETAB-VALUE     = S_KONOB-LOW.
              APPEND IT_RANGETAB.
            WHEN OTHERS.
              IT_RANGETAB-AND_OR    = 'AND'.
              IT_RANGETAB-OPERATOR = S_KONOB-OPTION.
              IT_RANGETAB-VALUE    = S_KONOB-LOW.
              APPEND IT_RANGETAB.
          ENDCASE.
        ENDLOOP.

      WHEN 'ZCPLT'.
        CLEAR IT_RANGETAB.
        IT_RANGETAB-VIEWFIELD = 'ZCPLT'.
        IT_RANGETAB-TABIX     = SY-TABIX.
        IT_RANGETAB-DDIC      = IT_NAMTAB-READONLY.
        LOOP AT S_ZCPLT.
          CASE S_ZCPLT-OPTION.
            WHEN 'EQ'.
              IT_RANGETAB-AND_OR    = 'AND'.
              IT_RANGETAB-OPERATOR  = 'EQ'.
              IT_RANGETAB-VALUE     = S_ZCPLT-LOW.
              APPEND IT_RANGETAB.
            WHEN 'BT'.
              IT_RANGETAB-AND_OR    = 'AND'.
              IT_RANGETAB-OPERATOR = 'GE'.
              IT_RANGETAB-VALUE     = S_ZCPLT-LOW.
              APPEND IT_RANGETAB.
              IT_RANGETAB-AND_OR    = 'AND'.
              IT_RANGETAB-OPERATOR = 'LE'.
              IT_RANGETAB-VALUE     = S_ZCPLT-HIGH.
              APPEND IT_RANGETAB.
            WHEN 'NB'.
              CLEAR: R_ZCPLT,
                     R_ZCPLT[].
              R_ZCPLT-SIGN = 'I'.
              R_ZCPLT-OPTION = 'BT'.
              R_ZCPLT-LOW = S_ZCPLT-LOW.
              R_ZCPLT-HIGH = S_ZCPLT-HIGH.
              APPEND R_ZCPLT.
              SELECT ZCPLT
                     INTO TABLE IT_ZCPLT
                     FROM ZTAB
                     WHERE ZCPLT IN R_ZCPLT.
              DELETE ADJACENT DUPLICATES FROM IT_ZCPLT COMPARING ZCPLT
.
              LOOP AT IT_ZCPLT.
                IT_RANGETAB-AND_OR    = 'AND'.
                IT_RANGETAB-OPERATOR = 'NE'.
                IT_RANGETAB-VALUE    = IT_ZCPLT-ZCPLT.
                APPEND IT_RANGETAB.
              ENDLOOP.
            WHEN 'NE'.
              IT_RANGETAB-AND_OR    = 'AND'.
              IT_RANGETAB-OPERATOR  = 'NE'.
              IT_RANGETAB-VALUE     = S_ZCPLT-LOW.
              APPEND IT_RANGETAB.
            WHEN OTHERS.
              IT_RANGETAB-AND_OR    = 'AND'.
              IT_RANGETAB-OPERATOR = S_ZCPLT-OPTION.
              IT_RANGETAB-VALUE    = S_ZCPLT-LOW.
              APPEND IT_RANGETAB.
          ENDCASE.
        ENDLOOP.
    ENDCASE.
  ENDLOOP.

  IF S_ZCPLT[] IS INITIAL.
    CALL FUNCTION 'VIEW_MAINTENANCE_CALL'
      EXPORTING
        ACTION      = 'U'
        VIEW_NAME   = 'ZTAB'
      TABLES
        DBA_SELLIST = IT_RANGETAB
      EXCEPTIONS
        CLIENT_REFERENCE                     = 1
        FOREIGN_LOCK                         = 2
        INVALID_ACTION                       = 3
        NO_CLIENTINDEPENDENT_AUTH            = 4
        NO_DATABASE_FUNCTION                 = 5
        NO_EDITOR_FUNCTION                   = 6
        NO_SHOW_AUTH                         = 7
        NO_TVDIR_ENTRY                       = 8
        NO_UPD_AUTH                          = 9
        ONLY_SHOW_ALLOWED                    = 10
        SYSTEM_FAILURE                       = 11
        UNKNOWN_FIELD_IN_DBA_SELLIST         = 12
        VIEW_NOT_FOUND                       = 13
        MAINTENANCE_PROHIBITED               = 14
        OTHERS                               = 15.
    IF SY-SUBRC <> 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
  ELSE.
    CALL FUNCTION 'VIEW_MAINTENANCE_CALL'
      EXPORTING
        ACTION      = 'U'
        VIEW_NAME   = 'ZTAB_ZTEST'
      TABLES
        DBA_SELLIST = IT_RANGETAB
      EXCEPTIONS
        CLIENT_REFERENCE                     = 1
        FOREIGN_LOCK                         = 2
        INVALID_ACTION                       = 3
        NO_CLIENTINDEPENDENT_AUTH            = 4
        NO_DATABASE_FUNCTION                 = 5
        NO_EDITOR_FUNCTION                   = 6
        NO_SHOW_AUTH                         = 7
        NO_TVDIR_ENTRY                       = 8
        NO_UPD_AUTH                          = 9
        ONLY_SHOW_ALLOWED                    = 10
        SYSTEM_FAILURE                       = 11
        UNKNOWN_FIELD_IN_DBA_SELLIST         = 12
        VIEW_NOT_FOUND                       = 13
        MAINTENANCE_PROHIBITED               = 14
        OTHERS                               = 15.
    IF SY-SUBRC <> 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
  ENDIF.
ENDFORM.                    " frm_get_data
*&---------------------------------------------------------------------*
*&      Form  frm_validations
*&---------------------------------------------------------------------*
*       Validating field values
*----------------------------------------------------------------------*
FORM FRM_VALIDATIONS .

* Material number should not be validated (10/17/2005)
*  CLEAR V_MATNR.
*  SELECT SINGLE MATNR
*                INTO V_MATNR
*                FROM MARA
*                WHERE MATNR IN S_MATNR.
*  IF SY-SUBRC <> 0.
*    MESSAGE E002 WITH 'Material not found'.
*  ENDIF.

  CLEAR V_WERKS.
  SELECT SINGLE WERKS
                INTO V_WERKS
                FROM T001W
                WHERE WERKS IN S_WERKS.
  IF SY-SUBRC <> 0.
    MESSAGE E002 WITH 'Plant (WERKS) not found'(002).
  ENDIF.
  CLEAR V_KONOB.
  SELECT SINGLE KONOB
                INTO V_KONOB
                FROM T190O
                WHERE KONOB IN S_KONOB.
  IF SY-SUBRC <> 0.
    MESSAGE E002 WITH ' Product allocation object not found'(003).
  ENDIF.
  CLEAR V_WERKS.
  SELECT SINGLE WERKS
                INTO V_WERKS
                FROM T001W
                WHERE WERKS IN S_ZCPLT.
  IF SY-SUBRC <> 0.
    MESSAGE E002 WITH 'Plant (ZCPLT) not found'(004).
  ENDIF.
ENDFORM.                    " frm_validations

0 Kudos

in se11 generate table maintenance for your table and then try to do in the same way as i mentioned..

if you are not able to understand any thing please let me

know..

regards

vijay

0 Kudos

Hi ,

sorry i didnot login from morning.

Assuming you are in 4.6 and above version.

Step 1.

create table Maintenance

go to se11

type in the table name and go in the change mode.

from the menu

utilites--> table maintenance generator

here give -->

authorization group = &NC&

function group name = same as table name

maintenance type --> select radio button single step

overview screen = 100

then save and Generate.

Step 2.

REPORT ZTESTBMK .

tables : your table name here.

data : i_VIMEXCLFUN like VIMEXCLFUN occurs 0 with header line.

  • start of slection

start-of-selection.

i_VIMEXCLFUN-function = 'AEND'.

append i_VIMEXCLFUN.

CALL FUNCTION 'VIEW_MAINTENANCE_CALL'

EXPORTING

ACTION = 'U'

  • CORR_NUMBER = ' '

  • GENERATE_MAINT_TOOL_IF_MISSING = ' '

  • SHOW_SELECTION_POPUP = ' '

VIEW_NAME = your table name in quotes

  • NO_WARNING_FOR_CLIENTINDEP = ' '

  • RFC_DESTINATION_FOR_UPGRADE = ' '

  • CLIENT_FOR_UPGRADE = ' '

  • VARIANT_FOR_SELECTION = ' '

  • COMPLEX_SELCONDS_USED = ' '

TABLES

  • DBA_SELLIST =

EXCL_CUA_FUNCT = i_VIMEXCLFUN.

  • EXCEPTIONS

  • CLIENT_REFERENCE = 1

  • FOREIGN_LOCK = 2

  • INVALID_ACTION = 3

  • NO_CLIENTINDEPENDENT_AUTH = 4

  • NO_DATABASE_FUNCTION = 5

  • NO_EDITOR_FUNCTION = 6

  • NO_SHOW_AUTH = 7

  • NO_TVDIR_ENTRY = 8

  • NO_UPD_AUTH = 9

  • ONLY_SHOW_ALLOWED = 10

  • SYSTEM_FAILURE = 11

  • UNKNOWN_FIELD_IN_DBA_SELLIST = 12

  • VIEW_NOT_FOUND = 13

  • OTHERS = 14

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

0 Kudos

Murali Thanks for ur reply.I did the same through SE54 to link authorization group. But Iam getting the message as " table is cross client" when i click on change icon .Can you please tell me how to solve this.I really don't know where to look for this.If u need more detail mail me.

0 Kudos

looks like the table which u have created does not have the <b>MANDT</b> field in the table that is the reason for you getting the message is cross client. If you want the data to be cross client this is fine. But if you do not want this to message to come up add <b>MANDT</b> field as the first key field in the table redo the steps 1 and 2 again.

0 Kudos

Murali You are correct my team member didn't create mandt field in the table.Thanks alot Murali by helping me in the right time.Iam closing this issue by rewarding points to u.