2014 Jan 30 6:30 AM
Hi All,
i am working in module pool, now i gets a problem at one point.
When i fills my data in table control in module pool and presses
enter, it disappears. i have searched various threads on scn
but still not able to solve my problem, here is my code
please sujjest me the solution.
PROCESS BEFORE OUTPUT.
MODULE DISPLAY.
MODULE SELECT_RECORDS.
*&SPWIZARD: PBO FLOW LOGIC FOR TABLECONTROL 'TBC_ESC'
MODULE TBC_ESC_CHANGE_TC_ATTR.
*&SPWIZARD: MODULE TBC_ESC_CHANGE_COL_ATTR.
LOOP AT IT_FINAL
INTO WA_FINAL
WITH CONTROL TBC_ESC
CURSOR TBC_ESC-CURRENT_LINE.
MODULE TBC_ESC_GET_LINES.
*&SPWIZARD: MODULE TBC_ESC_CHANGE_FIELD_ATTR
ENDLOOP.
MODULE STATUS_9000.
PROCESS AFTER INPUT.
CHAIN.
MODULE EXIT.
ENDCHAIN.
*&SPWIZARD: PAI FLOW LOGIC FOR TABLECONTROL 'TBC_ESC'
LOOP AT IT_FINAL.
CHAIN.
FIELD WA_FINAL-DES.
FIELD WA_FINAL-MATERIAL.
FIELD WA_FINAL-CODE.
MODULE TBC_ESC_MODIFY ON CHAIN-REQUEST.
endchain.
FIELD WA_FINAL-WERKS
* MODULE TBC_ESC_MODIFY ON CHAIN-REQUEST.
MODULE TBC_ESC_MARK ON REQUEST.
ENDLOOP.
MODULE TBC_ESC_USER_COMMAND.
*&SPWIZARD: MODULE TBC_ESC_CHANGE_TC_ATTR.
*&SPWIZARD: MODULE TBC_ESC_CHANGE_COL_ATTR.
MODULE USER_COMMAND_9000.
2014 Jan 31 9:46 AM
Hi All,
got my problem at some extent, let me explain.
In user_command input
i have declared like this
WHEN 'ENTER'.
PERFORM DISP_DATA.
in form disp_data, i have written my code as shown below
FORM DISP_DATA .
SELECT MANDT SNO MATERIAL
FROM ZESC_MATERIAL
INTO TABLE IT_FINAL.
ENDFORM.
Thats why, it was showing only material and sno on pressing enter.
Now if i am taking weightedge also, into consideration, still it is showing blank on enter (when no data
for weightedge).
Now, please sujjest me, what can i do when i puts data in weightedge, and press enter
it should not gets disappeared.
Hi All,
got my problem at some extent, let me explain.
In user_command input
i have declared like this
WHEN 'ENTER'.
PERFORM DISP_DATA.
in form disp_data, i have written my code as shown below
FORM DISP_DATA .
SELECT MANDT SNO MATERIAL
FROM ZESC_MATERIAL
INTO TABLE IT_FINAL.
ENDFORM.
Thats why, it was showing only material and sno on pressing enter.
Now if i am taking weightedge also, into consideration, still it is showing blank on enter (when no data
for weightedge).
Now, please sujjest me, what can i do when i puts data in weightedge, and press enter
it should not gets disappeared.
2014 Jan 30 6:44 AM
Hello Shweta.
Why have you commented this? This module updates the table control data into internal table which will ultimately displayed back via table control.
* MODULE TBC_ESC_MODIFY ON CHAIN-REQUEST.
Regards.
2014 Jan 30 7:04 AM
Hi Arun,
i have already put it into chain..endchain
so commented outside it.
Is it wrong ?
2014 Jan 30 8:12 AM
Ok. Didn't see it properly.
* Have you set Input field attribute for that field?
* Have you declared that field name correctly?
* If that data which you are entering is new data to be inserted into internal table,
then you have write code inside the module MODULE TBC_ESC_MODIFY ON CHAIN-REQUEST to APPEND data.
For instance,
MODULE TBC_ESC_MODIFY ON CHAIN-REQUEST.
MODIFY IT_FINAL from WA_FINAL INDEX TBC_ESC-CURRENT_LINE.
if sy-subrc <> 0.
"Write the logic to APPEND DATA to internal table IT_FINAL.
endif.
ENDMODULE.
Regards.
2014 Jan 31 7:26 AM
Hi Arun,
when i have written according to you as shown below, it is giving me error as
"MODIFY is only allowed with LOOP AT <database table> and in PAI. "
When i puts it inside loop , it gives again error
PROCESS AFTER INPUT.
LOOP AT IT_FINAL.
CHAIN.
FIELD WA_FINAL-SNO.
FIELD WA_FINAL-DESCRIPTION.
FIELD WA_FINAL-WERKS.
FIELD WA_FINAL-WEIGHTEDGE.
MODULE TBC_ESC_MODIFY ON CHAIN-REQUEST.
MODIFY IT_FINAL FROM WA_FINAL INDEX TBC_ESC-CURRENT_LINE.
IF SY-SUBRC <> 0.
APPEND WA_FINAL TO IT_FINAL.
ENDIF.
endchain.
FIELD WA_FINAL-SEL
MODULE TBC_ESC_MARK ON REQUEST.
ENDLOOP.
MODULE TBC_ESC_USER_COMMAND.
*&SPWIZARD: MODULE TBC_ESC_CHANGE_TC_ATTR.
*&SPWIZARD: MODULE T
2014 Jan 31 8:24 AM
Shweta,
You have to write that code inside the module TBC_ESC_MODIFY.
For instance,
MODULE TBC_ESC_MODIFY INPUT.
MODIFY IT_FINAL FROM WA_FINAL INDEX TBC_ESC-CURRENT_LINE.
if sy-subrc <> 0.
APPEND WA_FINAL TO IT_FINAL.
endif.
ENDMODULE.
Regards.
2014 Jan 30 6:51 AM
Best way for solving this kind of problem is Put a break point in your PAI and debug, check where your internal table is getting cleared..
2014 Jan 30 7:07 AM
Hi shweta,
Best way is to debug the program.. Try to keep break points inside PAI and PBO. In some place you would have cleared the data.
You would arrive at the solutions once you debug thoroughly.
Regards,
Sivaganesh
2014 Jan 30 7:39 AM
Hi all,
i am not getting how to correct it, when i puts BREAK POINT,
it gives error.
Please tell me what can i do ?
2014 Jan 30 8:04 AM
save and activate your program and then place a break point..
2014 Jan 30 7:46 AM
hi,
Inside module TBC_ESC_MODIFY add below code,
describe table it_final lines w_lines.
if tbc-current_line > w_lines.
append wa_final to it_final.
else.
modify it_final from wa_final index tbc-current_line.
endif.
Regards,
Praveen Savanth N
2014 Jan 30 11:01 AM
Hi Praveen,
i have written these code as sujjested by you, but getting error that "Statement "DESCRIBE" is not defined. Check your spelling."
MODULE TBC_ESC_MODIFY ON CHAIN-REQUEST.
DESCRIBE TABLE IT_FINAL LINES W_LINES.
IF TBC-CURRENT_LINE > W_LINES.
APPEND WA_FINAL TO IT_FINAL.
ELSE .
MODIFY IT_FINAL FROM WA_FINAL INDEX TBC-CURRENT_LINE.
ENDIF.
ENDIF.
endchain.
FIELD WA_FINAL-SEL
2014 Jan 30 11:10 AM
Hi Shweta,
Please check I think you have not declared w_lines variable.
Regards,
2014 Jan 31 6:10 AM
Hi Praveen,
i am declaring w_lines as shown below, but it is giving me error as "
Statement "DATA" is not defined. Check your spelling. "
Please tell me how could i solve this
PROCESS AFTER INPUT.
DATA : W_LINES TYPE TLINE.
LOOP AT IT_FINAL.
CHAIN.
FIELD WA_FINAL-SNO.
FIELD WA_FINAL-DESCRIPTION.
FIELD WA_FINAL-WERKS.
FIELD WA_FINAL-WEIGHTEDGE.
MODULE TBC_ESC_MODIFY ON CHAIN-REQUEST.
DESCRIBE TABLE IT_FINAL LINES W_LINES.
IF TBC-CURRENT_LINE > W_LINES.
APPEND WA_FINAL TO IT_FINAL.
ELSE .
MODIFY IT_FINAL FROM WA_FINAL INDEX TBC-CURRENT_LINE.
ENDIF.
ENDIF.
endchain.
FIELD WA_FINAL-SEL
MODULE TBC_ESC_MARK ON REQUEST.
ENDLOOP.
MODULE TBC_ESC_USER_COMMAND.
2014 Jan 31 6:15 AM
Hi,
On screen logic flow , you can't use data statement. Double click on a module. Inside the module, put data statement.
Kindly take the help of your colleagues to sort out the issue. Otherwise see the logic in Program 'DEMO_DYNPRO_TABLE_CONTROL_1' & 'DEMO_DYNPRO_TABLE_CONTROL_2' .
Also, on net you will find lot of information on module pool table control.
Regards,
DPM
2014 Jan 31 6:17 AM
Hi Shweta Chouhan,
You cannot declare variable like the above.. Please do declare it in top include .
2014 Jan 31 6:40 AM
Hi,
i don't have any colleagues to talk, so i am worried about it.
And i have seen many threads, but not able to solve it.
2014 Jan 31 8:14 AM
PROCESS AFTER INPUT.
DATA : W_LINES TYPE TLINE.
LOOP AT IT_FINAL.
CHAIN.
FIELD WA_FINAL-SNO.
FIELD WA_FINAL-DESCRIPTION.
FIELD WA_FINAL-WERKS.
FIELD WA_FINAL-WEIGHTEDGE.
MODULE TBC_ESC_MODIFY . ON CHAIN-REQUEST.
DESCRIBE TABLE IT_FINAL LINES W_LINES.
IF TBC-CURRENT_LINE > W_LINES.
APPEND WA_FINAL TO IT_FINAL.
ELSE .
MODIFY IT_FINAL FROM WA_FINAL INDEX TBC-CURRENT_LINE.
ENDIF.
ENDIF.
endchain.
FIELD WA_FINAL-SEL
MODULE TBC_ESC_MARK ON REQUEST.
ENDLOOP.
MODULE TBC_ESC_USER_COMMAND.
**********Double click on Module TBC_ESC_MODIFY and insert the following code********
MODULE TBC_ESC_MODIFY.
MODIFY IT_FINAL FROM WA_FINAL INDEX TBC-CURRENT_LINE.
ENDMETHOD.
2014 Jan 31 8:46 AM
Hi Debopriyo,
i have done what you have shown, but still it disappears after enter.
2014 Jan 31 8:52 AM
HI,
I have written this inside MODULE TBC_ESC_MODIFY ON CHAIN-REQUEST.
But still it disappears after ENTER
MODULE TBC_ESC_MODIFY INPUT.
MODIFY IT_FINAL
FROM WA_FINAL
INDEX TBC_ESC-CURRENT_LINE.
DESCRIBE TABLE IT_FINAL LINES W_LINES.
IF TBC_ESC-CURRENT_LINE > W_LINES.
APPEND WA_FINAL TO IT_FINAL.
ELSE.
MODIFY IT_FINAL FROM WA_FINAL INDEX TBC_ESC-CURRENT_LINE.
ENDIF.
ENDMODULE.
2014 Jan 31 8:57 AM
Don't use work area in PAI. Replace WA_FINAL by IT_FINAL. It should work.
LOOP AT IT_FINAL.
CHAIN.
FIELD IT_FINAL-SNO.
FIELD IT_FINAL-DESCRIPTION.
FIELD IT_FINAL-WERKS.
FIELD IT_FINAL-WEIGHTEDGE.
MODULE TBC_ESC_MODIFY .
endchain.
FIELD IT_FINAL-SEL
MODULE TBC_ESC_MARK ON REQUEST.
ENDLOOP.
MODULE TBC_ESC_MODIFY.
MODIFY IT_FINAL INDEX TBC-CURRENT_LINE.
ENDMETHOD.
2014 Jan 31 9:25 AM
Hi
if i will not provide work area, it is giving error, to "it_final has no header line"
if i will add a header line then, then my table control will not work.
2014 Jan 31 9:49 AM
LOOP AT IT_FINAL.
CHAIN.
FIELD WA_FINAL-SNO.
FIELD WA_FINAL-DESCRIPTION.
FIELD WA_FINAL-WERKS.
FIELD IWA_FINAL-WEIGHTEDGE.
MODULE TBC_ESC_MODIFY .
endchain.
FIELD IT_FINAL-SEL
MODULE TBC_ESC_MARK ON REQUEST.
ENDLOOP.
MODULE TBC_ESC_MODIFY.
data : wa_final like line of it_final.
READ TABLE IT_FINAL INTO wa_final1 WITH KEY SNO = WA_FINAL-SNO.
if sy-subrc = 0.
APPEND IT_FINAL FROM WA.
ELSE.
MODIFY IT_FINAL FROM WA INDEX TBC-CURRENT_LINE.
ENDIF.
ENDMETHOD.
2014 Jan 30 7:53 AM
Hi,
It seems you are not filling the internal table in PBO. ( Use append statement to fill the itab ; loop at statement in PBO, processes each line displayed- one by one; you need to use append statement to store the displayed line in the internal table ). After filling the itab - ( Loop at itab statement in PAI does validation on individual fields of the records sequentially ).
Also, before appending make sure that entry does not exist in itab. Otherwise it will see duplicate records.
Regards,
DPM
2014 Jan 30 11:08 AM
Hi
i am writing these code lines, please see whats the problem.
PROCESS BEFORE OUTPUT.
MODULE DISPLAY.
MODULE TBC_ESC_CHANGE_TC_ATTR.
LOOP AT IT_FINAL
INTO WA_FINAL
WITH CONTROL TBC_ESC
CURSOR TBC_ESC-CURRENT_LINE.
MODULE TBC_ESC_GET_LINES.
ENDLOOP.
MODULE STATUS_9000.
PROCESS AFTER INPUT.
LOOP AT IT_FINAL.
CHAIN.
FIELD WA_FINAL-SNO.
FIELD WA_FINAL-DESCRIPTION.
FIELD WA_FINAL-WERKS.
FIELD WA_FINAL-WEIGHTEDGE.
MODULE TBC_ESC_MODIFY ON CHAIN-REQUEST.
endchain.
FIELD WA_FINAL-SEL
MODULE TBC_ESC_MARK ON REQUEST.
ENDLOOP.
MODULE TBC_ESC_USER_COMMAND.
CHAIN.
MODULE EXIT.
MODULE USER_COMMAND_9000.
ENDCHAIN.
2014 Jan 30 11:22 AM
Hi Shweta,
put module within CHAIN AND ENDCHAIN.
MODULE VALIDATE_DATA_1021 ON CHAIN-INPUT.
MODULE RGPTBLCTRL_MODIFY_1021.
sample code is
PROCESS BEFORE OUTPUT.
MODULE RGPTBL1021_CHANGE_TC_ATTR.
LOOP AT ITRGPDET
INTO WARGPDET
WITH CONTROL RGPTBL1021
CURSOR RGPTBL1021-CURRENT_LINE.
ENDLOOP.
MODULE STATUS_1021.
PROCESS AFTER INPUT.
LOOP AT ITRGPDET.
CHAIN.
FIELD WARGPDET-ITEMNO.
FIELD WARGPDET-MATNR.
FIELD WARGPDET-MAKTX.
FIELD WARGPDET-MEINS.
FIELD WARGPDET-QUANTITY.
FIELD WARGPDET-WERKS.
FIELD WARGPDET-SELECT.
MODULE RGPTBLCTRL_MODIFY_1021.
ENDCHAIN.
ENDLOOP.
MODULE USER_COMMAND_1021.
code of module RGPTBLCTRL_MODIFY_1021.
MODULE RGPTBLCTRL_MODIFY_1021 INPUT.
MODIFY ITRGPDET
FROM WARGPDET
INDEX RGPTBL1021-CURRENT_LINE.
IF SY-SUBRC <> 0.
APPEND ITRGPDET.
ENDIF.
ENDMODULE. " RGPTBLCTRL_MODIFY_1021 INPUT
Regards,
Ranjit Kumar.
2014 Jan 30 1:16 PM
Hi All,
one problem i am facing also, i have created a USER_COMMAND in PAI,
but in the main program when i am using this code, my debugger didn't
get at perform disp_data on hitting enter, what may be the reason.
This is my code
CASE SY-UCOMM.
WHEN 'BACK' OR 'CANCEL' OR 'EXIT'.
LEAVE TO SCREEN 0..
WHEN 'ENTER'.
PERFORM DISP_DATA.
WHEN 'SAVE'.
PERFORM MATERIAL_SAVE..
ENDCASE.
CLEAR : SY-UCOMM.
2014 Jan 30 2:57 PM
Shweta,,
There is no function code as "ENTER, "
Hence the perform is also not executed.
If you need the correct fcode,try to see the sy-ucomm value in debugger
--Lakshmi
2014 Jan 31 7:23 AM
2014 Jan 31 9:25 AM
Hi,
Please use modify internal table statement to retain the values.
Warm Regards
Suneesh
2014 Jan 31 9:46 AM
Hi All,
got my problem at some extent, let me explain.
In user_command input
i have declared like this
WHEN 'ENTER'.
PERFORM DISP_DATA.
in form disp_data, i have written my code as shown below
FORM DISP_DATA .
SELECT MANDT SNO MATERIAL
FROM ZESC_MATERIAL
INTO TABLE IT_FINAL.
ENDFORM.
Thats why, it was showing only material and sno on pressing enter.
Now if i am taking weightedge also, into consideration, still it is showing blank on enter (when no data
for weightedge).
Now, please sujjest me, what can i do when i puts data in weightedge, and press enter
it should not gets disappeared.
2014 Feb 01 12:10 PM
2014 Feb 01 12:14 PM
Hi Shweta,
do one thing and see if it works for you or not, within your form disp_data,
write your code logic as shown below. (recently got a same issue, and he get his answer this way).
Still if you have trouble, then please revert.
FORM DISP_DATA .
IF IT_FINAL[] IS INITIAL.
SELECT MANDT SNO MATERIAL
FROM ZESC_MATERIAL
INTO TABLE IT_FINAL.
ENDIF.
ENDFORM.
2014 Jan 31 9:59 AM
Hi Shweta,
I got your query.
When you press Enter, every time your PERFORM DISP_DATA will call. and it will remove all your previous data and add new data into your internal table.
Remove code from USER_COMMAND and You can write code like this.
In PAI you create a perform
PERFORM GET_DATA.
PERFORM MODIFY_DATA.
FORM GET_DATA.
if first_flag = space. " Set flag for first time call. every time no need to all query.
SELECT MANDT SNO MATERIAL
FROM ZESC_MATERIAL
INTO TABLE IT_FINAL.
first_flag = 'X'.
endif.
ENDFORM.
FORM MODIFY_DATA.
MODIFY IT_FINAL FROM WA_FINAL INDEX TC-CURRENT_LINE.
if sy-subrc <> 0.
APPEND WA_FINAL TO IT_FINAL.
endif.
ENDFORM.
Kindly check this code and let me know.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |