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 in module pool program

Former Member
0 Likes
2,378

Hi,

i have one material master table. In module pool program i have created one screen. in that one table control is there. Fields in table controls are material number, material name ,

quantity etc. My question is if i am selecting the material number its details should come in the same line of table control. How can i write the code for that.

please help me.

Shyja

3 REPLIES 3
Read only

former_member188829
Active Contributor
0 Likes
652

Hi,

Check these standard programs..

RSDEMO_TABLE_CONTROL

DEMO_DYNPRO_TABLE_CONTROL_1

DEMO_DYNPRO_TABLE_CONTROL_2

RSDEMO_TABLE_CONTROL

RSDEMO02

http://help.sap.com/saphelp_45b/helpdata/en/d1/801bdf454211d189710000e8322d00/content.htm

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

Message was edited by:

Vishnu Reddy

Read only

Former Member
0 Likes
652

hi!!!!!!!!!!!!!

Processing with an internal table

PROCESS BEFORE OUTPUT.

LOOP AT itab WITH CONTROL ctrl CURSOR ctrl-CURRENT_LINE.

ENDLOOP.

PROCESS AFTER INPUT.

LOOP AT itab WITH CONTROL ctrl.

MODULE ctrl_pai.

ENDLOOP.

Here, the system fills the output fields before displaying the screen by reading the internal table itab .

When the user has entered data, the module ctrl_pai INPUT must be executed to check the input and to refresh the contents of the internal table.

Vertical scrolling with the scroll bar is followed by the event PAI for the displayed page. Then, cntl-TOP_LINE is increased and PBO is processed for the next page.

Program-driven scrolling and the most of the functionality described above is achieved by manipulating the control attributes.

Attributes

The CONTROLS statement creates a complex data object of the type CXTAB_CONTROL with the name of the control.

You maintain the initial values in the Screen Painter and assign the screen with the initial values for a control using the addition USING SCREEN .

Initialization is achieved automatically in the "1st access to the control" (setting or reading values).

You can use the customizing button (in the top right corner) to save the current setting (column widths and column positions) and use it as the initial value for the next call.

All the initial values can be overwritten by the program using the MOVE ... TO TC attributes statement.

Example

ctrl-fixed_cols = 2. "2 columns fixed

The contents of the SCREEN structure (table Cols ) acts as a default value for each line of this column, but within LOOP ... ENDLOOP (flow logic), it can be overwritten by LOOP AT SCREEN / MODIFY SCREEN .

With the attributes listed below, you should be aware of the following:

LINES This must always be set as the only attribute if you are not using LOOP AT itab .

TOP_LINE Also set by the SAPgui through the vertical scroll bar slider.

CURRENT_LINE Read only, set by the system ( TOP_LINE + SY-STEPL - 1 )

LEFT_COL Also set by the SAPgui through the horizontal scroll bar slider.

COLS-INDEX Also set by the SAPgui after moving columns.

COLS-SELECTED Also set by the SAPgui after column selection.

When displaying the control, the system uses the current contents when the event DCO occurs (i.e. after all PBO modules have run). The modified values (brought about by the user making changes on the screen) are set immediately after DCI (i.e. before the first PAI module runs..

reward if useful..

Read only

Former Member
0 Likes
652

hi,

i have an example in which i am doing exactly like this...

I have table control and getting bill date and amount from entered <b>bill number</b>.

first of all make that fields output only, which should automatically calculate. ( in my case bill amount and date)

<b>PROCESS AFTER INPUT.</b>

MODULE exit_1000 AT EXIT-COMMAND.

*&SPWIZARD: PAI FLOW LOGIC FOR TABLECONTROL 'TAB1'

LOOP AT itab_det.

CHAIN.

  • FIELD itab_det-comp_code.

FIELD itab_det-bill_no.

FIELD itab_det-bill_date.

FIELD itab_det-vend_cust_code.

FIELD itab_det-bill_amt.

<b>MODULE tab1_modify ON CHAIN-REQUEST.</b>

ENDCHAIN.

FIELD itab_det-mark

MODULE tab1_mark ON REQUEST.

ENDLOOP.

then in PAI, make one module, <b>tab1_modify</b>.

<b>MODULE tab1_modify INPUT.</b>

IF itab_det-bill_no <> ' '. ( <b>Bill number</b> should not initial)

CLEAR:net_pr,tax,bil_amt,bil_dt.

SELECT SINGLE fkdat netwr mwsbk FROM vbrk INTO (bil_dt,net_pr,tax)

WHERE vbeln = itab_det-bill_no AND kunag = cust .

bil_amt = net_pr + tax.

itab_det-bill_date = bil_dt.

itab_det-bill_amt = bil_amt.

ENDIF.

MODIFY itab_det

FROM itab_det

INDEX tab1-current_line.

APPEND itab_det.

<b>ENDMODULE. "TAB1_MODIFY INPUT</b>

reward if usefull