05-21-2012 6:46 AM
Hi All,
i am using a table control in my program. In my program, I fill the table control and when I click on 'SAVE', data gets stored int the Z table.
The issue is that I am unable to give a vertical scrollbar for the table control. Hence only 21 lines can be inserted in the table control.
Kindly advice me on this.
Thanks,
Neha
05-21-2012 6:59 AM
You have to set the LINES property of the table control In the PBO of your screen, to the number of entries in the internal table.
data: lv_line type i.
DESCRIBE TABLE gt_table LINES lv_line.
table_control-lines = lv_line + 1.
05-21-2012 7:09 AM
Hi Shambu,
thanks for ur reply.
In the PBO, the internal table will be empty. So will the code work?
Instead can we add table_control-v_scroll = 'X'. If yes, where do i need to add it.
Kindly advice.
thanks,
Neha
05-21-2012 7:21 AM
When you create the table control you will having an option in the wizard to enable scrolling.
You can switch them on and off in horizontal and vertical scrolling in the properties of the table control.
They can be accessed from the screen painter by double clicking on the table control.
05-21-2012 7:35 AM
Hi Shambu,
I am not using table control with wizard.
i could not find that option in the table control properties.
thanks,
neha
05-21-2012 7:37 AM
Hi
You can do two thing in table control properties check horizontal and vertical scroll options plus in PBO you can based on number of lines in internal table assign it to TC_ABC-LINES if no lines are there then add by default 20..10.. any number of lines as you want.
Nabheet
05-21-2012 7:40 AM
Then put some random value like 50 in the no of lines in Table control
05-21-2012 7:45 AM
Hi Nabheet,
i tried giving the table control lines as 999.
table_control-lines = '999'.
It gave me the vertical scroll bar. but when I scroll down there is no change in the data appearing on the table control. I cannot input more than 21 line items.
It should be like when I scroll down I get a new line and I can input data in that new line.
Thanks,
Neha
05-21-2012 7:49 AM
Please check in LAyout editor are the fields input enabled?.. Are you disabling them in program?
Nabheet
05-21-2012 7:49 AM
Please check in LAyout editor are the fields input enabled?.. Are you disabling them in program?
Nabheet
05-21-2012 7:49 AM
Please check in LAyout editor are the fields input enabled?.. Are you disabling them in program?
Nabheet
05-21-2012 7:52 AM
05-21-2012 8:09 AM
Hi,
Go through the following code,
In ABAP Editor,
module STATUS_9999 output.
SET PF-STATUS '9999'.
DESCRIBE TABLE T_UPLOAD LINES fill.
TBC-lines = fill.
endmodule. " STATUS_9999 OUTPUT
In flow logic,
loop.
module upload_data.
endloop.
In the module upload_data
module UPLOAD_DATA input.
lines = sy-loopc.
endmodule.
05-21-2012 8:44 AM
as simple as that neha:
try below code:
PROCESS BEFORE OUTPUT.
MODULE STATUS_0001.
LOOP AT I_MAKT WITH CONTROL TC.
MODULE DISPLAY_ITEMS_I_MAKT." display contents of internal table to table control
ENDLOOP.
PROCESS AFTER INPUT.
LOOP AT I_MAKT.
MODULE FILL_TABLE_CONTROL." move contents of table control to internal table
ENDLOOP.
module count_lines.
MODULE USER_COMMAND_0001.
Pbo module
MODULE STATUS_0001 OUTPUT.
SET PF-STATUS 'xxxxxxxx'.
* SET TITLEBAR 'xxx'.
*v_lines is the no of rows in ur internal table.
* now with this code we have increased the table control lines
*by 10 to the no of lines in internal table (i_makt in this case)
TC-LINES = V_LINES + 10. " <-- most important declaration
ENDMODULE. " STATUS_0001 OUTPUT
MODULE COUNT_LINES INPUT.
clear v_lines.
DESCRIBE TABLE I_MAKT LINES V_LINES. " here we have counted the no of rows in our internal table.
ENDMODULE. " COUNT_LINES INPUT
this will force an automatic vertical scroll bar in your table control.
i have just tested it.
revert back if problem still not solved!
05-21-2012 9:49 AM
Hi Abhishek,
thanks for your answer.
The module MODULE FILL_TABLE_CONTROL." move contents of table control to internal table
will fill the internal table with only those records that are visible on the screen. Initially the problem is that I could enter the data only for 21 lines in the table control. I want to enter data for more than 21 lines.
Thanks,
Neha
05-22-2012 5:14 AM
The module MODULE FILL_TABLE_CONTROL." move contents of table control to internal table
will fill the internal table with only those records that are visible on the screen. Initially the problem is that I could enter the data only for 21 lines in the table control. I want to enter data for more than 21 lines.
thats what i cleared neha. the concept is simple. in screen layout strech Your Table control.
and
Pbo module
MODULE STATUS_0001 OUTPUT.
- SET PF-STATUS 'xxxxxxxx'.
- * SET TITLEBAR 'xxx'.
- *v_lines is the no of rows in ur internal table.
- * now with this code we have increased the table control lines
- *by 10 to the no of lines in internal table (i_makt in this case)
-
-
- *TC-LINES = V_LINES + 10. " <-- most important declaration
- *insted write below line:
- tc-lines = v_lines + 50. <-50 lines will appear in ur table control to enter *records.
- ENDMODULE. " STATUS_0001 OUTPUT
post your exact code if you still feel the concept is not clear to you.
05-24-2012 4:53 AM
Hi Abhishek,
Thanks for ur reply.
I am getting the scrollbar now.. but the issue is that when I scroll down, the earlier data is getting refreshed.
Kindly advice m eon this.
thanks,
Neha
05-24-2012 5:19 AM
I am getting the scrollbar now.. but the issue is that when I scroll down, the earlier data is getting refreshed.
This is becoz:
Scrolling Itself Has function code attached to it.
U will understand : press /H in command box and then scroll.
see PAI Triggers.
The solution is:
you have to store the contents of your table control to some internal table IN PAI.
and then in PBO u have to display the contents of internal table to ur table control.
in my earlier post i have mentioned this:
IN PAI:
loop at i_tc.
module fill_internal_table.
endloop.
in PBO:
loop at i_tc with control TC.
module display_itab_to_table_control.
endloop.
module display_itab_to_table_control output.
move-corresponding i_tc to tc." TC ur table control
endmodule.
module fill_internal_table input.
move-corresponding i_tc to tc.
"append or modify as per ur need .
endmodule.
05-24-2012 5:56 AM
Hi Neha,
I think it is because of function code attached to the scroll bar implicitly . PAI module gets called , whenever we try to scroll it down .
So try this out.
Just write OK_CODE = ' ' as a last statement in the PAI module before ENDMODULE statement in a program.
Thanks
Santosh
05-24-2012 9:18 AM
Hi Santhosh..
You are right. PAI module is getting called everytime I scroll down.. i am pasting my code here.
PROCESS BEFORE OUTPUT.
MODULE STATUS_0200.--------> in the pf status I am setting <tc>-lines = '999' to enable the vertical scrollbar
.
loop at it_detail into wa_detail with control detail_save cursor
detail_save-current_line.
MODULE SET_DEFAULT_DETAIL.-----------> to copy data from internal table it_detail to the table control screen.
endloop.
PROCESS AFTER INPUT.
loop at it_detail .
Chain.
Field :
zxic_detail-bschl,
zxic_detail-newco,
zxic_detail-mwskz,
zxic_detail-kostl,
zxic_detail-projk,
zxic_detail-prctr,
zxic_detail-wrbtr,
zxic_detail-dzuonr,
zxic_detail-sgtxt,
zxic_detail-vbund,
zxic_detail-bewar,
zxic_detail-matnr,
zxic_detail-menge,
zxic_detail-meins,
zxic_detail-recid,
zxic_detail-koart,
zxic_detail-newco2,
zxic_detail-mwskz,
zxic_detail-kostl2,
zxic_detail-projk2,
zxic_detail-prctr2,
zxic_detail-dmbtr,
zxic_detail-dmbe2,
zxic_detail-bewar2,
zxic_detail-matnr2,
zxic_detail-menge2,
zxic_detail-meins2,
zxic_detail-recid2.
MODULE VALIDATE_DATA_DETAIL.-------> validation of data
ENDCHAIn.
MODULE DATA_TO_INTERNAL_TABLE_DETAIl.---------> copying of data from table control to internal table it_detail
endloop.
MODULE USER_COMMAND_0200.-------------->when the user clicks on SAVE the data from the internal table is getting stored in the internal table
The problem here is that when I get scroll up or scroll down I get duplicate data in the table control screen.
Kindy reply.. Its urgent.
Thanks,
Neha
05-24-2012 9:39 AM
Hi Neha,
Include ok_code in element list of screen.
declare ok_code in data declaration part.
data: ok_code type sy_ucomm.
data: FLAG(1) type c.
In the implementaion of module USER_COMMAND_0200 in the program try following code.
MODULE USER_COMMAND_0200 INPUT.
case ok_code.
when "save".
*write code here for save button
.
.
.
.
.
.
endcase.
ok_code = ' '. "this should be after endcase statement.
ENDMODULE.
And in Module STATUS_200 OUTPUT. Add following code.
MODULE STATUS_200 OUTPUT.
IF FLAG = ' '.
FLAG = 'X'.
*Write your all code here.
ENDIF.
ENDMODULE.
Thanks
Santosh.
05-24-2012 9:52 AM
Hi santosh,
I did the same but its still not working.
Kindly advice.
Thanks,
Neha
05-24-2012 10:01 AM
Hi,
Please show me all your code in MODULE STATUS_200 OUTPUT and
MODULE USER_COMMAND_0200 INPUT.
Thanks
Santosh.
05-24-2012 12:55 PM
Hi,
In PBO before loop try to put
MODULE Lines.
MODULE Lines
DESCRIBE TABLE IT_TAB LINES tab_ctrl-lines.
tab_ctrl-lines = tab_ctrl-lines + 10. "to add 10 more lines
ENDMODULE.
Also in table control attributes, try to check vertical horizontal resizing.
Hope this will help. Thanks!
08-26-2015 1:16 PM
Hi Neha,
I facing same issue. Please let me know how to solve the issue.
It looks this thread is still unanswered.
Regards,
Sandeep K
08-26-2015 7:15 PM