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: 

Table Maintanance in table control form

Former Member
0 Kudos

Hello All,

I have a table control on a custom screen with all the fields from table T024. All the fields have to be displayed in editable mode, except Purch. Grp (EKGRP). On scren layout I have EKGRP in display mode. So I am okay till here. But, when I click on INSERT button, a new row has to be added with all the fields in editable mode (including EKGRP).

I tried modying the screen in PBO, but the field EKGRP coming up with either in display mode for all the records or in editable mode for all the records. I tried looping at cols in table control and modifying the table control, like the code below, but no luck.

LOOP AT TC-COLS INTO COL.

IF COL-SCREEN-NAME = 'TC-EKGRP'.

IF OK_CODE = TC_INSR.

SCREEN-INPUT = 0.

MODIFY TC-COLS FROM COL.

ELSE.

SCREEN-INPUT = 1.

MODIFY TC-COLS FROM COLS

ENDLOOP.

Can anybody post the exact code to this solution. Hoping for some quick response. Thank you all.

Thanks in advance,

Chandni Reddy

7 REPLIES 7

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

There should be something simular in your PBO to this.



PROCESS BEFORE OUTPUT.

* PBO FLOW LOGIC FOR TABLECONTROL 'I_WOODCAPCON'
* MODULE I_WOODCAPCON_CHANGE_TC_ATTR.
* MODULE I_WOODCAPCON_CHANGE_COL_ATTR.
  LOOP AT   I_WOODCAP
       WITH CONTROL I_WOODCAPCON
       CURSOR I_WOODCAPCON-CURRENT_LINE.

<b>    MODULE I_WOODCAPCON_CHANGE_FIELD_ATTR.</b>
  ENDLOOP.


  MODULE STATUS_0300.

Here is where you will change the attributes of each line.

Here is the modules code.



module i_woodcapcon_change_field_attr output.

  modify i_woodcap index i_woodcapcon-current_line.

<b>  loop at screen.
    if i_woodcap-level = 'B'
     and ( screen-name = 'I_WOODCAP-PDATE'
      or   screen-name = 'I_WOODCAP-PLANT' ).
      screen-invisible = '1'.
    endif.
    modify screen.
  endloop.</b>

endmodule.


You can see above that I'm simply looping the screen and making invisible only when certain fields of the table control internal table.

Here i_woodcapcon is the table control, and i_woodcap is the internal table associated with the table control.

Regards,

Rich Heilman

0 Kudos

Hi Rich,

It's doing the same thing again. 'EKGRP' field is being displyed in display mode for the first time. But, after clicking INSERT button, a new row is created with EKGRP field in editable mode, but EKGRP in other records in table control are also being displayed in editable mode. I dont want EKGRP in editable mode if the record already exists, but only when inserting a new record.

Here is what I have:

it_t024 is the internal tabel and tc_pur_grps is the table control associated with the internal table.

LOOP AT it_t024

WITH CONTROL tc_pur_grps

CURSOR tc_pur_grps-current_line.

<b> MODULE tc_pur_grps_change_field_attr.</b>

ENDLOOP.

<b>MODULE tc_pur_grps_change_field_attr OUTPUT.</b>

MODIFY it_t024 INDEX tc_pur_grps-current_line.

LOOP AT SCREEN.

IF screen-name = 'IT_T024-EKGRP'.

IF ok_code NE 'TC_PUR_GRPS_INSR'.

screen-input = '0'.

ELSE.

screen-input = '1'.

ENDIF.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

<b>ENDMODULE. " TC_PUR_GRPS_CHANGE_FIELD_ATTR OUTPUT</b>

Could you please suggest me how do I solve my issue?

Thanks,

Chandni Reddy

0 Kudos

Then you must find out what row is the one that is being appended and check that row index in your tc_pur_grps_change_field_attr module.

REgards,

Rich Heilman

0 Kudos

I still cannot figure out how to modify a column in a table control for a <b>single row</b> from display mode to change mode when adding a new row.

I am displaying table T024 data in a table control form with EKGRP in display mode. When I click on insert button, a new row should be appended with all the columns (including EKGRP) in change mode <b>only for that row.</b>

With what I have now when i modidy screen, EKGRP is either in display mode or in change mode for all the records (rows). Users cannot modify EKGRP for existing data. They can only when adding a new record.

I hope you understand the question. Can anybody please post some code. It is very urgent for me.

Thanks,

Chandni

0 Kudos

Chandani,

You have to do that in the PBO of the screen inside the loop. endloop. of the table control.

For example all the data are going to be in display mode and only one row in which no data are entered should be input enabled. So u can check when the column is initial. Make that row enabled using input = '1'.

In the PBO of the screen,

*pbo flow logic for tablecontrol 'MPRN'

LOOP AT i_mprn

WITH CONTROL mprn

CURSOR mprn-current_line.

MODULE tbctrl_lines_modify.

ENDLOOP.

MODULE tbctrl_lines_modify OUTPUT.

if i_mprn-field is initial.

LOOP AT SCREEN.

IF screen-group1 = 'DEV'.

screen-input = '1'.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ENDIF.

ENDMODULE. " TBCTRL_LINES_MODIFY OUTPUT

Regards,

Prakash.

0 Kudos

I got it.

here's what i am doing:

LOOP AT it_t024

WITH CONTROL tc_pur_grps

CURSOR tc_pur_grps-current_line.

MODULE tc_pur_grps_change_field_attr.

ENDLOOP.

<b>MODULE tc_pur_grps_change_field_attr OUTPUT.</b>

LOOP AT SCREEN.

IF screen-name = 'IT_T024-EKGRP' AND it_t024-ekgrp IS INITIAL.

screen-input = '1'.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

<b>ENDMODULE. " TC_PUR_GRPS_CHANGE_FIELD_ATTR OUTPUT</b>

Former Member
0 Kudos

Hai

1. specially function group.. what is its significance

When we generate table maintenance,

the system , based upon the table fields,

automatically,

generates

PROGRAM CODE, SCREEN FOR ENTERING DATA,

LOGIC FOR SAVING DATA, LOGIC FOR DISPLAYING DATA

ETC.

2. All this are BUNCHED under

a FUNCTION GROUP

(if you open that function group in se80, after

creatting table maintenacne,

u will see the program code, screens, gui status etc)

3. Hence, to BUNCH all these various objects,

SAP uses the concept of function group.

*----


4. And also why do we need to give two screens there

Its not necessary to have to screens.

5. ONE SCREEN MEANS:

only one screen with table control to enter data

TWO SCREEN means :

first screen : only primary key fields will appear

second screen : rest of the fields will appear to enter data

6. When the table consists of many fields,

its practically more convenient to have two screens,

so that all fields come vertically downwards.

(instead of scrolling horizontally in the table

control, in case of one screen concept)

The use of the FG is only this the Table Maintainance Generator part. Neednt be declared anywhere else.

yes u need to create a FG and the use it in Table maint. gen.

http://help.sap.com/saphelp_erp2005/helpdata/en/a7/513520407a11d1893b0000e8323c4f/frameset.htm - a link for basics on Table Maintenance.

Also, Check out this weblog on table maintenance:

/people/sudheer.cheedella/blog/2006/02/20/extracting-data-in-table-maintenance

Regards

Sreeni