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: 

Insert records in table control into ztable

Former Member
0 Kudos

Hi all,

I have created a table conrol with 6 columns in module pool.My requirement is, if i insert values in the table control in

output screen then it should be stored in my ztable.

Regards,

Ranjith C.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

The Module pool program should be like this way :

program znilmodpl2.

tables : zniltable.

data : it_table type table of zniltable with header line.

controls : tabcntrl type tableview using screen 100.

data : ok_code type sy-ucomm.

&----


*& Module STATUS_0100 OUTPUT

&----


  • text

----


module status_0100 output.

set pf-status '0100'.

set titlebar '100'.

move-corresponding it_table to zniltable.

endmodule. " STATUS_0100 OUTPUT

&----


*& Module USER_COMMAND_0100 INPUT

&----


  • text

----


module user_command_0100 input.

case ok_code.

when 'INS'.

it_table-carrier = zniltable-carrier .

it_table-personnelno = zniltable-personnelno.

it_table-flightname = zniltable-flightname.

it_table-flightdate = zniltable-flightdate.

it_table-f_name = zniltable-f_name.

it_table-l_name = zniltable-l_name.

it_table-rol_emp = zniltable-rol_emp.

it_table-telephone = zniltable-telephone.

it_table-city_dept = zniltable-city_dept.

it_table-city_arrv = zniltable-city_arrv.

append it_table.

insert into zniltable values it_table.

message 'SUCCESSFUL INSERTION OF DATA' type 'S' .

when 'ENTE'.

select * from zniltable into corresponding fields of it_table where carrier = zniltable-carrier and personnelno = zniltable-personnelno.

append it_table.

endselect.

if it_table is initial.

message 'CORRECT MATCHING INPUT FOR CARRIER-ID AND PERSONNEL-ID IS NOT GIVEN' type 'E'.

endif.

when 'EXIT'.

leave program.

endcase.

endmodule. " USER_COMMAND_0100 INPUT

********************************************************

And the flow logic will be :

process before output.

loop at it_table with control tabcntrl.

module status_0100.

endloop.

process after input.

loop at it_table .

module user_command_0100.

endloop.

4 REPLIES 4

Former Member
0 Kudos

Hi,

You have to read the values for your table control and update your ztable..

Atul

Former Member
0 Kudos

hai,

in pai

within loop at ...create module insert.

loop at...

module insert.

endloop.

module insert .

append itab.

endmodule.

create a pushbutton (save) .

when 'save'.

modify ztable from itab.

shan.

Former Member
0 Kudos

The Module pool program should be like this way :

program znilmodpl2.

tables : zniltable.

data : it_table type table of zniltable with header line.

controls : tabcntrl type tableview using screen 100.

data : ok_code type sy-ucomm.

&----


*& Module STATUS_0100 OUTPUT

&----


  • text

----


module status_0100 output.

set pf-status '0100'.

set titlebar '100'.

move-corresponding it_table to zniltable.

endmodule. " STATUS_0100 OUTPUT

&----


*& Module USER_COMMAND_0100 INPUT

&----


  • text

----


module user_command_0100 input.

case ok_code.

when 'INS'.

it_table-carrier = zniltable-carrier .

it_table-personnelno = zniltable-personnelno.

it_table-flightname = zniltable-flightname.

it_table-flightdate = zniltable-flightdate.

it_table-f_name = zniltable-f_name.

it_table-l_name = zniltable-l_name.

it_table-rol_emp = zniltable-rol_emp.

it_table-telephone = zniltable-telephone.

it_table-city_dept = zniltable-city_dept.

it_table-city_arrv = zniltable-city_arrv.

append it_table.

insert into zniltable values it_table.

message 'SUCCESSFUL INSERTION OF DATA' type 'S' .

when 'ENTE'.

select * from zniltable into corresponding fields of it_table where carrier = zniltable-carrier and personnelno = zniltable-personnelno.

append it_table.

endselect.

if it_table is initial.

message 'CORRECT MATCHING INPUT FOR CARRIER-ID AND PERSONNEL-ID IS NOT GIVEN' type 'E'.

endif.

when 'EXIT'.

leave program.

endcase.

endmodule. " USER_COMMAND_0100 INPUT

********************************************************

And the flow logic will be :

process before output.

loop at it_table with control tabcntrl.

module status_0100.

endloop.

process after input.

loop at it_table .

module user_command_0100.

endloop.

Former Member
0 Kudos

Hi,

U can get the datas when u give in the output screen using one internal table.

Make the validations and insert it into the ztable. This is possible and u can do it easily.