‎2007 Jul 13 7:29 AM
hi,
my requirement is
screen 1: having material no and two push buttons display and change.
when display validate the material no and go to screen 2 and
display the values from a ztable1 and hide the new entry
and delete buttons on screen 2.
when change validate the material no and go to screen 2 and
display the values on the screen.
screen 2: the materail no and material description should display above the
table control.
Table control having 4 fields from a ztable2.
push buttons are new entry , delete, change.
when new entry empty lines are added to the screen, when user
fills the screen it validates the entries against ztable2 if exist
provide a message the entries are existing
if save button clicked chek the entries exist in ztable1 if exist
provide a msg entry is existing else save the details in ztable1.
when delete if no entry is selected give a msg select an entry.
if an entry selected check whether it is exist in ztable2, if not provide
a msg, if yes provide a conformation screen " are you sure you want
to delete this entry" if yes proceed with deletion.
when change button is clicked it will enable all disable rows having
data, and while saving it should delete existing row (changed) from
database table and insert the new row.
can anybody help me regarding this scenario? i am very much thankful to tem.
‎2007 Jul 13 12:28 PM
The ztable1 having 6 fields and z table2 having 3 fields
and there is foreign key relation ship existes between ztable1 & ztable2
‎2007 Jul 17 11:36 AM
‎2007 Jul 17 11:39 AM
First have to know the concept of Table control
The main purpose of table control is to display multiple records in a table like format.
so when to wants to display the multiple records, the internal table from which the table control has to be populated has to be kept in loop both in PAI and PBO.
see the doc
Check the below link:
http://wiki.ittoolbox.com/index.php/FAQ:What_is_module_pool_program_in_abap%3F
http://help.sap.com/saphelp_46c/helpdata/en/35/26b1aaafab52b9e10000009b38f974/content.htm
http://sap.mis.cmich.edu/sap-abap/abap09/sld011.htm
http://sap.mis.cmich.edu/sap-abap/abap09/index.htm
You can also check the transaction ABAPDOCU which gives you lot of sample programs.
Also you can see the below examples...
Go to se38 and give demodynpro and press F4.
YOu will get a list of demo module pool programs.
One more T-Code is ABAPDOCU.
YOu can find more examples there.
See the prgrams:
DEMO_DYNPRO_TABLE_CONTROL_1 Table Control with LOOP Statement
DEMO_DYNPRO_TABLE_CONTROL_2 Table Control with LOOP AT ITAB
http://www.geocities.com/ZSAPcHAT
http://www.allsaplinks.com/files/using_table_in_screen.pdf
-
you can try this also:----
Check these demo programs
demo_dynpro_tabcont_loop
demo_dynpro_tabcont_loop_at.
To handle table controls in ABAP programs, you must declare a control in the declaration part of the program for each table control using the following statement:
CONTROLS <ctrl> TYPE TABLEVIEW USING SCREEN <scr>.
where <ctrl> is the name of the table control on a screen in the ABAP program. The control allows the ABAP program to read the attributes of the table control and to influence the control. The statement also declares a deep structure of name <ctl>. The data type of the structure corresponds to the type CXTAB_CONTROL defined in the type group CXTAB in the ABAP Dictionary.
At runtime the components of the structure contain the attributes of the table control. Several of the initial values are determined in the Screen Painter. The initial value for the control <ctl> is taken from the screen which is determined using the addition USING.
If you write the statement
REFRESH CONTROL <ctrl> FROM SCREEN <scr>.
you can initialize a table control at any time with the initial value of a screen <scr>. Values that are not taken from the settings in the Screen Painter, are set to the current status of the table control at PAI.
Structure CXTAB_CONTROL
The deep structure CXTAB_CONTROL contains the general attributes of the table control on the highest level. The component CXTAB_CONTROL is a table of the structure CXTAB_COLUMN and contains the attributes of a column. The component CXTAB_CONTROL-COLS-SCREEN is a flat structure of the same type as system table SCREEN and contains the attributes of the individual screen elements.
<b>reward points if useful</b>
regards,
‎2007 Jul 17 11:40 AM
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 report, double click on 101, i.e., 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.
This is a sample code. Your requirement is similar to this.
Hope this helps you.
Regards,
Pavan