Question on table control
Hi Experts,
I have created a table control having 10 lines in it using screen painter.
the purpose of this table control is to get data from user and store that data in Database Table.
For Eg., if the user wants to add 15 rows into it..then how can the no of rows in table control increased? ANy option available?
Regars,
Greeshma
because your always changing row 1 at the moment even if you think its 11 - you need to update the current row in your table control processing
pbo
loop at g_tc_bu_names_itab
into g_tc_bu_names_wa
with control tc_bu_names
cursor tc_bu_names-current_line.
g_tc_bu_names_lines = sy-loopc.
endloop.
pai
loop at g_tc_bu_names_itab.
" do some pai processing etc then do your modify when ready...
modify g_tc_bu_names_itab
from g_tc_bu_names_wa
index tc_bu_names-current_line.
endloop.
Similar Messages
-
A question about table control
Hello Expert,
I have created a table control with wizard using internal table. I can display the data in the table successfully. Now the new requirement is to add two buttons to sort the data in ascending or descending. But it seems that it's impossible to select the column that the user want to use as sort field.
Does any expert tell me how i can select the column?
Thanks & Regards, JohnnyAfter doing the steps mentioned by sap fan you have to use below approach for coding.
Your table control has structure CXTAB_CONTROL defined in the type group CXTAB in the ABAP Dictionary and
CXTAB_CONTROL contains a table of the structure CXTAB_COLUMN which has the attributes of a column of table control.
Lets say you have defined table control as
CONTROLS tab1 TYPE TABLEVIEW USING SCREEN <scr> then you have can read variable tab1-COLS[ ] into one internal table
of type CXTAB_COLUMN (lets consider this table as tab2) then check this tab2-SELECTED, if column is selected then
it will be 'X' else space. Accordingly sort your internal table of table control.
Regards,
Pawan -
How to transfer data in table control in bdc
hi
how to transfer data in table control in bdc . I need the theory regarding this
byeHi,
just check in the forum , there is many threads available to ur questions.
Table control in BDC
http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm
You can even refer to these related threads
bdc table control
Re: table control in bdc
table control in BDC
Reward if helpful.
Thanks
Naveen khan -
BDC programming and table controls selColumns
Hello,
I have a small question regarding BDC programming. I am already quite familiar with the process in creating one but I have one question regarding table control and its selColumns.
Transactions like pa40 would require its users to select one of the rows in the table controls via SelColumns. My questions is how would you simulate this using BDC.
Thanks people and take care.Hai Chad Cheng
report Z_TAB_CONTRL_01
no standard page heading line-size 255.
data : begin of it_kna1 occurs 0,
kunnr like RF02D-KUNNR,
D0130 like RF02D-D0130,
end of it_kna1.
data : begin of it_kna2 occurs 0,
kunnr like RF02D-KUNNR,
BANKS like KNBK-BANKS,
BANKL like KNBK-BANKL,
BANKN like KNBK-BANKN,
koinh like KNBK-koinh,
end of it_kna2.
data : V_Count(2) type n.
data : V_Val(15).
include bdcrecx1.
start-of-selection.
perform Get_Data1.
perform Get_Data2.
perform open_group.
loop at it_kna1.
V_Count = '04'.
perform bdc_dynpro using 'SAPMF02D' '0106'.
perform bdc_field using 'BDC_CURSOR'
'RF02D-D0130'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RF02D-KUNNR'
'10002103'.
perform bdc_field using 'RF02D-D0130'
'X'.
perform bdc_dynpro using 'SAPMF02D' '0130'.
perform bdc_field using 'BDC_OKCODE'
'=P+'.
perform bdc_dynpro using 'SAPMF02D' '0130'.
perform bdc_field using 'BDC_OKCODE'
'=P+'.
perform bdc_dynpro using 'SAPMF02D' '0130'.
loop at it_kna2 where kunnr = it_kna1-kunnr.
if v_count = '10'.
perform bdc_field using 'BDC_OKCODE'
'=P+'.
perform bdc_dynpro using 'SAPMF02D' '0130'.
v_count = '00'.
endif.
V_Count = V_Count + 1.
concatenate 'KNBK-KOINH(' V_Count ')' into V_Val.
perform bdc_field using 'BDC_CURSOR'
'KNBK-KOINH(09)'.
concatenate 'KNBK-BANKS(' V_Count ')' into V_Val.
perform bdc_field using V_Val
it_kna2-BANKS.
concatenate 'KNBK-BANKL(' V_Count ')' into V_Val.
perform bdc_field using V_Val
it_kna2-BANKL.
concatenate 'KNBK-BANKN(' V_Count ')' into V_Val.
perform bdc_field using V_Val
it_kna2-BANKN.
concatenate 'KNBK-KOINH(' V_Count ')' into V_Val.
perform bdc_field using V_Val
it_kna2-KOINH.
endloop.
perform bdc_field using 'BDC_OKCODE'
'=UPDA'.
perform bdc_transaction using 'FD02'.
clear : it_kna1,it_kna2.
endloop.
perform close_group.
*& Form Get_Data1
text
--> p1 text
<-- p2 text
FORM Get_Data1 .
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
CODEPAGE = ' '
FILENAME = 'C:\tab_contl.txt'
FILETYPE = 'ASC'
ITEM = ' '
FILEMASK_MASK = ' '
FILEMASK_TEXT = ' '
FILETYPE_NO_CHANGE = ' '
FILEMASK_ALL = ' '
FILETYPE_NO_SHOW = ' '
LINE_EXIT = ' '
USER_FORM = ' '
USER_PROG = ' '
SILENT = 'S'
IMPORTING
FILESIZE =
CANCEL =
ACT_FILENAME =
ACT_FILETYPE =
TABLES
DATA_TAB = it_kna1
EXCEPTIONS
CONVERSION_ERROR = 1
INVALID_TABLE_WIDTH = 2
INVALID_TYPE = 3
NO_BATCH = 4
UNKNOWN_ERROR = 5
GUI_REFUSE_FILETRANSFER = 6
OTHERS = 7
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " Get_Data1
*& Form Get_Data2
text
--> p1 text
<-- p2 text
FORM Get_Data2 .
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
CODEPAGE = ' '
FILENAME = 'C:\tab_cont1.txt'
FILETYPE = 'ASC'
ITEM = ' '
FILEMASK_MASK = ' '
FILEMASK_TEXT = ' '
FILETYPE_NO_CHANGE = ' '
FILEMASK_ALL = ' '
FILETYPE_NO_SHOW = ' '
LINE_EXIT = ' '
USER_FORM = ' '
USER_PROG = ' '
SILENT = 'S'
IMPORTING
FILESIZE =
CANCEL =
ACT_FILENAME =
ACT_FILETYPE =
TABLES
DATA_TAB = it_kna2
EXCEPTIONS
CONVERSION_ERROR = 1
INVALID_TABLE_WIDTH = 2
INVALID_TYPE = 3
NO_BATCH = 4
UNKNOWN_ERROR = 5
GUI_REFUSE_FILETRANSFER = 6
OTHERS = 7
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " Get_Data2
Thanks & regards
Sreenivasulu P -
Question Concerning Usage of Table Controls
I currently have three screens. The first screen is the main screen and the other two screens are subscreens called from within the main screen. Inside each of the two subscreens, I have a separate table control. Each table control provides a display of specific data. I would like the first table control to be maintained by certain actions done in the second subscreen. At the moment, I do know that the internal table used for the first table control is being modified accordingly. The issue is the table control on the screen is not being modified based on the change reflected on the internal table. If I modify the internal table, the table control on the screen still reflects the old value.
Is what I am trying to do possible? Do I need to force an event in order for the table control to be modified or refreshed from the internal table? I have no issue in modifying the table control defined in the second subscreen. The table control on the first subscreen is the one where I have the issue with update.
Thanks in advance.
--VinceHi,
If the PBO of the main screen is called..
THen table control in the first screen should be getting called also..
In the debugging check if the internal table is having the updated values before hitting the LOOP AT statement of the PBO of the first screen..
Thanks,
Naren -
Question on line selection in table control in dialog programming....
Hello,
I have a internal table displayed on a screen using Table control wizard. Now, when user selects a particular line and double clicks it, I want to write a query based on the line user selected. How can this be achieved ?
Regards,
Rajesh.Assign a function code to F2 in your status and do the coding:
PROCESS PAI.
LOOP AT ITAB.
MODULE GET_CURSOR.
ENDLOOP.
MODULE USER_COMMAND.
MODULE GET_CURSOR.
GET CURSOR FIELD ws_field LINE ws_line.
ENDMODULE.
MODULE USER_COMMAND.
CASE OK_CODE.
WHEN 'PICK'.
WS_LINE = <TABLE CONTROL>-TOP_LINE + WS_LINE - 1.
READ TABLE ITAB INDEX WS_LINE.
---> Show details
ENDMODULE. -
How to handle Table control (pls read question)
Hi All,
I am writing code for CA21 Tcode , i am getting values into table control using P+ successfully but problem is i have to select 1st entry in table control and it will go to other screen and come back and select 2nd entry ....like that it will do until all entries in table control is over .
Can any one pls send any code for this logic.
Regards,
Sudhakar Reddy.AHi ,
This should done dynamically with out user interaction .
Regards,
Sudhakar Reddy A -
Module pool question -table control related
Hi All,
I have table control with field mark some input enabled fields in it Now the problem is when i change the content of one row and select that row then control goes to modue in PAI which is called on ON REQUEST but the changed vaule is not capturing in it only slected row with previous content come in that module . Can u suggest some solution or neccessary setting to be done in attribute of tabe control?
If possible provide code for it
Thanks
ParagHi,
Please go through the following code below to solve your issue.
REPORT demo_dynpro_tabcont_loop_at.
CONTROLS flights TYPE TABLEVIEW USING SCREEN 100.
DATA: cols LIKE LINE OF flights-cols,
lines TYPE i.
DATA: ok_code TYPE sy-ucomm,
save_ok TYPE sy-ucomm.
DATA: itab TYPE TABLE OF demo_conn.
TABLES demo_conn.
*SELECT * FROM spfli INTO CORRESPONDING FIELDS OF TABLE itab.*
LOOP AT flights-cols INTO cols WHERE index GT 2.
cols-screen-input = '0'.
MODIFY flights-cols FROM cols INDEX sy-tabix.
ENDLOOP.
CALL SCREEN 100.
MODULE status_0100 OUTPUT.
SET PF-STATUS 'SCREEN_100'.
DESCRIBE TABLE itab LINES lines.
flights-lines = lines.
ENDMODULE.
MODULE cancel INPUT.
LEAVE PROGRAM.
ENDMODULE.
MODULE read_table_control INPUT.
MODIFY itab FROM demo_conn INDEX flights-current_line.
ENDMODULE.
MODULE user_command_0100 INPUT.
save_ok = ok_code.
CLEAR ok_code.
CASE save_ok.
WHEN 'TOGGLE'.
LOOP AT flights-cols INTO cols WHERE index GT 2.
IF cols-screen-input = '0'.
cols-screen-input = '1'.
ELSEIF cols-screen-input = '1'.
cols-screen-input = '0'.
ENDIF.
MODIFY flights-cols FROM cols INDEX sy-tabix.
ENDLOOP.
WHEN 'SORT_UP'.
READ TABLE flights-cols INTO cols WITH KEY selected = 'X'.
IF sy-subrc = 0.
SORT itab STABLE BY (cols-screen-name+10) ASCENDING.
cols-selected = ' '.
MODIFY flights-cols FROM cols INDEX sy-tabix.
ENDIF.
WHEN 'SORT_DOWN'.
READ TABLE flights-cols INTO cols WITH KEY selected = 'X'.
IF sy-subrc = 0.
SORT itab STABLE BY (cols-screen-name+10) DESCENDING.
cols-selected = ' '.
MODIFY flights-cols FROM cols INDEX sy-tabix.
ENDIF.
WHEN 'DELETE'.
READ TABLE flights-cols INTO cols WITH KEY screen-input = '1'.
IF sy-subrc = 0.
LOOP AT itab INTO demo_conn WHERE mark = 'X'.
DELETE itab.
ENDLOOP.
ENDIF.
ENDCASE.
ENDMODULE. -
Questions on handling two table controls on one screen.
Can some people please share some technology tips on handling two table controls on one screen .
Thanks
Moderator message - You'll find some cool tips if you search the forum or use Google first - post locked
Edited by: Rob Burbank on Dec 7, 2009 11:20 AMhi
other Table is in Disable mode.
check that u have unticked the READ ONLY property of ur UI
also check if u have binded the ENABLE property of ur table UI to WDY_BOOLEAN in some method
and u r setting it to 'X'
in the OnToggle event of ur Checkbox , set this attribute to 'X to make the checkbox ticked
in the OnToggle event of ur Checkbox , set this attribute to ' ' to make the checkbox un ticked
DATA lo_nd_cn_node TYPE REF TO if_wd_context_node.
DATA lo_el_cn_node TYPE REF TO if_wd_context_element.
DATA ls_cn_node TYPE wd_this->element_cn_node .
DATA lv_attr LIKE ls_city-ca_attr.
* navigate from <CONTEXT> to <CN_VISIBLE> via lead selection
lo_nd_node = wd_context->get_child_node( name = wd_this->wdctx_ca_attr).
* get element via lead selection
lo_el_cn_node = lo_nd_cn_node->get_element( ).
* set single attribute
lo_el_cn_node->set_attribute(
EXPORTING
name = `CA_ATTR`
value = ' ' ).
// set attribute CA_ATTR under CN_NODE to ' '
// this will make the table UI control disabled
// this is a code generated thru code wizard ( control +f7) , read context node/attribute
// use SET_ATTRIBUTE method
regards,
amit -
Hello,
What determines the Active Cell Position property node for a table control? I have this in my code and I am displaying its value to a front panel indicator. The value displayed is always set to 0,0. The help for the property node say that it is "read -only" so what sets the value of Active Cell Position for a Table Control?
Regards,
Kaspar
Solved!
Go to Solution.You set the active cell with a property node. Once you select an active cell, you can do specific things to that cell and that cell alone, things like set the background color.
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines -
Select all and deselect all in table control
Hi experts,
I want to make the select all and deselect all options in my table control.
But i can't able to do that one. Kindly suggest me how to do that one.
one more thing, if i select some rows in the table control, and press save it should be saved in some other table. how can i implement that one.
Waiting for ur reply.
Regards...
Arun.Hi Arun,
In the context node that you bind to the table, set the cardinality as 0..n and selection as 0..n. In the UI element Table, set the property selectionMode as 'multi'. Then a toggle button for select/deselect all will appear automatically in your table. You can see it in the top left corner.
For your second question, after selecting the elemets and pressing 'save', in your event handler, do a get_selected_elements( ) on your node. This will return you a set of context elements. Loop through each element and do a get_static_attributes to get the rows. Then you can append these rows to another internal table and bind it to the context. Bind your second table to this node. If the two tables are in different views, the context nodes need to be present in the component controller and mapped to the views.
Hope this helps.
Regards
Nithya -
How to implement F4 help in table control
Hi all,
I am working on a table control in a module pool program. I have three fields in table control , material no. , material description and quantity. my requirement is , in table control , i need to provide the F4 help for material no. and material description, in a way, if i select material no. using F4, the corresponding material description field would be entered automatically in the table control field.
Pls suggest me on this , if possible pls give me code or logic to do this.
Thanks
Saravan
Moderator message: please don't post the identical question again after the first attempt was locked for good reasons. Search for available information before asking.
Edited by: Thomas Zloch on Mar 3, 2011 11:54 AMHi Saravana,
Please search in SCN before posting. You will find many threads related to this question. The basic logic is you have to get the selected row of table control using DYNP_GET_STEPL function in your POV. Then using function DYNP_VALUES_READ read the material and create the description to be displayed. You have use function F4IF_INT_TABLE_VALUE_REQUEST to display search help. -
How to delete a row in table control(accepts only input)?
Hi All,
I have an empty table control which is only use for data input(this data will then be use to store information to a custom table). I have two buttons, Create Entry and Delete Entry.
In my screenPainter for the table control, I have the checkbox w/SelColumn ticked and assign variable T_DATA-MARK on it.
Please see the actual screenshots and code below:
The aim of the table control is just to accept inputs, so the internal table in the PBO is always empty.
Table Control Screen Painter ScreenShot and Actual SAP Output:
http://img710.imageshack.us/img710/4751/tablecontrolrowdelete.jpg
PBO
PROCESS BEFORE OUTPUT.
LOOP WITH CONTROL TC_ID.
MODULE LOAD_TABLECTRL.
ENDLOOP.
module LOAD_TABLECTRL output.
READ TABLE T_ID_CHECK INTO WA_ID_CHECK INDEX TC_ID-current_line.
IF SY-SUBRC EQ 0.
MOVE-CORRESPONDING T_ID_CHECK TO TC_ID.
ELSE.
"EXIT FROM STEP-LOOP.
CLEAR ZQID_CHECK.
ENDIF.
PAI
PROCESS AFTER INPUT.
LOOP WITH CONTROL TC_ID.
CHAIN.
MODULE CHECK_ENTRIES ON CHAIN-INPUT.
MODULE MODIFY_T_ID_CHECK ON CHAIN-INPUT.
MODULE DELETE_ROW ON CHAIN-INPUT
ENDCHAIN.
ENDLOOP.
module CHECK_ENTRIES input.
CASE ok_code.
WHEN 'DEL'.
PERFORM F_FILL_ITABCREATE USING ZQID_CHECK-MATNR
ZQID_CHECK-LICHA
ZQID_CHECK-LIFNR.
ENDCASE.
endmodule.
form F_FILL_ITABCREATE using us_zqid_check_matnr LIKE MARA-MATNR
us_zqid_check_licha LIKE MCHA-LICHA
us_zqid_check_lifnr LIKE LFA1-LIFNR.
MOVE: us_zqid_check_matnr TO WA_ID_CHECK-MATNR,
us_zqid_check_licha TO WA_ID_CHECK-LICHA,
us_zqid_check_lifnr TO WA_ID_CHECK-LIFNR.
APPEND WA_ID_CHECK TO T_ID_CHECK.
CLEAR WA_ID_CHECK.
endform.
module MODIFY_T_ID_CHECK input.
DATA W_TEMPMARK(1) TYPE C.
MOVE: T_ID_CHECK-MARK TO W_TEMPMARK,
W_TEMPMARK TO T_ID_CHECK-MARK.
MODIFY T_ID_CHECK INDEX SY-TABIX TRANSPORTING MARK.
endmodule.
module DELETE_ROW input.
LOOP AT T_ID_CHECK WHERE MARK EQ 'X'.
DELETE T_ID_CHECK.
ENDLOOP.
endmodule.
Edited by: Jaime Cabanban on Jan 7, 2010 8:46 PMDebugging the PBO part after deletion will help you know why the rows are getting deleted
This is the sap doc answer for you question regarding LINE.
Controls the scroll bar of the table control. At LOOP without internal table, LINES has the initial value zero and must be set in the program so that the scroll bar can be used. At LOOP AT <itab> the system sets this component to the number of rows of the internal table, whenever the table control is processed for the first time. The initialization event of a table control is not determined uniquely. If the corresponding internal table is not fully created at this event, then the LINES variable receives an incorrect value. If LINES in the LOOP loop is smaller as the number of rows of the internal table, then the table control contains blank rows at the end.
Therefore you should always set the LINES component explicitly in the ABAP program, including at LOOP AT <itab>. In this way you have full control over the dimensions of the vertical scroll bar and so can control the number of rows that are ready for input. Initialization should usually occur at PBO directly before the LOOP statement for the table control. -
How to implement line selectability for a table control using table Wizard?
Hello SDN Community,
I have created a table control using the Table Wizard. I found my exact question in this forum, but unfortunately it had not been andsered. While I cannot paste a screen-print into this plane-text area, here are the steps I followed...
1) SE51
2) Create new screen 0100
3) Click Layout button
4) Clidk Table Control (with Wizard) and draw box on canvas.
5) Step is "Start" - click Continue
6) Step is "Name of Table Control" - provided name
7) Step is "Table Name" - provided name of dictionary table (AUFK)
8) Step is "Definition of Columns" - selected order numver and order text
9) Step is "Table Control Attributes" - Line Selectability is in display mode - cannot set it.
I would like to have a selectability column for my table. Would appreciate any insight into how to do this.
Thank you,
Dean Atteberry.This is a puzzling...
For the table control wizard, in the Table Control Attributes step, I was able to get line selectability to open up by declaring a char01 data element at the beginning of my type.
The puzzling is in regards to the "Selection col. fld" entry field.
If I leave it blank and try to go to the next step, I get message "Enter the name of the selection column if you are using a program table"
So it looked like it wanted to know the name of my selection column. So I type in "CHAR1". and got the message "The field "CHAR1" for the selection column is already contained in the table."
Hmmmmm.... don't understand............
Dean Atteberry. -
How to get current row data in table control
Hi , expert ,
I am professional in oracle , but now I am a new guy in SAP ABAP .
I have a question in UI
How to get current row data and click pushbutton in table control to open next screen ?
I want to get the current data and open next screen to carry out detail detail .
Thansk for all your suggestion .GET CURSOR LINE SY-CUROW .
READ TABLE internal_table index SY-CUROW.
Maybe you are looking for
-
How to import Verilog codes into LabVIEW FPGA?
I tried to import Verilog code by instantiation followed by the instruction in http://digital.ni.com/public.nsf/allkb/7269557B205B1E1A86257640000910D3, but still I can see some errors while compiling the VI file. Simple test Verilog file is as follo
-
Error occurred with the POP3 mail server
When I first launch my email icon the following error pops up: An error occurred with the POP3 mail server. Mail server mail.midland-webhosting.com responded What can I do so that I can access my email? Thanks!
-
Why can't I find songs for sell in the brazilian iTunes store?
I recently moved from Japan to Brazil. Today I was listening to a track that I liked on Vimeo, so I just went over to iTunes in order to buy the song, but to my surprise I could not find any song at all in the brazilian store. For instance, Power Sea
-
[Binding] metadata tag
Hi, i am new to flex, and it seems that i dont understand when the value of one property is being copied to another. for example ----------- MXML FILE ------------------------------ [Bindable] public var test3:String; [Bindable] public var test2:Stri
-
Consignment delivery status is howing the status being processed
Dear Guru, I would like to know the reason behing showing the status of consignment delivery document as "BEING PROCESSED". The scenario is as below: as we all know that in consignment sales process there are for steps that we require.The