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: 

Disable a field in a table after updating some data in to the table

anand_n5
Explorer
0 Kudos
1,156

Hi everyone,

Am trying to update table in a module pool programming.

where i need to update a filed when user creates a field entry and also i  need  to disable the same field when second record is updated

I have created a field to which when the user creates(save) the record it should be updated in my table at the same time when the user creates new(second) record the first filed in the table should be disabled

could anybody help me on this am trying hard to get this done please....

1 ACCEPTED SOLUTION

Arun_Prabhu_K
Active Contributor
0 Kudos
811

Hi Anand.

1) Set a flag to identify the record that is saved.

2) Then based on the flag, write the business logic in a PBO module to disable the row.

MODULE DISABLE_ROW OUTPUT.

   if itab-flag = 'X'.

     loop at screen.

       screen-active = 0.

       modify screen.

     endloop.

   endif.

ENDMODULE.                 " DISABLE_ROW  OUTPUT

Regards.

12 REPLIES 12

Former Member
0 Kudos
811

You are using alv or table control?

0 Kudos
811

thank for your response

am using table control

thanks & regards

anand

Arun_Prabhu_K
Active Contributor
0 Kudos
812

Hi Anand.

1) Set a flag to identify the record that is saved.

2) Then based on the flag, write the business logic in a PBO module to disable the row.

MODULE DISABLE_ROW OUTPUT.

   if itab-flag = 'X'.

     loop at screen.

       screen-active = 0.

       modify screen.

     endloop.

   endif.

ENDMODULE.                 " DISABLE_ROW  OUTPUT

Regards.

0 Kudos
811

thnak you arun,

I will try it and let u know if i have any issues with this

thanks & regards

anand

0 Kudos
811

Hello ,

Please go thru the following link..

http://scn.sap.com/thread/2095701

http://scn.sap.com/thread/1876341

will clear all doubts..

0 Kudos
811

thank you chandra

0 Kudos
811

Anand,I liked it but No need to say thanks to all individually. if you liked someone's reply just like or mark it helpful ans, because it make a notification for all.  Please take care of this thing next time.

Best Rgds

Chandra..

Former Member
0 Kudos
811

Hi,

take one extra field for your table control as flag type c.

In PAI of your screen,

When 'SAVE':

set flag for all rows that you want to be disable.

Now in PBO of screen,

loop at ITAB into wa_itab

..

..

..

module make_non_editable.

Endloop.

*******

Module make_non_editable.

data : gv_line_no type i.

IF wa_itab-flag EQ 'X'.               "if data is already sent for approval.

     gv_line_no = tc_9001-current_line.      "to get current line which is looped

   ENDIF.

   LOOP AT SCREEN.

     IF tc_9001-current_line = gv_line_no .

       screen-input = 0.

       screen-active = 1.

       MODIFY SCREEN .

     ENDIF.

   ENDLOOP.

Endmodule.

this will definitely work as i had tested.

Regards,

Abdul

SwadhinGhatuary
Active Contributor
0 Kudos
811

Hello Anand,

create a Boolean variable (e.g-u_flag) .make it marked after data base update in PAI .in PBO check that flag variable is checked or not

MODULE dib_field OUTPUT.

   if u-flag = 'X'.

     loop at screen.

if screen-group1 ='G1'.

screen-active = 0.

and screen-output = '1'.

modify screen.

<query to ftech data from previous record to fill the field>

  endloop.

  endif.

ENDMODULE.

at same time you make a group of field read only .

0 Kudos
811

thank you swadhin

Private_Member_3759
Participant
0 Kudos
811

Hi Anand,

Whenever you want to disable, enable or hide or show a screen you should always use the fields from the "SCREEN" table

Then you can set screen-input = 0 or screen-active = 0 or screen-invisible = 1 as per your requirement.

Thanks.

Ankita

0 Kudos
811

thank you ankita