Table control index
Hi,
I have a table control. How to get the index of the row selected in the table control?
Please help. Very urgent
Thanks
Hi Kushaal Choudri,
Procedure for Table control line selection and modifying master table using
those values.
1).
U should take one variable in your internal table or in structure which
is used for table control fields
ex :
data :begin of itab occurs 0 ,
mark type c ,
matnr like mara-matnr ,
matkl like mara-matkl,
maktx like makt-maktx,
end of itab .
Controls: TABC types TABLEVIEW using screen 100.
2).
This mark variable should be given in Table control properties.
follow the path
double click on the table control-->attributes .->select
w/SelColumn and in that itab-mark. Check in the figure.
[http://bp2.blogger.com/_O5f8iAlgdNQ/R99gOUH8CXI/AAAAAAAAA9I/d3gOum1fJ6s/s1600-h/pic28145-796618.jpg|http://bp2.blogger.com/_O5f8iAlgdNQ/R99gOUH8CXI/AAAAAAAAA9I/d3gOum1fJ6s/s1600-h/pic28145-796618.jpg]
3).
After that. Take this example.
PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
LOOP AT ITAB WITH CONTROL tabc
ENDLOOP.
PROCESS AFTER INPUT.
MODULE CANCEL AT EXIT-COMMAND.
LOOP AT ITAB.
Module read_table_control.
ENDLOOP.
module user_command_0100.
==============================
In this Module read_table_control, You should write the following code
MODULE read_table_control INPUT.
MODIFY itab INDEX tabc-current_line."( This will update the ITAB table MARK field with 'X ' whatever we have selected on table control.)
ENDMODULE.
4)
If you want to Delete some of the records from Table control
follow this code u2026Create one pushbutton and give Fucnction code to that
and write below code
WHEN 'DELETE'.
LOOP AT itab WHERE mark = 'X'.
DELETE itab.
ENDLOOP.
ENDCASE.
I hope that it helps u .
Regards,
Venkat.O
Similar Messages
-
How to get all the index of "selected rows" in table control?
Hi Gurus,
I have a table control, wherein I need to get selected row so that I can get its respective TABIX.
I know that the event for capturing selected row is in PAI.
I also ensure that the w/ selColumn name in my screenpainter is exactly the same as my declaration in ABAP.
TOP INCLUDE
YPES: BEGIN OF Y_ZQID_CHECK,
IDNUM TYPE ZQID_CHECK-IDNUM,
WERKS TYPE ZQID_CHECK-WERKS,
MATNR TYPE ZQID_CHECK-MATNR,
LICHA TYPE ZQID_CHECK-LICHA,
LIFNR TYPE ZQID_CHECK-LIFNR,
ECOA_S TYPE ZQID_CHECK-ECOA_S,
ID_STAT TYPE ZQID_CHECK-ID_STAT,
ID_DATE TYPE ZQID_CHECK-ID_DATE,
FLAG_MAILCOA(1) TYPE C,
MARK(1) TYPE C, "Name of w/ SelColumn in ScreenPainter: T_ZQIDCHECK_DISCH-MARK
END OF Y_ZQID_CHECK.
DATA: T_ZQIDCHECK_DISCH TYPE STANDARD TABLE OF Y_ZQID_CHECK WITH HEADER LINE.
PAI
PROCESS AFTER INPUT.
* MODULE USER_COMMAND_9004.
LOOP AT T_ZQIDCHECK_DISCH.
MODULE READ_TC_DISCH .
ENDLOOP.
module READ_TC_DISCH input.
DATA: W_LINE_SEL TYPE SY-STEPL,
W_TABIX LIKE SY-TABIX.
GET CURSOR LINE W_LINE_SEL.
W_TABIX = TC_ID_ONLY-TOP_LINE + w_LINE_SEL - 1.
MODIFY T_ZQIDCHECK_DISCH INDEX TC_ID_ONLY-current_line.
If I am selecting single row, I can properly get the selected index via debug.
BUG:
When I'm selecting multiple rows in table control, only the last row is always being read inside the loop of my table control.
Please see the screenshot.
[url]http://img268.imageshack.us/img268/5739/tcselectedrows.jpg[url]
Notice in the debug screenshot, even if it's just in the 1st loop of table control, it automatically gets the 4th table control index, instead of the 2nd one.
Helpful inputs will be appreciated.
Thanks.
Jaime
Edited by: Jaime Cabanban on Dec 9, 2009 3:16 PMHi,
Are you sure that you have selected multiple line for tablecontrol in the property window of the tablecontrol.
Flowlogic.
LOOP WITH CONTROL TC_01.
Module Get_Marked.
ENDLOOP.
Module Pool
Module Get_Marked.
read the data from the internal table where mark = 'X'.
this should give you only selected records.
Endmodule.
Kindly check the tablecontrol property.
Regards,
Ranjith Nambiar -
Table Controls: - Find selected line index
HI,
I have a table control . In tis 4 lines are visible at a time..1 field in this table comntrol is a button.
when the user clicks on a button, the details of the corresponding line should be used to trigger a new screen. If the no of lines in the table control is less than 4( o of visible lines) , i can use get cursor line, to get the index of the line selected. . but if i scrolled down and selected the button in the 15 th line, then get cursor line cannot be used as it will retrieve the no 3. CAn u please give me a solution.
thnx.declare two variables to get line count and line index
data: wrk_linecnt(10),
wrk_lineindx(10).
get cursor line wrk_linecnt.
wrk_lineindx = <table control name>-top_line + wrk_linecnt - 1.
read table <internal table used in table control> index wrk_lineindx. -
BDC for XK02 getting problem in table control.....
hello i want to migrate data for vendor from flat file to SAP.i want to update VAT date and VAT number. but i m not getting how to handle index of table control? coz when we scroll down index get changed......
pls guide me......Hi,
refer the theards for table control index.
https://forums.sdn.sap.com/click.jspa?searchID=12815720&messageID=5466905
https://forums.sdn.sap.com/click.jspa?searchID=12815720&messageID=4290992
Regards
Kiran Sure -
Index of the Table control - No lead selection activated
Hi guys,
I have a table control where there is no lead selection.... One colum of the table contains push button on all rows and I need to find the row id based on the click of the which row button... How to do this???
regards,
PrabhuHi Prabhu ,
write the below piece of code in the button Action .
DATA lo_nd_node_table TYPE REF TO if_wd_context_node.
DATA lo_el_node_table TYPE REF TO if_wd_context_element.
DATA ls_node_table TYPE wd_this->Element_node_table.
* navigate from <CONTEXT> to <NODE_TABLE> via lead selection
lo_nd_node_table = wd_context->get_child_node( name = wd_this->wdctx_node_table ).
CALL METHOD wdevent->get_context_element
EXPORTING
name = 'CONTEXT_ELEMENT'
RECEIVING
value = lo_el_node_table. " getting the clicked line
CALL METHOD lo_nd_node_table->SET_LEAD_SELECTION
EXPORTING
ELEMENT = lo_el_node_table. " Setting the lead
data lv_index type i.
CALL METHOD lo_nd_node_table->GET_LEAD_SELECTION_INDEX
RECEIVING
INDEX = lv_index. " getting the index of the lead line
Hope it will Helpfull .
Regards
Chinnaiya P
Edited by: chinnaiya pandiyan on Jun 28, 2010 12:04 PM -
BDC - How to find line item index in table control?
Hi guys,
I am doing a BDC for VL02N, I am stuck up in positioning the line item index. For example, I have 10 line items, I want to fill quantity for the item 000060 which is in the third line. I am able position the cursor using button for locating item ( ok_code = 'POPO' ), but I could not find the index of the item in the table control, so that I can enter the quantity value as
PERFORM bdc_field USING 'LIPSD-G_LFIMG(03)' '100'.
Any expert to help me on this?Depending on the message the line number might be in one of the fields:
MESSAGE_V1
MESSAGE_V2
MESSAGE_V3
MESSAGE_V4
Although if the message simply is not meant to include the line number, it won't be there. That's the way it is. If there is a user exit available, you may add your custom messages with the line number. In some user exits (in sales order for sure) there is a special variable (flag), which is set when the BAPI runs the transaction. -
Module pool ---Problem in finding the line index for the table control
Hi Friends,
I am working in Module pool programming.
My requirement is when i select any record on the lead selection I need to find out the index of the line on which row i have selected.
Could any one please suggest me the proper solution how to get the line index for the table control in module pool programming.
Thanks
Satish RajuHi Raju,
Follow the steps
<li>U should take one variable in your internal table or in structure which is used for table control fields.
DATA :BEGIN OF itab OCCURS 0 ,
mark TYPE c ,
matnr LIKE mara-matnr ,
matkl LIKE mara-matkl,
maktx LIKE makt-maktx,
END OF itab .
controls: tabc types tableview using screen 100.
<li>This mark variable should be given in Table control properties. follow the path
double click on the table control-->attributes .->select w/SelColumn and in that give itab-mark.
<li>Flow logic of the screen
process before output.
MODULE status_0100.
LOOP AT itab with control tabc
endloop.
process after input.
module cancel at exit-command.
LOOP AT itab.
MODULE read_table_control.
ENDLOOP.
MODULE user_command_0100.
<li>read_table_control module code
MODULE read_table_control INPUT.
MODIFY itab INDEX tabc-current_line."this will update the itab table
"mark field with 'X ' whatever we
"have selected on table control
ENDMODULE.
<li>If you want to Delete some of the records from Table control follow this code u2026Create one pushbutton and give Fucnction code to that and write below code
CASE okcode.
WHEN 'DELETE'.
LOOP AT itab WHERE mark = 'X'.
DELETE itab.
ENDLOOP.
ENDCASE.
I hope that it helps you.
Thanks
Venkat.O -
Highlight dropdown by index in table control in FPM error
Hello,
I have a situation where I would like to point out to a user that they have to maintain a value in a dropdown field in a table control. I am trapping the error situation in the Process_Event method of the FPM in my component,
I would like to raise an FPM error to highlight this to the user. If I do this with a normal input field I can just pass the element and attribute that I want highlighting to the FPM error handler
eg:
wd_this->ao_fpm->mo_message_manager->report_bapiret2_message(
is_bapiret2 = ls_message-message_details
io_component = lo_component
io_element = ls_message-element
iv_attribute_name = ls_message-attribute_name ).
and the field is highlighted and linked to the error.
However, if the field is of a type dropdown by index, I can't seem to get it to highlight. I have tried passing the element that the dropdown text is bound to and the attribute/name of the text field, but this does not work. I even tried passing the child node name as the attribute, and the element as the parent element of the node holding the dropdown list - but unsuprisingly this doesn't work either.
Is there anyway to highlight/link a dropdown by index field to an FPM error message - or is this functionality currently unsupported? Or perhaps I am making a simple mistake somewhere?
Thanks for any suggestions!
Cheers,
ChrisChris Paine wrote:
> Is there anyway to highlight/link a dropdown by index field to an FPM error message - or is this functionality currently unsupported? Or perhaps I am making a simple mistake somewhere?
hi Chris,
As far as i know this functionality is not supported.I have had the same problem earlier. -
DropDown by Index in table control
Hi,
I'm using dropdown by index(i need different values for each row) in my table control and I have this problem:
I have this context binded to my table control:
TABLE_NODE (card. 0..n)
- ATRIB1
- ATRIB2
- DROPDWN_NODE (card. 0..n sel. 0..1) - to this node dropdown by index is binded
- VALUE
- TEXT <-- bind this attribute to Texts property
Dropdown is filled OK, but how to transfer selected dropdown value to ATRIB2? And then, if I have a value in ATRIB2, how to diplay correct text for user in dropdown?
Another thing is that I have 2 dropdowns by value in table and values of second depends on selected value in first. How should I refresh second dropdown by index when user change value in first?
Many thanks for reply.I'm also facing the issue. Can u plz. share the source code.
-
Reg:How to delete the column in table control also from database table.
Hi Experts,
Once again thank u all for giving the responses.
one more doubt is how to delete the columns of table control and also the record shold delete from ztable.
With Regards,
Saroja.P.Hi,
If you want to delete the rows in the table control and simultaneously delete it from the database table, then you can implement a 'DELETE' functionality specific to your table control. Have a MARK field (you will find that in the screen attributes of the table control -> give a name for the MARK field, you will find an additional MARK column at the beginning of your table control). You can check whatever rows you want to delete from the table control, call the delete module.
"This portion of code inside the LOOP...ENDLOOP.
IF sy-ucomm eq 'F_DELETE'.
gt_itab2-check = mark. " Store the MARK field status into your internal table's correspoding field 'check'
MODIFY gt_itab INDEX tabcontrol-current_line.
ENDIF.
iF sy-ucomm eq 'DELETE1'.
DELETE gt_itab WHERE check eq 'X'. "Your internal table does not have rows that you want to delete
ENDIF.
Now you can modify your database table using the MODIFY statement.
MODIFY ZDB FROM TABLE gt_itab. -
How to populate data in table control .
hi all,
i put matnr no. in screen no. 103
validation is done at that screen only.
now when i want to modify dat record
when i put matnr no. at screen 103
so how i will get all data of dat number to table control screen.Hi Darshan,
Here is a detailed description of how to update data in table controll.
Updating data in table control
The ABAP language provides two mechanisms for loading the table control with data from the internal table and then storing the altered rows of the table control back to the internal table.
Method 1: Read the internal table into the Table Control in the screenu2019s flow logic. Used when the names of the Table Control fields are based on fields of the internal table.
Method 2: Read the internal table into the Table Control in the module pool code. Used when the names of the Table Control fields are based on fields of the database table.
Method 1 (table control fields = itab fields)
In the flow logic we can read an internal table using the LOOP statement. Define the reference to the relevant able control by specifying WITH CONTROL <ctrl>
Determine which table entry is to be read by specifying CURSOR <ctrl>-CURRENT_LINE.
After the read operation the field contents are placed in the header line of the internal table. If the fields in the table control have the same name as the internal they will be filled automatically. Otherwise we need to write a module to transfer the internal table fields to the screen fields.
We must reflect any changes the user makes to the fields of the table control in the internal table otherwise they will not appear when the screen is redisplayed after PBO processing, (eg, after the user presses Enter or scrolls) However, this processing should be performed only if changes have actually been made to the screen fields of the table control (hence the use of the ON REQUEST)
PROCESS BEFORE OUTPUT.
LOOP AT ITAB_REG WITH CONTROL TCREG
CURSOR TCREG-CURRENT_LINE.
ENDLOOP.
PROCESS AFTER INPUT.
LOOP AT ITAB_REG.
MODULE MODIFY_ITAB_REG.
ENDLOOP.
MODULE MODIFY_ITAB_REG INPUT.
MODIFY ITAB_REG INDEX TCREG-CURRENT_LINE.
ENDMODULE.
Method 2 (table control fields = dict. fields)
If using a LOOP statement without an internal table in the flow logic, we must read the data in a PBO module which is called each time the loop is processed.
Since, in this case, the system cannot determine the number of internal table entries itself, we must use the EXIT FROM STEP-LOOP statement to ensure that no blank lines are displayed in the table control if there are no more corresponding entries in the internal table.
PROCESS BEFORE OUTPUT.
LOOP WITH CONTROL TCREG.
MODULE READ_ITAB_REG.
ENDLOOP.
PROCESS AFTER INPUT.
LOOP WITH CONTROL TCREG.
CHAIN.
FIELD: ITAB_REG-REG,
ITAB_REG-DESC.
MODULE MODIFY_ITAB_REG
ON CHAIN-REQUEST.
ENDCHAIN.
ENDLOOP.
MODULE READ_ITAB_REG OUTPUT.
READ TABLE ITAB_REG INDEX TCREG-CURRENT_LINE.
IF SY-SUBRC EQ 0.
MOVE-CORRESPONDING ITAB_REREG TO TCREG.
ELSE.
EXIT FROM STEP-LOOP.
ENDIF.
ENDMODULE.
MODULE MODIFY_ITAB_REG INPUT.
MOVE-CORRESPONDING TCREG TO ITAB_REG.
MODIFY ITAB_REG INDEX
TCREG-CURRENT_LINE.
ENDMODULE.
Updating the internal table
Method 1
PROCESS AFTER INPUT.
LOOP AT ITAB_REG.
CHAIN.
FIELD: ITAB_REG-REG,
ITAB_REG-DESC.
MODULE MODIFY_ITAB_REG ON CHAIN-REQUEST.
ENDCHAIN.
ENDLOOP.
MODULE MODIFY_ITAB_REG INPUT.
ITAB_REG-MARK = u2018Xu2019.
MODIFY ITAB_REG INDEX TCREG-CURRENT_LINE.
ENDMODULE.
Method 2
PROCESS AFTER INPUT.
LOOP WITH CONTROL TCREG.
CHAIN.
FIELD: TCREG-REG,
TCREG-DESC.
MODULE MODIFY_ITAB_REG ON CHAIN-REQUEST.
ENDCHAIN.
ENDLOOP.
MODULE MODIFY_ITAB_REG INPUT.
MOVE-CORRESPONDING TCREG TO ITAB_REG.
ITAB_REG-MARK = u2018Xu2019.
MODIFY ITAB_REG INDEX TCREG-CURRENT_LINE.
ENDMODULE.
Updating the database
MODULE USER_COMMAND_100.
CASE OK_CODE.
WHEN u2018SAVEu2019.
LOOP AT ITAB-REG.
CHECK ITAB_REG-MARK = u2018Xu2019.
MOVE-CORRESPONDING ITAB_REG TO TCREG.
UPDATE TCREG.
ENDLOOP.
WHEN u2026
u2026
ENDCASE.
ENDMODULE.
Hope this will solve your problem.
Regards,
Pavan.
Edited by: PAVAN CHANDRASEKHAR GANTI on Aug 3, 2009 12:48 PM -
Validação de campos em um Table Control
Boa tarde.
Gostaria de pedir um auxilio .
Tenho uma duvida, na seguinte situação. Estou construindo um programa de Module Pool
Neste programa vai ter um tabstrip, para atualizar duas tabelas Z
Na primeira u201CABAu201D, serão inseridos os registros da tabela pai e na segunda u201CABAu201D, os registros da tabela
Filho a relação será de 1 para N.
Na tabela filho os campos chaves serão um identificador próprio , mais o registro chave da tabela pai.
Na segunda a aba para inserir os registros da tabela filho, terei que usar um table Control.
O meu problema é que ao inserir os registros na tabela filho, terei que de forma automática preencher o campo que corresponde a chave da tabela pai. Ou seja o usuário na primeira u201Cabau201D digamos digite o código da tabela pai como 10 ao inserir na table Control um registro o campo correspondente a chave da tabela pai devera ser preenchido com o valor 10 e não permitir ao usuário efetuar qualquer manutenção neste campo.
Como eu faço isso???
Alguém tem algum exemplo????
Obrigado a todosOlá, bom dia!
Este é um dessenvolvimento bem específico, talvez por isso ninguem lhe respondeu ainda. Voce já deu uma olhada na seção de Wiki, buscando algum código de exemplo?
Vai alguns links que encontrei:
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/1499ec90-0201-0010-769f-860989655f7e?QuickLink=index&overridelayout=true
http://wiki.sdn.sap.com/wiki/display/sandbox/ModulePoolProgramming
O primeiro link traz um exemplo de como torna um campo ineditavel via codigo. Espero que possa ajudar.
Abraços,
Rodrigo Paisante -
Problem while saveing in Table Control.
Hi
I am geting error while saving data in table control.
This table contol is pop up window at end of screen .
user enter qty & uom in TC..
Error i am getting is...
Field symbol has not been assigned.
Error analysis
The system tried to access an anasigned field symbol (data segment
number 32772).
The field symbol is no longer assigned, because a Unicode program
previously tried to set the field symbol using an ASSIGN statement with
an offset/length declaration. The memory addressed in this offset/length
declaration, however, no longer lay within the valid range.
Information on where terminated
The termination occurred in the ABAP program "SAPLOMCV" in
"CONVERSION_EXIT_MATN1_INPUT".
i Have coded like this..
MODULE USER_COMMAND_0112 INPUT.
CASE OKCODE.
WHEN 'BACK' or 'CANCEL'.
SET SCREEN 0.
This iti is contain data which diplay in TC
when 'DISPLAY'.
LOOP AT ITI.
read table iti with key ingr_code = iti-ingr_code
ingr_desc = iti-ingr_desc.
wka1-ingr_code = iti-ingr_code.
wka1-ingr_desc = iti-ingr_desc.
wka1-conc = iti-conc.
wka1-quantity = iti-quantity.
wka1-uom = iti-uom.
append wka1 to itf.
ENDLOOP.
WHEN 'SAV'.
loop at itf where check = 'x' .
update zacg_ns
set ingr_code = itf-ingr_code
col_name = itf-ingr_desc
conc = itf-conc
quantity = itf-quantity
UOM = itf-UOM
ru = itf-ru
where ingr_code = itf-ingr_code
and col_name = itf-ingr_desc.
zacg_ns-ingr_code = itf-ingr_code.
zacg_ns-col_name = itf-ingr_desc.
zacg_ns-conc = itf-conc.
zacg_ns-quantity = itf-quantity.
zacg_ns-UOM = itf-UOM.
update zacg_ns.
endloop.
leave program.
ENDCASE.
ENDMODULE. " USER_COMMAND_0112 INPUT
MODULE read_table_control INPUT
MODULE read_table_control INPUT.
MODIFY itf INDEX tc-current_line.
ENDMODULE. "read_table_control INPUT
*& Include ZACG_NS_2 *
*& Module STATUS_0111 OUTPUT
text
MODULE STATUS_0111 OUTPUT.
SET PF-STATUS 'ZNEWSHADE'.
SET TITLEBAR 'ZNS'.
ENDMODULE. " STATUS_0111 OUTPUT
*& Module STATUS_0112 OUTPUT
text
MODULE STATUS_0112 OUTPUT.
SET PF-STATUS 'ZTC'.
SET TITLEBAR 'xxx'.
DESCRIBE TABLE itf LINES lines.
tc-lines = lines.
ENDMODULE. " STATUS_0112 OUTPUt
PROCESS BEFORE OUTPUT.
MODULE STATUS_0112.
LOOP at itf WITH CONTROL TC CURSOR tc-current_line.
MODULE TC_PBO .
ENDLOOP.
PROCESS AFTER INPUT.
MODULE CANCEL AT EXIT-COMMAND.
LOOP at itf .
module read_table_control.
ENDLOOP.
MODULE USER_COMMAND_0112.
Can any one help me..Hi,
Did you enter that filed later after creating the table control?
You check in the element list whether for that element u have an entry or not..
Regards,
Nishant -
Module pool - table control - update ztable
hello , i doing a module pool that will have few screens , now i have one screen with a table control that fetch the data from a ztable when screen is call the table control is showing the data and is in grey and no editable i add a pf-status for change that mode i can delete the row from the table control but i don't figure out how update to the ztable when i press save , i wan't too another button for add a new row ( and remain the already in grey ) for add new entrie in the table and update the ztable
pd: sorry for my bad english
this is my code:
TOP:
PROGRAM z_pp_lote_etiquetas MESSAGE-ID zz.
TABLES:zc2p_lote_etique,
zc2p_lider_modul.
DATA: ok_code LIKE sy-ucomm.
DATA save_ok LIKE sy-ucomm.
* internal table
DATA: it_zc2p_lote_etique LIKE STANDARD TABLE OF zc2p_lote_etique.
DATA: it_zc2p_lider_modul TYPE STANDARD TABLE OF zc2p_lider_modul WITH HEADER LINE.
DATA: it_zc2p_lider_modul_del TYPE STANDARD TABLE OF zc2p_lider_modul WITH HEADER LINE.
**************Workarea
DATA: wa_c2p_lote_etique TYPE zc2p_lote_etique.
DATA: wa_c2p_lider_modul TYPE zc2p_lider_modul.
DATA: wa_c2p_lider_modul_del TYPE zc2p_lider_modul.
DATA: sel.
DATA: MARK.
DATA: init.
DATA: col TYPE scxtab_column.
DATA: lines TYPE i.
* Variable Declaration
DATA : flg, "Flag to set the change mode
ln TYPE i. "No. of records
* Table Control Declartion.
CONTROLS: zc2p_lider_crtl TYPE TABLEVIEW USING SCREEN '101'.
**PROCESS BEFORE OUTPUT INCLUDE **
*& Include Z_PP_LOTE_ETIQUETAS_O01
*& Module set_status OUTPUT
* Setting the GUI status
MODULE status_0100 OUTPUT.
SET PF-STATUS 'Z_PP_LOT_ETIQ_MENU'.
SET TITLEBAR 'Z_PP_LOT_ETIQ'.
ENDMODULE. " set_status OUTPUT screen 100
* MODULE status_0101 OUTPUT
* Setting the GUI status
MODULE status_0101 OUTPUT.
SET PF-STATUS 'Z_PP_LOT_ETIQ_ME_101'.
SET TITLEBAR 'Z_PP_LOT_ETIQ'.
* Data retreving
if init is INITIAL.
select * from zc2p_lider_modul into CORRESPONDING FIELDS OF TABLE it_zc2p_lider_modul.
DESCRIBE TABLE it_zc2p_lider_modul LINES ln.
zc2p_lider_crtl-lines = ln + 10.
init = 'X'.
endif.
ENDMODULE. "status_0101 OUTPUT
module change_sdyn_conn output.
* you can change the content of current table control line via
* sdyn_conn
READ TABLE it_zc2p_lider_modul INTO zc2p_lider_modul INDEX zc2p_lider_crtl-current_line.
endmodule. " FILL_TABLE_CONTROL OUTPUT
MODULE set_screen_fields OUTPUT.
LOOP AT SCREEN.
IF flg IS INITIAL.
screen-input = 0.
ELSE.
screen-input = 1.
ENDIF.
*ENDIF.
* Modifying the screen after making changes
MODIFY SCREEN.
ENDLOOP.
ENDMODULE. " set_screen_fields OUTPUT
PROCESS AFTER INPUT INCLUDE.
* MODULE USER_COMMAND_0100 INPUT
MODULE user_command_0100 INPUT.
CASE ok_code.
WHEN 'LIDM'.
CALL SCREEN 101.
WHEN 'CANC'.
LEAVE PROGRAM.
WHEN 'BACK'.
LEAVE PROGRAM.
WHEN 'EXIT'.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. "USER_COMMAND_0100 INPUT
* MODULE USER_COMMAND_0101 INPUT
MODULE user_command_0101 INPUT.
save_ok = ok_code.
CLEAR ok_code.
CASE save_ok.
WHEN 'SORT'.
DATA: fldname(100),help(100).
READ TABLE zc2p_lider_crtl-cols INTO col WITH KEY selected = 'X'.
SPLIT col-screen-name AT '-' INTO help fldname.
SORT it_zc2p_lider_modul BY (fldname).
WHEN 'CHANGE'.
* Setting the flag to make the table control in editable mode[excluding
* primary key].
flg = 'Y'.
WHEN 'BACK'.
CALL SCREEN 100.
LEAVE SCREEN.
WHEN 'CANCEL'.
LEAVE PROGRAM.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN 'SAVE'.
MODIFY zc2p_lider_modul FROM it_zc2p_lider_modul.
COMMIT WORK.
ENDCASE.
ENDMODULE. "USER_COMMAND_0101 INPUT
* MODULE read_table_control INPUT
MODULE read_table_control INPUT.
* Check input values
IF mark = 'X' AND save_ok = 'DELETE'.
DELETE TABLE it_zc2p_lider_modul FROM zc2p_lider_modul.
DESCRIBE TABLE it_zc2p_lider_modul LINES zc2p_lider_crtl-lines.
ENDIF.
ENDMODULE. " READ_TABLE_CONTROL INPUT
Screen Flow Logic 100
PROCESS BEFORE OUTPUT.
MODULE status_0100.
PROCESS AFTER INPUT.
MODULE user_command_0100.
Screen Flow Logic 101.
PROCESS BEFORE OUTPUT.
MODULE status_0101.
LOOP AT it_zc2p_lider_modul INTO zc2p_lider_modul WITH CONTROL
zc2p_lider_crtl.
* Dynamic screen modifications
MODULE set_screen_fields.
MODULE change_sdyn_conn.
ENDLOOP.
PROCESS AFTER INPUT.
MODULE user_command_0101.
LOOP AT it_zc2p_lider_modul.
MODULE read_table_control.
ENDLOOP.
i hope somebody can help for what i missing here thanks>
Sanjeev Kumar wrote:
> Hello Edgar,
>
> Problem seems to be there in the flow logic of 101
>
>
> PROCESS BEFORE OUTPUT.
> MODULE status_0101.
> LOOP AT it_zc2p_lider_modul INTO zc2p_lider_modul WITH CONTROL
> zc2p_lider_crtl. " no need to have 'INTO zc2p_lider_modul' above
> * Dynamic screen modifications
> MODULE set_screen_fields.
> MODULE change_sdyn_conn.
> ENDLOOP.
> *
> PROCESS AFTER INPUT.
> MODULE user_command_0101. "this should be shifted after the following LOOP...ENDLOOP.
>
> LOOP AT it_zc2p_lider_modul. "need to have 'WITH CONTROL zc2p_lider_crtl' here
> MODULE read_table_control.
> ENDLOOP.
>
>
>
> With MODULE user_command_0101 call before the LOOP calls the MODIFY statement (under case save_ok 'SAVE') first and Z-table is updated with the old values as the changes are transferred from screen into the internal table it_zc2p_lider_modul in the LOOP...ENDLOOP later.
>
> Try these changes and I hope it will work.
>
> Thanks
> Sanjeev
i do the firts advice but the second one i get syntax error :
my code :
PROCESS AFTER INPUT.
LOOP at it_zc2p_lider_modul WITH CONTROL zc2p_lider_crtl.
MODULE read_table_control.
ENDLOOP.
MODULE user_command_0101.
error :
In the event PROCESS AFTER INPUT, no additions are allowed with "LOOP
AT". -
Table Control[Accept Input Only] - "ENTER" Key
Hi Folks,
I'm reviving this unanswered thread in relation to table control: when the user press enter, all the values entered disappear.
[url]Re: Table control (Enter key)[url]
I have a table control that accepts "ONLY" input, meaning to say, there will be no pre-loading of data in the PBO, so it will loop through the table control itself instead of looping from an internal table.
Issue: Whenever I press "ENTER" in any column/row of my table control, ALL the values I entered disappear.
PBO:
PROCESS BEFORE OUTPUT.
MODULE CLEAR_OKCODE.
MODULE LOAD_TABLECTRL.
LOOP WITH CONTROL TC_DATA.
MODULE READ_DATA.
ENDLOOP.
module READ_DATA output.
READ TABLE T_DATA INTO WA_DATA INDEX TC_DATA-current_line.
data : line_count type i.
"to increase the number of lines in table control dynamically
describe TABLE t_data lines line_count.
TC_DATA-lines = line_count + 10.
endmodule.
PAI:
PROCESS AFTER INPUT.
LOOP WITH CONTROL TC_DATA.
MODULE MODIFY_DATA.
ENDLOOP.
module MODIFY_DATA input.
WHEN 'CREATE'.
"subroutines are here, etc.
WHEN 'DELETE'.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
endmodule.
In my ABAP Debug, the value of SY-UCOMM is BLANK whenever I press Enter.
Thanks.Hi
Your code seems to be rght only the MODIFY statament is useless:
module READ_DATA output.
READ TABLE T_ID_CHECK INTO WA_ID_CHECK INDEX TC_ID-current_line.
IF SY-SUBRC EQ 0.
ZQID_CHECK-WERKS = WA_ID_CHECK-WERKS.
ZQID_CHECK-MATNR = WA_ID_CHECK-MATNR.
ZQID_CHECK-LICHA = WA_ID_CHECK-LICHA.
ZQID_CHECK-LIFNR = WA_ID_CHECK-LIFNR.
ELSE.
CLEAR ZQID_CHECK.
ENDIF.
endmodule.
Now before LOOP of PBO try to set the lines of table control to be display, I've created this report on my system and it works fine:
.CONTROLS T_CTRL TYPE TABLEVIEW USING SCREEN 100.
DATA: BEGIN OF ITAB OCCURS 0,
WERKS LIKE MARC-WERKS,
MATNR LIKE MARC-MATNR,
LIFNR LIKE LFA1-LIFNR,
END OF ITAB.
DATA: WA LIKE ITAB.
START-OF-SELECTION.
DO 4 TIMES.
ITAB-WERKS = '5010'.
ITAB-MATNR = '1234567890'.
ITAB-LIFNR = '0000000001'.
APPEND ITAB.
ENDDO.
CALL SCREEN 100.
PROCESS BEFORE OUTPUT.
MODULE SET_T_CTRL.
LOOP WITH CONTROL T_CTRL.
MODULE READ_DATA.
ENDLOOP.
PROCESS AFTER INPUT.
LOOP WITH CONTROL T_CTRL.
MODULE MODIFY_DATA.
ENDLOOP.
MODULE SET_T_CTRL OUTPUT.
DESCRIBE TABLE ITAB LINES T_CTRL-LINES.
ENDMODULE. " SET_T_CTRL OUTPUT
MODULE READ_DATA OUTPUT.
READ TABLE ITAB INDEX T_CTRL-CURRENT_LINE.
IF SY-SUBRC = 0.
MOVE-CORRESPONDING ITAB TO WA.
ELSE.
CLEAR WA.
ENDIF.
ENDMODULE. " READ_DATA OUTPUT
MODULE MODIFY_DATA INPUT.
MODIFY ITAB FROM WA INDEX T_CTRL-CURRENT_LINE.
IF SY-SUBRC NE 0.
CHECK NOT WA IS INITIAL.
APPEND WA TO ITAB.
ENDIF.
ENDMODULE. " MODIFY_DATA INPUT
Maybe you are looking for
-
All new files and folders show up as READ ONLY
I am new to the iMac, and am having problems with files an folders. My account is an administrator's account, but when ever I create a new folder, or move a file into it, it shows up as READ ONLY. This is really annoying as I am moving hundreds of fi
-
I have no problem connecting my Motorola H680 Hands free to my 8130, and I can hear the 'operation beeps', but for some reason I can't hear or talk through it. What's up with that?
-
DARKENED CLIP VIEWER.... IS THERE AN ANSWER?
I've spent the past week trying to fix this incredibly annoying problem. The clip viewer in the Final Cut Pro X is DARKENED. I have tried on multiple occasions to recalibrate the screen, color sync, run repair disk, deleted Final Cut Express 4, reins
-
What Dell Laptops are good for 3D Typography in Photoshop CC 2014?
Well the search goes on...my Dell 17 with Intel Pentium ain't cuttin' it! lol My range is $900 - $1100. I'm looking for a Dell Laptop with a 17" monitor and ample processor with enough "dedicated graphics memory" to utilize the 3D features on Photosh
-
Which Point and shoot is best for taking pictures of kids?
I have two kids under the age of 4 and I am in need of a new digital camera. I need a point and shoot that takes a fast picture. My current camera takes a long time and I often miss that perfect picture. Thanks You