‎2013 Jan 17 11:26 AM
Hi Everyone,
I need to save the data entered in the table control to a ZTable, but the internal table is always blank in the 'SAVE' function
I have gone through many forums and tried many options but nothing works.
I have used Wizard for Table Control and table control is created using table from program.
Stuck with this problem since two days, and tomorrow is deadline.
Please help.
Thanks.
Regards,
Ashu
‎2013 Jan 17 12:25 PM
Hi,
In PAI You may have written LOOP with control Table_control. Are you appending data into internal here ? Then the internal table should not be blank.
When you create a entry in the table control in which internal table data is put in ?
Let me know if additional info is required.
Thanks,
Tooshar Bendale
‎2013 Jan 17 12:25 PM
Hi,
In PAI You may have written LOOP with control Table_control. Are you appending data into internal here ? Then the internal table should not be blank.
When you create a entry in the table control in which internal table data is put in ?
Let me know if additional info is required.
Thanks,
Tooshar Bendale
‎2013 Jan 17 12:33 PM
hello,
in pbo,
loop at it with control TC cursor TC-CURRENT_line.
endloop.
in pai,
loop at it.
endloop.
Thanks
Sabyasachi
‎2013 Jan 17 12:42 PM
‎2013 Jan 17 12:47 PM
If you have written anywhere code to clear the internal table used for table control remove it.
thanks.
‎2013 Jan 17 12:57 PM
Thanks for the replies everyone.
I have not changed anything in the generated code.
PBO:
LOOP AT ITAB
INTO WA
WITH CONTROL TC
CURSOR TC-CURRENT_LINE.
ENDLOOP.
PAI:
LOOP AT ITAB.
CHAIN.
FIELD WA-Field1.
FIELD WA-Field2.
.....
MODULE DATA_MODIFY ON CHAIN-REQUEST.
endchain.
ENDLOOP.
***********************************************
MODULE data_modify INPUT.
MODIFY itab
FROM wa
INDEX TC-current_line.
ENDMODULE. "DATA_MODIFY INPUT
************************************************
Do i need to modify the module "data_modify" since it is only modifying the table.
The wizard did not generate anything for SAVE.
Regards,
Ashu
‎2013 Jan 17 1:11 PM
The data base table is not changed if you just change the internal table in table control.
to change ztable write the code in PAI in the module user_command.
case ok_code.
when 'SAVE'.
modify ztable from table inttable.
endcase.
thanks.
‎2013 Jan 17 1:40 PM
Thanks for the help.
I am getting the data in internal table after I modified the statement
MODIFY itab
FROM wa
INDEX TC-current_line.
to
APPEND wa to itab
Actually my requirement is to
1. insert new records in the Z Table if no records exist for the Key
2. delete the existing records and insert updated records if any record exist for the Key
Any idea how to tackle this problem?
Thanks a lot.
Regards,
Ashu
‎2013 Jan 17 4:20 PM
modify ztable from table inttable. this statement would do the same thing
‎2014 Jan 24 12:35 PM
Dear Aswatha ji
M also struck with same problem....
m using concept mentioned by u..
but i m facing problem in data declaration.....
m using this logic:-
in pai
loop at <table control> into <wa>.
append <wa> into <itab>.
endloop.
place one button into ur screen
ex: case sy-ucomm.
when 'SAVE'.
MODIFY <DBNAME> FROM TABLE <ITAB> ACCEPTING DUPLICATE KEYS.
ENDCASE.
kindly help me in data declaration if m using
CONTROLS: TABD TYPE TABLEVIEW USING SCREEN 0100
TABLES: ZTEMP..
Thanks
Sehgal
‎2014 Jan 24 4:14 PM
Hi Aseem,
if you are using
MODIFY <DBNAME> FROM TABLE <ITAB> ACCEPTING DUPLICATE KEYS.
then you should declare the itab as the same type of DBNAME
data: itab type standard table of DBNAME.
or use table type of DBNAME directly.
If here is not where you are facing problems then let use know where exactly you are facing problems.
regards,
Aswath.
‎2014 Jan 27 12:36 PM
Hello sir
i m bit confused..
can u plz give me some sample code of this...
m using following :-
TABLES: ZTEMP
TYPES: BEGIN OF T_TABD,
MANDT LIKE ZTEMP-MANDT,
COR_CODE LIKE ZTEMP-COR_CODE,
ORDERNUMBER LIKE ZTEMP-ORDERNUMBER,
ORDERDATE LIKE ZTEMP-ORDERDATE,
ORDERTYPE LIKE ZTEMP-ORDERTYPE,
INV_NO LIKE ZTEMP-INV_NO,
INV_DATE LIKE ZTEMP-INV_DATE,
MARK LIKE ZTEMP-MARK,
END OF T_TABD.
DATA: G_TABD_ITAB TYPE T_TABD OCCURS 0,
G_TABD_WA TYPE T_TABD. "work area
CONTROLS: TABD TYPE TABLEVIEW USING SCREEN 0100.
.........
...........
MODULE TABD_INIT OUTPUT.
IF G_TABD_COPIED IS INITIAL.
*&SPWIZARD: COPY DDIC-TABLE 'ZTEMP'
*&SPWIZARD: INTO INTERNAL TABLE 'g_TABD_itab'
SELECT * FROM ZTEMP
INTO CORRESPONDING FIELDS
OF TABLE G_TABD_ITAB
WHERE ORDERNUMBER IN ORDNMBR
AND ORDERDATE IN ORDDATE
AND DELV_NO NE 'ABC'
AND INV_NO NE ' DEF'
AND LAST_DOC EQ ''...
G_TABD_COPIED = 'X'.
SORT G_TABD_ITAB BY ORDERNUMBER ORDERDATE.
REFRESH CONTROL 'TABD' FROM SCREEN '0100'.
ENDIF.
ENDMODULE.
.............................
...............................
MODULE USER_COMMAND_0100 INPUT.
CASE sy-ucomm.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN 'PROCESS'.
READ TABLE G_TABD_ITAB INTO G_TABD_WA WITH KEY MARK = 'X'.
???????????????
?????????????????
ENDCASE.
ENDMODULE.
KINDLY GUIDE ME AS TOMORROW IS DEADLINE...
Thanks
Sehgal
‎2014 Jan 27 1:18 PM
Hey tell me where exactly you are facing problem and what is the problem. so that we can analyze..
Regards,
Aswath.
‎2014 Jan 28 6:12 AM
Dear Sir
my requirement is dat whenever i get output in my table control wizard i want to give user option to modify dat data which in turn effect database table ZTEMP.
m using button "PROCESS" for this thing...i want u to give me code for "PROCESS".
e.g. there is field in table ZTEMP named ORDERDATE...
my program give output value in this field of table wizard 27.01.2014.
i want to give user option to change this date to 28.01.2014 or any date whenever he press "PROCESS" pushbutton...
Can u plz give me ur mail id so dat i can elaborate u my requirement....
Thanks
Sehgal
‎2014 Jan 28 7:31 AM
You can use this method that you are already using.
When process.
* if you are editing single line use Read table but if you editing then use loop at G_TABD_ITAB.
*if you are editing multiple lines.
Loop at G_TABD_ITAB into workarea where mark = 'X'.
* create a work area of your Z table say WA_ZTEMP.
* copy all the necessary fields from workarea into WA_ZTEMP.
MODIFY ZTEMP from wa_ztemp.
* If you have declared an internal table of type ZTEMP then append wa_ztemp to that table and after loop
* use the modify statement as below.
Modify Ztemp from table IT_ZTEMP.
If you are editing single line then use READ table as you are using now.
then copy all fields necessary into WA_ZTEMP from workarea or table control.
then use
MOdify ZTEMP from WA_ZTEMP.
this should work..
‎2014 Jan 28 9:33 AM
Dear Sir
as per ur guidance i m using following code but it is not working..
Kindly guide me where i m lacking.
TABLES: ZTEMP.
CONTROLS: TABD TYPE TABLEVIEW USING SCREEN 0100.
DATA: G_TABD_ITAB TYPE T_TABD OCCURS 0,
G_TABD_WA TYPE T_TABD. "work area
DATA:BEGIN OF ITAB OCCURS 0.
INCLUDE STRUCTURE ZTEMP.
DATA END OF ITAB.
DATA:WA_ZTEMP LIKE LINE OF ITAB.
MODULE TABD_INIT OUTPUT.
IF G_TABD_COPIED IS INITIAL.
*&SPWIZARD: COPY DDIC-TABLE 'ZTEMP'
*&SPWIZARD: INTO INTERNAL TABLE 'g_TABD_itab'
SELECT * FROM ZTEMP
INTO CORRESPONDING FIELDS
OF TABLE G_TABD_ITAB
WHERE ORDERNUMBER IN ORDNMBR
AND ORDERDATE IN ORDDATE.
G_TABD_COPIED = 'X'.
SORT G_TABD_ITAB BY ORDERNUMBER ORDERDATE.
REFRESH CONTROL 'TABD' FROM SCREEN '0100'.
ENDIF.
ENDMODULE.
MODULE USER_COMMAND_0100 INPUT.
CASE sy-ucomm.
WHEN 'PROCESS'.
READ TABLE G_TABD_ITAB INTO G_TABD_WA WITH KEY MARK = 'X'.
SELECT * FROM ZTEMP INTO ITAB WHERE ORDERNUMBER = G_TABD_WA-ORDERNUMBER.ENDSELECT.
Loop at ITAB into WA_ZTEMP.
ENDLOOP.
MODIFY ZTEMP FROM WA_ZTEMP.
COMMIT WORK.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
ENDCASE.
ENDMODULE.
Thanks
Sehgal
‎2014 Jan 29 7:13 AM
Hey You have written it wrong.
WHEN PROCESS.
READ TABLE G_TABD_ITAB INTO G_TABD_WA WITH KEY MARK = 'X'.
MODIFY ZTEMP FROM WA_ZTEMP.
COMMIT WORK.
the above code is incase if you are allowing to choose only one record.
If you are allowing to choose multiple records then .
CLEAR IT_TABD_TEMP[].
LOOP AT G_TABD_ITAB INTO G_TABD_WA WHERE MARK = 'X'.
APPEND G_TBAD_WA TO IT_TABD_TEMP.
ENDLOOP.
MODIFY ZTEMP FROM TABLE IT_TABD_TEMP.
this is the way you have to do it.
‎2013 Jan 18 5:36 AM