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

how to insert data from table control to a custom table

Former Member
0 Likes
774

Hello everyone,

could any one send me the coding part of how to upload the

data from table control to a custom table

and also how to retrieve the data from custom table to table control..

its very urgent requirement..

will be rewarded..

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
694

DATA: BEGIN OF FS_SPFLI,

MANDT TYPE SPFLI-MANDT,

CARRID TYPE SPFLI-CARRID,

CONNID TYPE SPFLI-CONNID,

COUNTRYFR TYPE SPFLI-COUNTRYFR,

END OF FS_SPFLI.

DATA: BEGIN OF FS_SFLIGHT,

MANDT TYPE SFLIGHT-MANDT,

CARRID TYPE SFLIGHT-CARRID,

CONNID TYPE SFLIGHT-CONNID,

FLDATE TYPE SFLIGHT-FLDATE,

END OF FS_SFLIGHT.

data:

t_spfli like standard table of fs_spfli,

t_sflight like standard table of fs_sflight,

ok_code type sy-ucomm.

controls:

c_tabstrip type tabstrip.

select *

from spfli

into corresponding fields of table t_spfli.

select *

from sflight

into corresponding fields of table t_sflight.

call screen 101.

*call screen 102.

*call screen 103.

&----


*& Module STATUS_0101 OUTPUT

&----


text

-


MODULE STATUS_0101 OUTPUT.

SET PF-STATUS 'TABSTRIP'.

SET TITLEBAR 'TABSTRIP'.

ENDMODULE. " STATUS_0101 OUTPUT

&----


*& Module USER_COMMAND_0101 INPUT

&----


text

-


MODULE USER_COMMAND_0101 INPUT.

case ok_code.

when 'BACK' or 'EXIT'.

leave program.

clear ok_code.

when 'SPFLI'.

leave to list-processing.

loop at t_spfli into fs_spfli.

write:/

fs_spfli.

endloop.

clear ok_code.

when 'SFLIGHT'.

leave to list-processing.

loop at t_sflight into fs_sflight.

write:/

fs_sflight.

endloop.

clear ok_code.

endcase.

ENDMODULE. " USER_COMMAND_0101 INPUT

Before you execute the code, double click on 101,i.e., in CALL SCREEN 101.

And paste the below code in Flow logic.

PROCESS BEFORE OUTPUT.

MODULE STATUS_0101.

call subscreen spfli_ref1 including sy-repid '102'.

call subscreen sflight_ref1 including sy-repid '103'.

*

PROCESS AFTER INPUT.

call subscreen: spfli_ref1, sflight_ref1.

MODULE USER_COMMAND_0101.

DATA: BEGIN OF FS_SPFLI,

MANDT TYPE SPFLI-MANDT,

CARRID TYPE SPFLI-CARRID,

CONNID TYPE SPFLI-CONNID,

COUNTRYFR TYPE SPFLI-COUNTRYFR,

END OF FS_SPFLI.

DATA: BEGIN OF FS_SFLIGHT,

MANDT TYPE SFLIGHT-MANDT,

CARRID TYPE SFLIGHT-CARRID,

CONNID TYPE SFLIGHT-CONNID,

FLDATE TYPE SFLIGHT-FLDATE,

END OF FS_SFLIGHT.

data:

t_spfli like standard table of fs_spfli,

t_sflight like standard table of fs_sflight,

ok_code type sy-ucomm.

controls:

c_tabstrip type tabstrip.

select *

from spfli

into corresponding fields of table t_spfli.

select *

from sflight

into corresponding fields of table t_sflight.

call screen 101.

*call screen 102.

*call screen 103.

&----


*& Module STATUS_0101 OUTPUT

&----


text

-


MODULE STATUS_0101 OUTPUT.

SET PF-STATUS 'TABSTRIP'.

SET TITLEBAR 'TABSTRIP'.

ENDMODULE. " STATUS_0101 OUTPUT

&----


*& Module USER_COMMAND_0101 INPUT

&----


text

-


MODULE USER_COMMAND_0101 INPUT.

case ok_code.

when 'BACK' or 'EXIT'.

leave program.

clear ok_code.

when 'SPFLI'.

leave to list-processing.

loop at t_spfli into fs_spfli.

write:/

fs_spfli.

endloop.

clear ok_code.

when 'SFLIGHT'.

leave to list-processing.

loop at t_sflight into fs_sflight.

write:/

fs_sflight.

endloop.

clear ok_code.

endcase.

ENDMODULE. " USER_COMMAND_0101 INPUT

Before you execute the code, double click on 101,i.e., in CALL SCREEN 101.

And paste the below code in Flow logic.

PROCESS BEFORE OUTPUT.

MODULE STATUS_0101.

call subscreen spfli_ref1 including sy-repid '102'.

call subscreen sflight_ref1 including sy-repid '103'.

*

PROCESS AFTER INPUT.

call subscreen: spfli_ref1, sflight_ref1.

MODULE USER_COMMAND_0101.

3 REPLIES 3
Read only

Former Member
0 Likes
694

hi,

to save the data use this in PAI.

module tabctrl input.

case sy-ucomm.

when 'SAVE'.

if save1 = 1.

modify wi_cust1 index tb-current_line.

if sy-subrc = 0.

modify zcust_master2 from table wi_cust1.

message s005(zmsgbanks1).

else.

message e006(zmsgbanks1).

endif.

endif.

endcase.

to display data:

select * from zcust_master2 into table wi_cust1. "This uploads the table control with data from customer master

tb-lines = sy-dbcnt.

hope this helps u,

Reagrds,

Arunsri

Read only

0 Likes
694

hi anusri,

can u send me the code in some what detail.. iam getting ur answer but not completely ,, please help me out....

Read only

Former Member
0 Likes
695

DATA: BEGIN OF FS_SPFLI,

MANDT TYPE SPFLI-MANDT,

CARRID TYPE SPFLI-CARRID,

CONNID TYPE SPFLI-CONNID,

COUNTRYFR TYPE SPFLI-COUNTRYFR,

END OF FS_SPFLI.

DATA: BEGIN OF FS_SFLIGHT,

MANDT TYPE SFLIGHT-MANDT,

CARRID TYPE SFLIGHT-CARRID,

CONNID TYPE SFLIGHT-CONNID,

FLDATE TYPE SFLIGHT-FLDATE,

END OF FS_SFLIGHT.

data:

t_spfli like standard table of fs_spfli,

t_sflight like standard table of fs_sflight,

ok_code type sy-ucomm.

controls:

c_tabstrip type tabstrip.

select *

from spfli

into corresponding fields of table t_spfli.

select *

from sflight

into corresponding fields of table t_sflight.

call screen 101.

*call screen 102.

*call screen 103.

&----


*& Module STATUS_0101 OUTPUT

&----


text

-


MODULE STATUS_0101 OUTPUT.

SET PF-STATUS 'TABSTRIP'.

SET TITLEBAR 'TABSTRIP'.

ENDMODULE. " STATUS_0101 OUTPUT

&----


*& Module USER_COMMAND_0101 INPUT

&----


text

-


MODULE USER_COMMAND_0101 INPUT.

case ok_code.

when 'BACK' or 'EXIT'.

leave program.

clear ok_code.

when 'SPFLI'.

leave to list-processing.

loop at t_spfli into fs_spfli.

write:/

fs_spfli.

endloop.

clear ok_code.

when 'SFLIGHT'.

leave to list-processing.

loop at t_sflight into fs_sflight.

write:/

fs_sflight.

endloop.

clear ok_code.

endcase.

ENDMODULE. " USER_COMMAND_0101 INPUT

Before you execute the code, double click on 101,i.e., in CALL SCREEN 101.

And paste the below code in Flow logic.

PROCESS BEFORE OUTPUT.

MODULE STATUS_0101.

call subscreen spfli_ref1 including sy-repid '102'.

call subscreen sflight_ref1 including sy-repid '103'.

*

PROCESS AFTER INPUT.

call subscreen: spfli_ref1, sflight_ref1.

MODULE USER_COMMAND_0101.