‎2007 Jun 26 11:54 AM
hi ..
i created a table control. it has no error , problem is when i press enter button cursor is not moving to next line and data is not entering the database. please correct my mistake. please.
flow logic
PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
loop with control table-att.
MODULE tabc_move.
endloop.
*
PROCESS AFTER INPUT.
module leave_screen.
loop with control table-att.
MODULE USER_COMMAND_0100.
endloop.
&----
*& Report ZPR_TEST02 *
*& *
&----
*& *
*& *
&----
REPORT ZPR_TEST02.
tables : zpr_table.
controls table_att type tableview using screen 100.
data : begin of itab occurs 0.
include structure zpr_table.
data : end of itab.
data : itab1 like itab.
call screen 100.
&----
*& Module STATUS_0100 OUTPUT
&----
text
----
module STATUS_0100 output.
SET PF-STATUS 'BACK_100'.
SET TITLEBAR 'xxx'.
endmodule. " STATUS_0100 OUTPUT
&----
*& Module leave_screen OUTPUT
&----
text
**----
**
*module leave_screen output.
*
*leave program.
*endmodule. " leave_screen OUTPUT.
&----
*& Module USER_COMMAND_0100 INPUT
&----
text
----
data : ok_code type sy-ucomm.
module USER_COMMAND_0100 input.
data : line type sy-loopc.
data : ploop type n.
TYPE-POOLS:cxtab.
DATA l_lines_name LIKE feld-name.
DATA l_selline LIKE sy-stepl.
DATA l_lastline TYPE i value '0'.
DATA l_line TYPE i.
DATA l_table_name LIKE feld-name.
data l_name type n.
data : tc type cxtab_control.
FIELD-SYMBOLS: <tc> TYPE cxtab_control.
FIELD-SYMBOLS <table> TYPE STANDARD TABLE.
FIELD-SYMBOLS <lines> TYPE i.
data : l_new_line type i.
loop at screen.
case sy-ucomm.
when ok_code.
GET CURSOR LINE l_selline.
if l_selline <> 0.
l_selline = tc-lines + 1.
else.
set cursor field zpr_table-name line l_selline.
itab-name = zpr_table-name.
itab-age = zpr_table-age.
append itab.
tc-top_line = tc-top_line + 1.
endif.
endcase.
endloop.
CALL FUNCTION 'SCROLLING_IN_TABLE'
EXPORTING
ENTRY_ACT = tc-top_line
ENTRY_FROM = 1
entry_to = tc-lines
LAST_PAGE_FULL = 'X'
loops = line
OK_CODE = 'ok_code'
OVERLAPPING = 'x'
PAGE_ACT = 0
PAGE_GO = 0
IMPORTING
ENTRIES_SUM =
ENTRY_NEW = l_new_line
PAGES_SUM =
PAGE_NEW =
EXCEPTIONS
NO_ENTRY_OR_PAGE_ACT = 1
NO_ENTRY_TO = 2
NO_OK_CODE_OR_PAGE_GO = 3
OTHERS = 0.
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
tc-top_line = l_new_line.
endmodule. " USER_COMMAND_0100 INPUT
&----
*& Module tabc_move OUTPUT
&----
text
----
module tabc_move output.
MOVE-CORRESPONDING itab TO zpr_table.
endmodule. " tabc_move OUTPUT
‎2007 Jun 26 1:04 PM
Hi,
Could you please the code after PAI.
You written all the code in else part only .Due this set cursor field will not work.
I think you were faceing problem there.
Please try to change this , since the cursor should set use <b>set cursor field</b> , which is not possible because of else part.
Regards,
Satya
‎2007 Jun 26 1:04 PM
Hi,
Could you please the code after PAI.
You written all the code in else part only .Due this set cursor field will not work.
I think you were faceing problem there.
Please try to change this , since the cursor should set use <b>set cursor field</b> , which is not possible because of else part.
Regards,
Satya
‎2007 Jun 27 11:37 AM
This code will help you to save the internal table value to database only
PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
LOOP AT ITAB WITH CONTROL TABLE-ATT.
MODULE MOVE-DATA-TO-SCREEN.
ENDLOOP
*
PROCESS AFTER INPUT.
module leave_screen.
LOOP AT ITAB.
MODULE MOVE-DATA-FROM-SCREEN.
ENDLOOP.
----
Report ZPR_TEST02.
----
&----
*& Module MOVE-DATA-TO-SCREEN OUTPUT
&----
Text
----
MODULE MOVE-DATA-TO-SCREEN OUTPUT.
TABLES : zpr_table.
controls table_att type tableview using screen 100.
DATA: ITAB LIKE ZPR_TABLE OCCURS 0 WITH HEADER LINE.
data : itab1 like itab.
MOVE-CORRESPONDING ITAB TO ZPR_TABLE.
ENDMODULE. "MOVE-DATA-TO-SCREEN OUTPUT
----
Report ZPR_TEST02.
----
&----
*& Module MOVE-DATA-FROM-SCREEN INPUT
&----
Text
----
MODULE MOVE-DATA-FROM-SCREEN INPUT.
IF OK_CODE = 'ENTER'.
READ TABLE ITAB INDEX TABLE_ATT-CURRENT_LINE.
MOVE-CORRESPONDING ZITEM_RFQ TO ITAB_ITEM.
IF SY-SUBRC = 0.
MODIFY ITAB INDEX SY-TABIX.
ELSE.
APPEND ITAB.
ENDIF.
ENDIF.
IF USEFULL GIVE REWARDED POINTS
‎2007 Jun 27 12:37 PM
hi Prajwal,
In PAI, make it like this,
DATA : ITAB2 LIKE Zxxx OCCURS 0 WITH HEADER LINE,
CONTROLS : TB TYPE TABLEVIEW USING SCREEN 1002.
&----
*& Module USER_COMMAND_1002 INPUT
&----
text
----
MODULE USER_COMMAND_1002 INPUT.
READ TABLE ITAB2 INDEX TB-CURRENT_LINE.
MOVE-CORRESPONDING Zxxx TO ITAB2.
IF SY-SUBRC = 0.
MODIFY ITAB2 INDEX SY-TABIX.
ELSE.
APPEND ITAB2.
ENDIF.
LOOP AT ITAB2.
MOVE-CORRESPONDING ITAB2 TO ZSEN_ME41_01.
INSERT ZSEN_ME41_01.
ENDLOOP.
ENDMODULE. " USER_COMMAND_1002 INPUT
if its useful reward the points.
Thanks
senthil
‎2007 Jun 28 4:24 AM
Hi ...
please se the below link ...here it was given with
screen shot of the table control creation and there code ...probabily the module which you have written for the Enter code was not in the correct place ....
see sample code of it ...
PROCESS BEFORE OUTPUT.
* MODULE STATUS_0100.
module data_retrieval.
loop at it_ekko into wa_ekko with control TC100.
module populate_screen.
endloop.
*
PROCESS AFTER INPUT.
loop at it_ekko.
endloop.
* MODULE USER_COMMAND_0100.
MODULE data_retrieval OUTPUT.
* select data from ekko table
SELECT ebeln bukrs bstyp bsart
bsakz loekz statu aedat UP TO 10 ROWS FROM ekko
INTO CORRESPONDING FIELDS OF TABLE it_ekko.
ENDMODULE. " data_retrieval OUTPUT
MODULE populate_screen OUTPUT.
DATA: ld_line TYPE i.
* Set which line of table is a top of displayed table control
IF sy-stepl = 1.
tc100-lines = tc100-top_line + sy-loopc - 1.
ENDIF.
* move fields from work area to scrren fields
MOVE-CORRESPONDING wa_ekko TO ztc_ekko.
ENDMODULE. " populate_screen OUTPUT
<a href="http://">http://www.sapdevelopment.co.uk/dialog/tabcontrol/tc_basic.htm</a>
reward points if it is usefull ..
Girish
‎2007 Jun 28 8:11 AM