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: 

help needed in the code

Former Member
0 Kudos
94

Hi all,

I need help in acquiring this

I have a table control,in which i have 3 columns out of which 2 are input/outfields and one is output field.

say i have fld1 fld2 fld3

i entera value for fld1 and fld2 then it bring value in fld3.

but sometimes i.e certain values of fld1 the fld2 should be NA and the fld3 should open up for input.

say fld1 = def is exception

first i enter

fld1 = abc and fld2 =aaa then it brings fld3 =bbb

next i enter

fld1 = def and hit enter then fld2 = NA and fld3 should be available for input.

I have the following code written for this

CONTROLS: TABLECONTROL TYPE TABLEVIEW USING SCREEN 9002.

DATA W_TABLECONTROL LIKE LINE OF TABLECONTROL-COLS.

ITAB IS MY TABLE CONTROL INTERNAL TABLE I.E MY TABLE CONTROL FIELDS ARE ITAB-FLD1,ITAB-FLD2,ITAB-FLD3.

loop at TABLECONTROL-cols into w_TABLECONTROL.

IF w_cTABLECONTROL-screen-group4 = 'NAM'.

loop at iTAB.

IF ITAB-FLD1 EQ 'DEF'.

w_TABLECONTROL-SCREEN-INPUT = '1'.

else.

w_TABLECONTROL-SCREEN-INPUT = '0'.

ENDIF.

modify TABLECONTROL-cols from w_TABLECONTROL.

ENDLOOP.

ENDIF.

ENDLOOP.

WHAT I SEE NOW WITH THIS CODE IS WHEN I ENTER THE FIRST RECORD IN

ITAB-FLD1 AS DEF AND HIT ENTER THE FLD2 IS NA AND FLD3 IS READY FOR OUTPUT

NOW THE SECOND ROW FLD3 IS AVAILABLE FOR INPUT WHICH I DON'T WANT BECAUSE MY FLD1 OF SECOND IS NOT YET KNOW AGAIN IFITS DEF THEN IT SHOULD BE AVAILABLE FOR INPUT OTHERWISE IT SHOULD GREY OUT.

HELP ME IN ACHEIVING THIS.

THANKS

2 REPLIES 2

Former Member
0 Kudos
60

Hi Swathi,

The code seems correct. Can u check in which event code is available?

This should be in PBO(loop endloop of table control).

Reagrds,

Sanjeev

Former Member
0 Kudos
60

Hi,

Have this code inside the LOOP AT ...ENDLOOP of the PBO..

PROCESS BEFORE OUTPUT.

LOOP AT ITAB INTO WA..

<b>MODULE UPDATE_DATA..</b>

ENDLOOP.

MODULE UPDATE_DATA.

LOOP AT SCREEN.

IF WA-FIELD1 = 'DEF'.

  • Add the group for the field3 in the attributes..

IF SCREEN-GROUP1 = 'G1'.

  • Enable for input...

SCREEN-INPUT = '1'.

MODIFY SCREEN.

ENDIF.

ELSE.

IF SCREEN-GROUP1 = 'G1'.

  • disable for input for other values.

SCREEN-INPUT = '0'.

MODIFY SCREEN.

ENDIF.

ENDIF.

ENDLOOP.

ENDLOOP.

Thanks,

Naren