06-01-2011 8:35 AM
Hi,
I hav written the below code to fetch the check box value on saving.
this value has to get inserted into the table.
but its not fetching the value,kindly guide mewhere i went wrong.
DATA: YQCHECK TYPE C,
YCHECK TYPE C.
CASE sy-ucomm.
WHEN 'BU'.
if YQCHECK EQ 'X' OR YCHECK EQ 'X'.
SELECT prueflos
werk
matnr
enstehdat
FROM qals
INTO CORRESPONDING FIELDS OF TABLE t_qals
WHERE prueflos = i_qals-prueflos.
IF sy-subrc = 0.
LOOP AT t_qals
INTO l_qals WHERE prueflos = i_qals-prueflos.
l_qals-fm_approval = YCHECK.
l_qals-cqa_approval =YQCHECK .
l_qals-username = sy-uname.
l_qals-timestamp = sy-uzeit.
l_qals-last_changed_dat = sy-datum.
MODIFY t_qals FROM l_qals TRANSPORTING fm_approval
cqa_approval
username
timestamp
last_changed_dat.
*insert TABLE YUD_RECORDING from table t_qals
IF sy-subrc = 0.
INSERT yud_recording FROM TABLE t_qals .
COMMIT WORK.
ENDIF.
ENDLOOP.
Kindly,guide me where i went wrong.
06-01-2011 8:41 AM
You are defining variable YQCHECK and YCHECK, but yyou are not assigning them any value. Assign the value of checkbox to them .
06-01-2011 8:48 AM
hi,
the value has to be fecthed from the screen.
how can i dynamically fetch the value and assign to the check box?
06-01-2011 8:48 AM
Your code looks good.
Delete check box from the module pool screen once and re-create the same by getting the field from menu bar of screen layout - Goto - Program/Dictionary fields. Because this causes the issue some times.
Thanks,
Naveen.I
06-01-2011 8:49 AM
Hi,
HAv eyou debugged and checked what value are you getting in YQCHECK & YCHECK.
If you are selecting the check box on screen and it doesnt get reflected here... The only reason could be.. The screen name of check box is different then what you have defined in the program(YQCHECK).
Just goto the screen painter and check what name are you using there for check box.
06-01-2011 9:54 AM
HI,
I hav debugged the code.but no value is getting passed into ycheck and yqcheck.
still pondering y it is not working.
06-01-2011 9:55 AM
06-01-2011 10:04 AM
yes i hav checked.
i hav a text field and a check box field like factory manager and a check box next to it.
iam taking check box field name only.
06-01-2011 10:24 AM
@Naveen:i even tried by going to menu and selcting the field from the program.but no use..facing same problem.
@sap_wiz:the check box screen field name and the name what iam using both are same.but stil has same issue.
06-01-2011 10:27 AM
Hi Jiyaa,
The following should be in TOP Include
"The Screen Field name and a Variable name in TOP
"Include are same then automatic Data transfer takes place
DATA: YQCHECK TYPE C,
YCHECK TYPE C.
Cheerz
Ramchander Rao.K
06-01-2011 10:30 AM
Hi ,
You are writing this code in PAI right? Just conforming..Becauuse nothing else seems to be wrong..
06-01-2011 10:31 AM
06-01-2011 10:32 AM
06-01-2011 11:04 AM
Hi,
in the QALS table having only on primarry key prueflos. in your select query getting data from QALS bassed on the
prueflos = i_qals-prueflos condition.
SELECT prueflos
werk
matnr
enstehdat
FROM qals
INTO CORRESPONDING FIELDS OF TABLE t_qals
WHERE prueflos = i_qals-prueflos.
in the loop your using insert query while inserting data in Ztable. everything is correct.
actually what is your problem?
where you write the code for fetching data?
in which table you want to fetch the data? is it qals or ztable?
write one more select query for updating the check box. as follow.
select single * from ztable into wa where prueflos = i_qals-prueflos.
if sy-subrc = 0.
check box name = wa-checkbox1.
check box name = wa-checkbox2.
endif.
Regards,
Dhina..
Regards,
Dhina..
Edited by: Dhina DMD on Jun 1, 2011 12:12 PM
06-01-2011 11:21 AM
@dhina:
i need to capture the chcek box value from the screen.
only if the check box is checked,iam updating my z table with 'x' for respective check-box.
my problem is iam not able to capture the check box value from the screen.
06-01-2011 11:32 AM
Hi Jiyaa,
Define the check box as a parameter and assign a modif id to it in the top include. While looping at the screen name check for the modif id and if it is same, it will enter the next processing statement.
Check and please revert back.
Regards,
-Syed.
06-01-2011 11:36 AM
@syed.
what is modif id?can you please elaborate or post some example.
Thanks
06-01-2011 11:39 AM
Hi Jiyaa,
Please check with the Parameters options in the help. You will find it out.
Please let me know if not done.
Regards,
-Syed.
06-01-2011 11:49 AM
Hi,
let me recall.
You have defined YQCHECK and YCHECK in your top include and designed them on the screen.
In the PAI of this screen you developed the code you sent , that seems okay.
As a last chance, try to find YQCHECK and YCHECK within your program (with the option "In main program") just to check if you clean the values (for example in the PBO) or if you are declaring them once again.
I had this doubt as in your first post you wrote down your code:
>DATA: YQCHECK TYPE C,
>YCHECK TYPE C.
>CASE sy-ucomm.
>WHEN 'BU'.
>if YQCHECK EQ 'X' OR YCHECK EQ 'X'.
>SELECT prueflos
and it seems that you are declaring the two variables once again here, that woul mean that of course they would always have an initial value.
I know it may seem quite silly, but your code really seems okay to me.
06-01-2011 11:50 AM
Hi,
There is nothing extraordinary we need to do to capture check box.
Now just try this.
In the PAI of your screen.
Create a module checkbox as:
MODULE CHECKBOX.
Now inside it write the code:
If YQCHECK = 'X'.
endif.
Declare , DATA: YQCHECK type char1 . in the Top include or main report of module pool.
Now put a breakpoint here and see what value you are getting for YQCHECK.It has to populate .Also double check if your screen is active.And the Screen checkbox name is same as teh one defined in program.
06-01-2011 11:56 AM
@ SAP_WIZ : This is working. Jiyaa, please consider this logic and carry on.
Regards,
-Syed.
06-20-2011 10:25 AM