2015 Jan 30 7:08 AM
Hi experts,
I have a small issue in my module pool program. I have called a subscreen which contains a table control in my module pool. However in this table control , some additions need to be performed based on the user pressing the ENTER key. The issue is that on pressing ENTER, nothing is happening as the table control is inside a subscreen and a subscreen does not support user commands. How do I solve this issue so as to perform the addition in my table control? Below are the screen shots for your reference:
1) The variables declared are shown below:
2) Flow logic for screen 9000 is:
3) Inside MODULE USER_COMMAND_9000
4) Flow logic for table control:
5) Inside MODULE READ_THIS.
6) On giving the sales orders and clicking SUBMIT:
7) The table control is displayed in the same screen due to the subscreen REF2 being called:
😎 But on giving a value for the column under "NUM" and pressing ENTER, the total "TOT1" is not getting displayed due to the subscreen's property of not supporting user command.
So how do I solve this issue and do the calculation? The requirement states that the table control must appear on the same screen below the select-options.
Regards.
Manish.
2015 Jan 30 1:46 PM
hi manish,
I got the solution for this problem.
what i did is inserted one variable called data_changed (DATA:DATA_CHANGED TYPE N) in
MODULE READ_THIS INPUT.
IF WA_VBAP IS NOT INITIAL.
WA_VBAP-TOT1 = WA_VBAP-KWMENG + WA_VBAP-NUM.
MODIFY IT_VBAP FROM WA_VBAP INDEX TC1-CURRENT_LINE.
REFRESH CONTROL 'TC1' FROM SCREEN 9002.
DATA_CHANGED = 1.
ENDIF.
ENDMODULE.
when we change value it is changing properly but here in this code it is again generating internal table but with this code it will not allow to again generate internal table due to data_changed value.
MODULE USER_COMMAND_9000 INPUT.
OK_CODE = SY-UCOMM.
CASE OK_CODE.
WHEN 'SUBMIT'.
L_DYNPRO = '9002'.
IF DATA_CHANGED NE '1'.
SELECT VBELN
POSNR
KWMENG
FROM VBAP
INTO TABLE IT_VBAP
WHERE VBELN IN S_VBELN.
ENDIF.
CLEAR OK_CODE.
WHEN 'EXIT' OR 'CANCEL'.
LEAVE PROGRAM.
ENDCASE.
also i have inserted
LOOP AT IT_VBAP.
CHAIN.
FIELD WA_VBAP-VBELN.
FIELD WA_VBAP-POSNR.
FIELD WA_VBAP-KWMENG.
FIELD WA_VBAP-NUM.
FIELD WA_VBAP-TOT1.
module read_this on CHAIN-REQUEST.
endchain.
ENDLOOP.
please try as above
2015 Jan 30 7:21 AM
Hi Manish,
It is not required to write the modify command inside the module. Use the below, I hope it will work.
FIELD WA_VBAP-NUM.
FIELD WA_VBAP-TOT1 MODULE CALC.
MODULE CALC INPUT.
WA_VBAP-TOT1 = WA_VBAP-KWMENG + WA_VBAP-NUM.
ENDMODULE.
Regards
Rajkumar Narasimman
2015 Jan 30 7:33 AM
Hi Rajkumar,
Sorry , your method is yielding the same result.
Regards.
Manish
2015 Jan 30 7:44 AM
Hi Manish,
Kindly Activate all the objects by clicking the program name at once.
Also in debug mode, make sure that the value is coming in PAI and PBO.
Last Option, we can update the value in PBO too, that will work.
Regards
Rajkumar Narasimman
2015 Jan 30 9:08 AM
Hi Rajkumar,
Please refer to the below debugging screenshots:
I have given value 50 in NUM column:
In the debugger, the total is getting added:
This is how the internal table looks like after modification:
But this is how the table control looks due to the subscreen
So the value (50) is getting added, but it is not getting displayed since the table control is inside the subscreen.
Regards
Manish
2015 Jan 30 9:42 AM
Hi Manish,
Kindly check and write the below code in PBO section in module TC1_GET_LINES,
MODULE TC1_GET_LINES OUTPUT.
"Calculation
IF WA_VBAP-NUM IS NOT INITIAL.
WA_VBAP-TOT1 = WA_VBAP-KWMENG + WA_VBAP-NUM.
ENDIF.
"Describe statement here
DESCRIBE TABLE IT_VBAP LINES L_LINE.
ENDMODULE.
Kindly check in debugger in PBO Section , whether value updating in IT_VBAP.
Regards
Rajkumar Narasimman
2015 Jan 30 9:53 AM
Hi Rajkumar,
It is already mentioned in Module TC1_CHANGE_TC_ATTR. I missed out giving its screen shot.
Regards.
Manish.
2015 Jan 30 7:28 AM
Hi Manish,
You can user SPACE as Sy-UCOMM value for ENTER.
And based on that you can write your logic.
Regards.
Praveer.
2015 Jan 30 8:54 AM
Hi Praveer
I didnt use any value for sy-ucomm. I dont need to explicitly declare any value for sy-ucomm in this case. If you check my code in MODULE READ_THIS, if the column NUM is not initial, and then enter is pressed, the total has to be displayed at the right.
Regards.
Manish
2015 Jan 30 9:21 AM
Hi Manish,
As per your requiement, the calculation should be happen on ENTER Press.
If you debug, you will get SPACE (blank) value on pressing ENTER.
so you could do the calculation.
IF SY-UCOMM EQ SPACE
calculation logic.
ENDIF.
Regards.
Praveer.
2015 Jan 30 9:45 AM
Hi Praveer,
I tried what you advised. Still not working
Regards.
Manish
2015 Jan 30 7:34 AM
Hi mani ,
Try below statement in chain ,end chain
fieild wa_vbap-num module read_this on input.
regards,
siva
2015 Jan 30 8:58 AM
Hi Siva,
Its still not working. I did mention that subscreen will not support user commands. So I need to know if I can get the table control in the same screen using a subscreen or by any other way. Since I used a subscreen in this case, no user command will be supported.
Regards.
Manish
2015 Jan 30 9:32 AM
Hi,
In Debugger Screen Check for Value of sy-subrc ,
Probably Sy-subrc is having value 'SUBMIT' , This may be the cause for not getting Modified
ITab Values.
Regards
2015 Jan 30 9:47 AM
2015 Jan 30 10:12 AM
Hi Manish,
Instead of sy_subrc , Check sy-Ucomm
It's a typo mistake from my end.
If Sy-Ucomm is having Value 'SUBMIT' then
Clear Sy-Ucomm Value.
Regards:
Somendra
2015 Jan 30 10:24 AM
Hi Somendra,
The value of sy-ucomm has nothing to do with the calculation part. Let me remind you that the enter key is not working in this case as the table control is in a subscreen. So my question is, how can I make my table control appear in the same screen after clicking the "SUBMIT" button? Using the table control in a subscreen is not letting the user commands work.
Regards.
Manish
2015 Jan 30 10:32 AM
Hi,
Your Itab is updating correctly after enter Key, Again a PBO is called & In Main Screen
PBO it is again selecting Value in Itab , Means Itab getting Refreshed.
Thats Why I asked to Check for Sy-Ucomm .
Regards
2015 Jan 30 10:41 AM
Hi,
The value of sy-ucomm is 'SUBMIT'. It is not changing as I havent used sy-ucomm for table control explicitly. Sy-ucomm is used only for the select-options. Even if I clear the value of sy-ucomm, it is not making a difference. Whether sy-ucomm changes or not, the output of the table control has no relevance whatsoever as it is inside the subscreen which is preventing user-command interaction.
Regards.
Manish
2015 Jan 30 1:46 PM
hi manish,
I got the solution for this problem.
what i did is inserted one variable called data_changed (DATA:DATA_CHANGED TYPE N) in
MODULE READ_THIS INPUT.
IF WA_VBAP IS NOT INITIAL.
WA_VBAP-TOT1 = WA_VBAP-KWMENG + WA_VBAP-NUM.
MODIFY IT_VBAP FROM WA_VBAP INDEX TC1-CURRENT_LINE.
REFRESH CONTROL 'TC1' FROM SCREEN 9002.
DATA_CHANGED = 1.
ENDIF.
ENDMODULE.
when we change value it is changing properly but here in this code it is again generating internal table but with this code it will not allow to again generate internal table due to data_changed value.
MODULE USER_COMMAND_9000 INPUT.
OK_CODE = SY-UCOMM.
CASE OK_CODE.
WHEN 'SUBMIT'.
L_DYNPRO = '9002'.
IF DATA_CHANGED NE '1'.
SELECT VBELN
POSNR
KWMENG
FROM VBAP
INTO TABLE IT_VBAP
WHERE VBELN IN S_VBELN.
ENDIF.
CLEAR OK_CODE.
WHEN 'EXIT' OR 'CANCEL'.
LEAVE PROGRAM.
ENDCASE.
also i have inserted
LOOP AT IT_VBAP.
CHAIN.
FIELD WA_VBAP-VBELN.
FIELD WA_VBAP-POSNR.
FIELD WA_VBAP-KWMENG.
FIELD WA_VBAP-NUM.
FIELD WA_VBAP-TOT1.
module read_this on CHAIN-REQUEST.
endchain.
ENDLOOP.
please try as above
2015 Feb 02 6:15 AM
Hi Abdul,
Your method is working. But I fail to understand the logic behind this method. Why is the internal table getting populated again with the field values after ENTER is pressed. So basically the logic of screen 9000 PAI is getting repeated when I debugged. Why should this happen as the control should not go back to screen 9000's logic.
Regards.
Manish.
2015 Feb 02 6:42 AM
hi manish,
PAI will trigger whenever 'ENTER' key is pressed.
2015 Feb 02 6:57 AM
Hi Abdul,
But it should be the PAI for screen 9002 right? Not PAI of screen 9000.
2015 Feb 02 7:06 AM
Whenever 'ENTER' is pressed first main screen PAI is triggered and then subscreen PAI will trigger.
2024 Feb 07 10:34 AM
hi guys,
am very new to SAP ABAP can you please tell me that in module pool i have to create 2 subscreens, in subscreen-1: i need to show the data from the MARA table, subscreen-2: i need to show the data from the VBAK table
then display the data from VBAP in TABLE FORMAT.
here(selection screen fields (material number and sale order number))
can you please tell me how to do it. 😞