2006 Dec 26 10:08 AM
Dear ABAP Experts,
I have a screen with 2 tables fields. 1st table(ZESTHEADER) fields are normal fields in the screen.
2 nd table fileds(ZESTDETAILS) are table control fields in the same screen .
Now i can update the 1st table fields(ZESTHEADER) succesfully But 2 nd table fields(ZESTDETAILS) are not at all updating. please review the below code and let me knwo where iam wrong.
FLOW LOGIC:
PROCESS BEFORE OUTPUT.
loop at itab1 with control VCONTROL CURSOR VCONTROL-CURRENT_LINE.
MODULE STATUS_0100.
endloop.
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0100.
loop at itab1.
endloop.
module mod1.
module user_exit.
CODE:
PROGRAM ZEST_HEADER2 message-id ymsg.
tables: zestheader,zestdetails.
data: itab like zestheader occurs 0 with header line.
data: itab1 like zestdetails occurs 0 with header line.
controls: vcontrol type tableview using screen '100'.
MODULE USER_COMMAND_0100 INPUT.
case sy-ucomm.
when 'ENTR'.
refresh itab.
select * from ZESTHEADER INTO ITAB where ESTMATE_NBR = ZESTHEADER-ESTMATE_NBR.
append itab.
endselect.
if itab is not initial.
refresh itab1.
SELECT * FROM ZESTDETAILS INTO table ITAB1 for all entries in itab wHERE ESTMATE_NBR = itab-ESTMATE_NBR.
select * from zestdetails INTO ITAB1 where ESTMATE_NBR = itab-ESTMATE_NBR.
append itab1.
endselect.
endif.
when 'UPDA'.
move zestheader to itab.
append itab.
update zestheader from table itab.
move-corresponding zestdetails to itab1.
update zestdetails from table itab1.
append itab1.
if sy-subrc eq 0.
message s002(ymsg).
else.
message e003(ymsg).
endif.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'ZESTCHNG'.
SET TITLEBAR 'ZESTCHNG2'.
MOVE-CORRESPONDING ITAB TO ZESTHEADER.
MOVE-CORRESPONDING ITAB1 TO ZESTDETAILS.
ENDMODULE. " STATUS_0100 OUTPUT
MODULE User_exit INPUT.
case sy-ucomm.
when 'EXIT'.
leave program.
endcase.
ENDMODULE. " User_exit INPUT
&----
*& Module mod1 INPUT
&----
text
----
MODULE mod1 INPUT.
ENDMODULE. " mod1 INPUT
Dear ABAP Experts,
I have a screen with 2 tables fields. 1st table(ZESTHEADER) fields are normal fields in the screen.
2 nd table fileds(ZESTDETAILS) are table control fields in the same screen .
Now i can update the 1st table fields(ZESTHEADER) succesfully But 2 nd table fields(ZESTDETAILS) are not at all updating. please review the below code and let me knwo where iam wrong.
FLOW LOGIC:
PROCESS BEFORE OUTPUT.
loop at itab1 with control VCONTROL CURSOR VCONTROL-CURRENT_LINE.
MODULE STATUS_0100.
endloop.
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0100.
loop at itab1.
endloop.
module mod1.
module user_exit.
CODE:
PROGRAM ZEST_HEADER2 message-id ymsg.
tables: zestheader,zestdetails.
data: itab like zestheader occurs 0 with header line.
data: itab1 like zestdetails occurs 0 with header line.
controls: vcontrol type tableview using screen '100'.
MODULE USER_COMMAND_0100 INPUT.
case sy-ucomm.
when 'ENTR'.
refresh itab.
select * from ZESTHEADER INTO ITAB where ESTMATE_NBR = ZESTHEADER-ESTMATE_NBR.
append itab.
endselect.
if itab is not initial.
refresh itab1.
SELECT * FROM ZESTDETAILS INTO table ITAB1 for all entries in itab wHERE ESTMATE_NBR = itab-ESTMATE_NBR.
select * from zestdetails INTO ITAB1 where ESTMATE_NBR = itab-ESTMATE_NBR.
append itab1.
endselect.
endif.
when 'UPDA'.
move zestheader to itab.
append itab.
update zestheader from table itab.
move-corresponding zestdetails to itab1.
update zestdetails from table itab1.
append itab1.
if sy-subrc eq 0.
message s002(ymsg).
else.
message e003(ymsg).
endif.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'ZESTCHNG'.
SET TITLEBAR 'ZESTCHNG2'.
MOVE-CORRESPONDING ITAB TO ZESTHEADER.
MOVE-CORRESPONDING ITAB1 TO ZESTDETAILS.
ENDMODULE. " STATUS_0100 OUTPUT
MODULE User_exit INPUT.
case sy-ucomm.
when 'EXIT'.
leave program.
endcase.
ENDMODULE. " User_exit INPUT
&----
*& Module mod1 INPUT
&----
text
----
MODULE mod1 INPUT.
ENDMODULE. " mod1 INPUT
2006 Dec 26 11:11 AM
Hi Ramesh,
For performance : Change the code.
1. select * from ZESTHEADER INTO table ITAB
where ESTMATE_NBR = ZESTHEADER-ESTMATE_NBR.
2. if itab is not initial.
refresh itab1.
SELECT * FROM ZESTDETAILS INTO table ITAB1
for all entries in itab wHERE ESTMATE_NBR = itab-ESTMATE_NBR.
append itab1. No need of append itab1 here.
3.This part i am not able to under stand.
when 'UPDA'.
move zestheader to itab.
append itab.
Above code by writing move zestheader to itab" how data will move from database table"
**************************
***In below code without loop how you are moving data to internal table itab1.
update zestheader from table itab.
move-corresponding zestdetails to itab1.
update zestdetails from table itab1.
append itab1.
if sy-subrc eq 0.
message s002(ymsg).
else.
message e003(ymsg).
endif.
I think you have not pasted full code
2006 Dec 27 11:06 AM
i checked your coding ,just try this.
when 'UPDA'.
move zestheader to itab.
append itab.
update zestheader from table itab.
move-corresponding zestdetails to itab1.
append itab1.
update zestdetails from itab1.
if sy-subrc eq 0.
message s002(ymsg).
else.
message e003(ymsg).
endif.
follow this one.in this i updated lfa1.
WHEN 'UPDA'.
MOVE LFA1 TO ITAB.
APPEND ITAB.
UPDATE LFA1 FROM ITAB.
IF SY-SUBRC = 0.
MESSAGE I000(0) WITH 'updated'.
ELSE.
MESSAGE E001(0) WITH 'not updated'.
ENDIF.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |