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

table control

Former Member
0 Likes
1,053

hi abapers

I have one table control which displays some data

(data read using internal table).

( I have used table control wizard to display internal table items)

I have another z table called zplan inwhich i want store some specific fields which are fetched from the table control.

what is the programming techniques and procedure to store in zplan.

Totally am using onle one ztable called zplan.

Thanks in advance.

Regards

Rajaram

6 REPLIES 6
Read only

Former Member
0 Likes
625

hi

just refer to the link below

http://www.sapmaterial.com/tablecontrol_sap.html

<b>step by step procedure with screen shots</b>

regards

ravish

<b>plz dont forget to reward points if helpful</b>

Read only

Former Member
0 Likes
625

Hi

Check the below links.

http://www.planetsap.com/howdo_a.htm

http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/dbac5135c111d1829f0000e829fbfe/content.htm

http://sap.niraj.tripod.com/id25.html

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 <b>ABAPDOCU</b>.

YOu can find more examples there.

See the prgrams:

<b>DEMO_DYNPRO_TABLE_CONTROL_1</b> Table Control with LOOP Statement

<b>DEMO_DYNPRO_TABLE_CONTROL_2</b> Table Control with LOOP AT ITAB

http://www.geocities.com/ZSAPcHAT

http://www.allsaplinks.com/files/using_table_in_screen.pdf

<b>Reward points for useful Answers</b>

Regards

Anji

Read only

0 Likes
625

I am very new to dialog programming.

can anyone explain me the procedure and the logic,

It would be helpful to me.

Read only

Former Member
0 Likes
625

Hi

TABLE CONTROL

These are the screen elements used to display tabular data they can be called

as screen tables( like STEP LOOP).To use table control we have to create it on the screen using SCREEN PAINTER(SE51) and declare a control variable of TYPE TABLEVIEW using CONTROLS statement in the ABAP program. We have to use LOOP .. ENDLOOP statement in both PBO and PAI with or without AT int_table parameter. IF AT int_table parameter is not used than we have to place a MODULE call between the LOOP...ENDLOOP statement to fill the screen table rows from the ABAP program in PBO and program our own scrolling functions

using OK_CODE field.

Having a parallel loop(at screen table rows & int table rows) by using parameter

AT int_table makes the ABAP code simple.

A special structure of type CXTAB_CONTROL is used to set/get various

attributes of table control at runtime like CURRENT_LINE ,TOP_LINE.

ABAP declaration

CONTROLS: tab_con TYPE TABLEVIEW USING SCREEN nnnn

Here tab_con is the same name we used in screen for the table control.

This ABAP statement will declare a control variable that will be used to access

the table control , and set it's various attributes like number of fixed columns(tab_con-FIXED_COLS) ,total number of records it will display(tab_con-LINES).It is of type CXTAB_CONTROL and is a deep structure(structure containing structures).

REFRESH CONTROL tab_con FROM SCREEN nnnn

This ABAP statement will initialize the table control on the screen nnnn to its initial values.

PBO processing

In PBO we have to use the screen LOOP ...ENDLOOP statement , with or without

intenal table.

LOOP WITH CONTROL tab_con.

MODULE fill_tab_con.

ENDLOOP.

Here a module should be called between the loop endloop statement to transfer

data from th ABAP program to the screen table through a structure.This module

should use the CURRENT_LINE attribute of the table control variable to get the

current screen table record index to read the data from the internal table into a work area.

e.g.

READ TABLE int_table INDEX tab_con-CURRENT_LINE

The record read will be placed in the header line of the internal table and will be available to the similarly named screen fields or if these are different it can be written explicitly. e.g.

screen_field_name = int_table-field_name

...

.

LOOP AT int_table INTO workarea WITH CONTROL tab_con CURSOR i FROM

n1 TO n2.

ENDLOOP.

Here the module call is not required to fill the screen table.The CURSOR parameter is a integer of type I indicating which absolute internal table line

should be the first to display on the table control .FROM n1 TO n2 can be used

to restrict the starting line and ending line number of the internal table , they are of type SY-TABIX.

In both cases before the LOOP statement a module should be called which

is generally for setting of status ,in which we should fill the LINES attribute

(tab_con-LINES ) of the control with the total number of internal table records,doing this ensures correct and automatic scrolling.

The ABAP statement DESCRIBE TABLE int_table LINES lines can be used

to get the total lines in an int table.

PAI Processing

We have to use LOOP ... ENDLOOP in PAI so that data can transfer fro table control to ABAP program. If we want to write changes to the data we should

call a module between the LOOP ... ENDLOOP. The MODULE call to process user commands (SY-UCOM) should be called after the ENDLOOP statement.

e.g.

PROCESS AFTER INPUT

MODULE mod AT EXIT-COMMAND.

LOOP AT itab_table or LOOP "depending on whether we are using AT int_table

MODULE modify_int_table.

ENDLOOP.

MODULE user_command.

In the MODULE call modify_int_table we can use

MODIFY int_table FROM workarea INDEX tab_con-CURRENT_LINE

or we can use

int_table-field_name = screen_field_name.

also check this link

http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/contro02.htm

Hope this helps

if it helped, you can acknowledge the same by rewarding

regards

dinesh

Read only

Former Member
0 Likes
625

Hi raja ram,

Look at below code.

In the screen of table control.

PROCESS BEFORE OUTPUT.

*loop your internal table with table control tbc1

LOOP AT it_details INTO gf_details WITH CONTROL tbc1

CURSOR tbc1-current_line.

MODULE display_rows. "Populates your data in table control

ENDLOOP.

PROCESS AFTER INPUT.

LOOP AT it_details .

MODULE read_table_control. "Reads table control.

ENDLOOP.

<b>Module read_table_control.</b>

If sy-ucomm eq 'READ'.

*If it_details having same strucutre

Move it_details to zplan.

Insert zplan.

if sy-subrc is initial.

clear zplan.

endif.

*else

Move it_details-field1 to zplan-field1.

Move it_details-field2 to zplan-field2.

Move it_details-field3 to zplan-field3.

Insert zplan.

if sy-subrc is initial.

clear zplan.

endif.

Endif.

<b>Endmodule.</b>

pls reward points if helpful.

Regards,

K. Kishore

Read only

0 Likes
625

Hi Raja


Check this link



http://sap.mis.cmich.edu/sap-abap/abap09/index.htm

Dialog-driven programs, or any program started using a transaction code, are known as SAP transactions, or just transactions. The term "transaction" is used in several different contexts in the IT world. In OLTP (Online Transaction Processing), where several users are working in one system in dialog mode, the term "transaction" stands for a user request. In conjunction with database updates, it means a change in state in the database.

Programs with type M can only be started using a transaction code, in which an initial screen is defined. Programs with type 1 can be started either using a transaction code, or by entering the program name in one of the transactions SE38 or SA38. Screens call dialog modules in the associated ABAP program from their flow logic. Type M programs serve principally as containers for dialog modules, and are therefore known as module pools. Type 1 programs, or function modules can also switch to dialog mode by calling screens using the CALL SCREEN statement. The program code of the corresponding executable program or function pool must then contain the corresponding dialog modules.

Programs that are partially or wholly dialog-driven cannot be executed in the background. They are therefore sometimes referred to as dialog programs.

Components of a Dialog Program



A dialog-driven program consists of the following basic components:

Transaction code


The transaction code starts a screen sequence. You create transaction codes in the Repository Browser in the ABAP Workbench or using Transaction SE93. A transaction code is linked to an ABAP program and an initial screen. As well as using a transaction code, you can start a screen sequence from any ABAP program using the CALL SCREEN statement.

Screens


Each dialog in an SAP system is controlled by one or more screens. These screens consist of a screen mask and its flow logic. Since the flow logic influences the program flow, screens are sometimes referred to as "dynamic programs". You create screens using the Screen Painter in the ABAP Workbench. Each screen belongs to an ABAP program.

The screen has a layout that determines the positions of input/output fields and other graphical elements such as checkboxes and radio buttons. The flow logic consists of two parts:

Process Before Output (PBO). This defines the processing that takes place before the screen is displayed.
Process After Input (PAI). This defines the processing that takes place after the user has chosen a function on the screen.
All of the screens that you call within an ABAP program must belong to that program. The screens belonging to a program are numbered. For each screen, the system stores the number of the screen which is normally displayed next. This screen sequence can be either linear or cyclic. From within a screen chain, you can even call another screen chain and, after processing it, return to the original chain. You can also override the statically-defined next screen from within the dialog modules of the ABAP program.

GUI status


Each screen has a GUI status. This controls the menu bars, standard toolbar, and application toolbar, with which the user can choose functions in the application. Like screens, GUI statuses are independent components of an ABAP program. You create them in the ABAP Workbench using the Menu Painter.

ABAP Program


Each screen and GUI status in the R/3 System belongs to one ABAP program. The ABAP program contains the dialog modules that are called by the screen flow logic, and also process the user input from the GUI status. ABAP programs that use screens are also known as dialog programs. In a module pool (type M program); the first processing block to be called is always a dialog module. However, you can also use screens in other ABAP programs, such as executable programs or function modules. The first processing block is then called differently; for example, by the runtime environment or a procedure call. The screen sequence is then started using the CALL SCREEN statement.

Dialog modules are split into PBO modules and PAI modules. Dialog modules called in the PBO event are used to prepare the screen, for example by setting context-specific field contents or by suppressing fields from the display that are not needed. Dialog modules called in the PAI event are used to check the user input and to trigger appropriate dialog steps, such as the update task.

Passing Data Between ABAP Programs and Screens

How are fields from ABAP programs displayed on the screen? And how is user input on the screen passed back to the ABAP program? Unlike in list programming, you cannot write field data to the screen using the WRITE statement. Instead, the system transfers the data by comparing the names of screen fields with the names of the ABAP fields in the program. If it finds a pair of matching names, the data is transferred between the screen and the ABAP program. This happens immediately before and immediately after displaying the screen.

Field Attributes



For all screen fields of a dialog screen, field attributes are defined in the Screen Painter. If a field name in the screen corresponds to the name of an ABAP Dictionary field, the system automatically establishes a reference between these two fields. Thus, a large number of field attributes for the screen are automatically copied from the ABAP Dictionary. The field attributes together with data element and domain of the assigned Dictionary field form the basis for the standard functions the screen executes in a dialog (automatic format check for screen fields, automatic value range check, online help, and so on).

Error Dialogs



Another task of the screen processor is to conduct error dialogs. Checking the input data is carried out either automatically using check tables of the ABAP Dictionary or by the ABAP program itself. The screen processor includes the error message into the received screen and returns the screen to the user. The message may be context-sensitive, that is, the system replaces placeholders in the message text with current field contents. In addition, only fields whose contents is related to the error and for which a correction may solve the error can accept input. See also Messages on Screens.

Data Consistency

To keep data consistent within complex applications, ABAP offers techniques for optimizing database updates that operate independent of the underlying database and correspond to the special requests of dialog programming. See also Programming Database Updates.


See this
syntax:

CONTROLS <tab_ctrl_name> TYPE TABLEVIEW USING SCREEN <screen_no>.

chk the demo prog:


DEMO_DYNPRO_TABCONT_LOOP

Cursor Position on Table Controls

At PBO you can set the cursor on a specific field of a specific row of a table control.

SET CURSOR FIELD <f> LINE <lin> [OFFSET <off>].

Using the optional addition OFFSET, you can enter the offset of the cursor in the field as described under Setting the Cursor Position .

At PAI you can read the current cursor position.

GET CURSOR FIELD <f> LINE <lin> ...

In addition to the information given under Finding Out the Cursor Position , field

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


table control scrolling:




Check following link for the same.
https://www.sdn.sap.com/sdn/collaboration.sdn?contenttype=url&content=https%3A//forums.sdn.sap.com/t...

table control with wizard
http://help.sap.com/saphelp_nw04/helpdata/en/6d/150d67da1011d3963800a0c94260a5/content.htm
Have a look at below link:

http://help.sap.com/saphelp_nw04/helpdata/en/9f/dbac1d35c111d1829f0000e829fbfe/frameset.htm

http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/dbac1d35c111d1829f0000e829fbfe/frameset.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

REPORT ZBHMOD1 .
DATA:OKCODE1 LIKE SY-UCOMM,
OKCODE2 LIKE SY-UCOMM.
DATA:N1(10) TYPE N,N2(10) TYPE N,RES(12) TYPE N.

MODULE USER_COMMAND_1000 INPUT.

CASE OKCODE1.
WHEN 'NEXT'.
RES = N1 + N2.
SET SCREEN 1001.
WHEN 'CLEA'.
CLEAR:N1,N2.
WHEN 'BACK'.
SET SCREEN '0'.
ENDCASE.

ENDMODULE. " USER_COMMAND_1000 INPUT


MODULE STATUS_1000 OUTPUT.
* SET PF-STATUS 'xxxxxxxx'.
SET TITLEBAR 'TIT1'.

ENDMODULE. " STATUS_1000 OUTPUT


MODULE USER_COMMAND_1001 INPUT.

CASE OKCODE2.
WHEN 'BACK'.
SET SCREEN 1000.
ENDCASE.

ENDMODULE. " USER_COMMAND_1001 INPUT


MODULE STATUS_1001 OUTPUT.
* SET PF-STATUS 'xxxxxxxx'.
SET TITLEBAR 'TIT2'.

ENDMODULE. " STATUS_1001 OUTPUT




FLOW LOGIC:


PROCESS BEFORE OUTPUT.
MODULE STATUS_1000.
*
PROCESS AFTER INPUT.
MODULE USER_COMMAND_1000.



PROCESS BEFORE OUTPUT.
MODULE STATUS_1001.
*
PROCESS AFTER INPUT.
MODULE USER_COMMAND_1001.

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

2)


REPORT ZBHMOD2.
DATA: OKCODE1 TYPE SY-UCOMM,
OKCODE2 TYPE SY-UCOMM,
ENAME(10) TYPE C,
DNAME(10) TYPE C.

MODULE STATUS_1000 OUTPUT.
* SET PF-STATUS 'xxxxxxxx'.
SET TITLEBAR 'TIT1'.

ENDMODULE. " STATUS_1000 OUTPUT


MODULE STATUS_1001 OUTPUT.
* SET PF-STATUS 'xxxxxxxx'.
SET TITLEBAR 'TIT2'.

ENDMODULE. " STATUS_1001 OUTPUT


MODULE USER_COMMAND_1000 INPUT.

CASE OKCODE1.
WHEN 'BACK'.
SET SCREEN '0'.
WHEN 'NEXT'.
DNAME = ENAME.
SET SCREEN '1001'.
ENDCASE.

ENDMODULE. " USER_COMMAND_1000 INPUT


MODULE USER_COMMAND_1001 INPUT.

CASE OKCODE2.
WHEN 'BACK'.
SET SCREEN '1000'.
ENDCASE.

ENDMODULE. " USER_COMMAND_1001 INPUT



FORM ON_CTMENU_FORM USING ZDEMO1 TYPE REF TO CL_CTMENU.

CALL METHOD ZDEMO1->LOAD_GUI_STATUS
EXPORTING
PROGRAM = 'ZDEMO1'
STATUS = 'ZDEMO1'
MENU = ZDEMO1.

ENDFORM. " ON_CTMENU_FORM






FLOW LOGIC:


PROCESS BEFORE OUTPUT.
MODULE STATUS_1000.
*
PROCESS AFTER INPUT.
MODULE USER_COMMAND_1000.




PROCESS BEFORE OUTPUT.
MODULE STATUS_1001.
*
PROCESS AFTER INPUT.
MODULE USER_COMMAND_1001.

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

Every Screen has a pbo and a pai.

Screen elements are the textbox, buttons, radio buttons and check boxes .....

If we want to pass data from a abap program to a screen element, we have to create a variable with the name we have given in the screen.So whatever the value is present in that variable is reflected on to the screen element.

Here is an example :

Using subscreens and some of the screen elements

DATA: ok_code TYPE sy-ucomm,
save_ok TYPE sy-ucomm.

DATA: number1(4) TYPE n VALUE '0110',
number2(4) TYPE n VALUE '0130',
field(10) TYPE c, field1(10) TYPE c, field2(10) TYPE c.

CALL SCREEN 100.

MODULE status_100 OUTPUT.
SET PF-STATUS 'SCREEN_100'.
ENDMODULE.

MODULE fill_0110 OUTPUT.
field = 'Eingabe 1'(001).
ENDMODULE.

MODULE fill_0120 OUTPUT.
field = field1.
ENDMODULE.

MODULE fill_0130 OUTPUT.
field = 'Eingabe 2'(002).
ENDMODULE.

MODULE fill_0140 OUTPUT.
field = field2.
ENDMODULE.

MODULE cancel INPUT.
LEAVE PROGRAM.
ENDMODULE.

MODULE save_ok INPUT.
save_ok = ok_code.
CLEAR ok_code.
ENDMODULE.

MODULE user_command_0110 INPUT.
IF save_ok = 'OK1'.
number1 = '0120'.
field1 = field.
CLEAR field.
ENDIF.
ENDMODULE.

MODULE user_command_0130 INPUT.
IF save_ok = 'OK2'.
number2 = '0140'.
field2 = field.
CLEAR field.
ENDIF.
ENDMODULE.

MODULE user_command_100 INPUT.
CASE save_ok.
WHEN 'SUB1'.
number1 = '0110'.
WHEN 'SUB2'.
number1 = '0120'.
CLEAR field1.
WHEN 'SUB3'.
number2 = '0130'.
WHEN 'SUB4'.
number2 = '0140'.
CLEAR field2.
ENDCASE.
ENDMODULE.


* flow logic for screen 100 
PROCESS BEFORE OUTPUT.
MODULE STATUS_100.
CALL SUBSCREEN: AREA1 INCLUDING SY-REPID NUMBER1,
AREA2 INCLUDING SY-REPID NUMBER2.

PROCESS AFTER INPUT.
MODULE CANCEL AT EXIT-COMMAND.
MODULE SAVE_OK.
CALL SUBSCREEN: AREA1,
AREA2.
MODULE USER_COMMAND_100.

* flow logic for screen 110 
PROCESS BEFORE OUTPUT.
MODULE FILL_0110.

PROCESS AFTER INPUT.
MODULE USER_COMMAND_0110.

* flow logic for screen 120 
PROCESS BEFORE OUTPUT.
MODULE FILL_0120.

PROCESS AFTER INPUT.

* flow logic for screen 130 
PROCESS BEFORE OUTPUT.
MODULE FILL_0130.

PROCESS AFTER INPUT.
MODULE USER_COMMAND_0130. 

* flow logic for screen 140 

PROCESS BEFORE OUTPUT.
MODULE FILL_0140.

PROCESS AFTER INPUT.

Here are some links to which i answered earlier









Reward all helpfull answers

Regards
Pavan