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,000

Dear all,

Im using wizard to create table control. All have done fine without any problem. Now i perform test on my table control. As expected, all columns in table control shown with input-enable manner. That's fine.

Im facing 2 problems as below:

1. After key in input into a columns of 1st line, then i either press enter or page up or page down, my input will be disappear. To solve this, i use below code in PAI LOOP~ENDLOOP:

module CTRL_modify input.
  modify TAB
    from WA
    index CTRL-current_line.
  IF SY-SUBRC <> 0.
    INSERT WA INTO TABLE TAB index CTRL-current_line.
  ENDIF.
endmodule.

2. With above code, now the input is able to capture and store in TAB internal table and display accordingly in PBO. But it leads to 2nd problem, where my table control now only display the 1st line(the line that i keyed in input) as input-enable, where-as the rest of the lines in table control are input-disable . I want the all the lines in table control are remain input-enable. Could you guys please comment how to achieve that?

Thanks in advance.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
980

Hi,

In your main program or PBO, you can create an internal table with initial lines as many as you want, say 30 lines using:

IF TAB IS INITIAL.
  DO 30 TIMES.
     APPEND INITIAL LINES TO TAB. 
   ENDDO.
ENDIF.

Regards,

Lim...

12 REPLIES 12
Read only

Former Member
0 Likes
981

Hi,

In your main program or PBO, you can create an internal table with initial lines as many as you want, say 30 lines using:

IF TAB IS INITIAL.
  DO 30 TIMES.
     APPEND INITIAL LINES TO TAB. 
   ENDDO.
ENDIF.

Regards,

Lim...

Read only

0 Likes
980

MODULE attrib_set OUTPUT.

LOOP AT tc-cols INTO wa_cols.

wa_cols-screen-input = '1'.

MODIFY tc-cols FROM wa_cols.

ENDLOOP.

ENDMODULE.

Just put this module in your program and call the module from the PBO.

Change the name of tc according to ur table control and decalare

wa_cols type tc-cols

Edited by: sgrshah on Apr 20, 2009 10:52 AM

Read only

0 Likes
980

Lim, thanks for your reply. I understand your method perhaps i did try that before, however for this method i can't only fix a number (your eg 30 times) for appending initial line into my table control. Since there are scenarios like one input line keyed in, then i need to perform intensive calculation on the remaining lines, and for the page up and page down as well...

Is this the only way? Sorry for asking but just want to explore other possibilities....

Read only

0 Likes
980

Hi sgrshah,

Thanks for your reply. Yup, by putting the said module in PBO we can change the attribute of each lines in table control to become input-enable.

But bear in mind that, as per my scenario(given in first post), in PAI i inserted one entry into internal table TAB. So now, i have one entry in TAB.

When control coming back to PBO, in flow logic it LOOP at TAB again for displaying data on screen. For now my TAB only have ONE record, and for sure that it only LOOP one time.

In other words, i do not have chance to loop through the rest of lines of the itab to change the lines' attributes.

Please advice.

Read only

0 Likes
980

Put that module in PBO before the

statements loop at it_tab with table control ..... endloop.

I mean call the module in PBO before the looping of table control.

Read only

0 Likes
980

Hi sgrshah,

Thanks for your reply. However i tried your method but it doesn't work, since i only have ONE entry in internal table TAB, hence my tc-cols will always only have one entry. So im just only able to loop ONE time.

This eventually lead me back to my problem that im not able to loop through the rest of lines by changing the attribute.

Please advice.

Read only

0 Likes
980

pbo:---

MODULE attrib_set.

LOOP AT it_xx INTO wa_xx WITH CONTROL tabcnt.

MODULE fill_tab.

ENDLOOP.

Code for the module attrib_set.

module attrib_set output.

LOOP AT tabcnt-cols INTO wacnt_cols.

wa_cnt-screen-input = '1'.

MODIFY tabcnt-cols FROM wacnt_cols.

ENDLOOP.

endmodule.

Hey this code is working for me

Edited by: sgrshah on Apr 20, 2009 11:44 AM

Edited by: sgrshah on Apr 20, 2009 11:49 AM

Read only

0 Likes
980

Yup, i debug the code and "Input" is equals to 1.

I do believe the input-enable that i set here is accordance to the number of lines that available in internal table TAB. For my case, i have only ONE line hence only this line is input-enable. Am i right?

If this is the case, that's strange that the same coding is working at your end. I'm wondering what code i left out or what setting that i did wrong......

Please comment.

Read only

0 Likes
980

Hey i have made some changes just do the following.

PROCESS BEFORE OUTPUT.

MODULE attrib_set.

loop with control tabcnt.

MODULE FILL_TAB.

endloop.

module FILL_TAB output.

READ TABLE it_xx INTO SCR_MATNR INDEX Tabcnt-CURRENT_LINE.

endmodule.

PROCESS AFTER INPUT.

LOOP WITH CONTROL tabcnt.

MODULE READ_TAB.

ENDLOOP.

Read only

0 Likes
980

Hi sgrshah,

You added in below code and this is solving my problem?

module FILL_TAB output.
READ TABLE it_xx INTO SCR_MATNR INDEX Tabcnt-CURRENT_LINE.
endmodule.

I doubt the above is leading back to my initial problem, since the module is coded within LOOP~ENDLOOP in PBO where in my TAB i just have only ONE record where there is no way for me to loop the rest of lines....

Please advice.

Read only

0 Likes
980

Can u tell that after u inserted the code what's the problem and if possible paste the code.

Read only

0 Likes
980

Ya sgrshah, i did tried on that. That is not working.

Please comment.