‎2021 Sep 13 11:27 AM
When I try to pull data, all checkboxes are working. I want my picks to work, what should I do?
I get the data if 1 checkbox is checked. But if I pull more than one checkbox, I can't get the data. What I want is to be able to view all the data when I click on 2-3 or 4 checkboxes.
PARAMETERS: cbox0 as CHECKBOX, cbox1 as CHECKBOX, cbox2 as CHECKBOX,cbox3 as CHECKBOX.
SELECT DISTINCT z1~aufnr<br> z2~phas0<br> z2~phas1<br> z2~phas2<br> z2~phas3<br> z2~objnr<br> z2~erdat<br> z2~ernam<br> z2~idat1<br> z2~idat2<br> z2~idat3<br> z3~equnr<br> z4~zzdriver<br> FROM afko AS z1<br> INNER JOIN aufk AS z2 ON ( z1~aufnr = z2~aufnr )<br> INNER JOIN afih AS z3 ON ( z2~aufnr = z3~aufnr )<br> INNER JOIN v_fleet AS z4 ON ( z3~equnr = z4~equnr )<br> INTO CORRESPONDING FIELDS OF TABLE gt_phas<br> WHERE z1~aufnr IN s_aufnr<br> AND ( z2~phas0 EQ cbox0<br> OR z2~phas1 EQ cbox1<br> OR z2~phas2 EQ cbox2<br> OR z2~phas3 EQ cbox3 )<br> AND z2~erdat IN s_erdat<br> AND z3~equnr IN s_equnr<br> AND z4~zzdriver IN s_driver.
‎2021 Sep 13 11:57 AM
Use button [CODE] to format your ABAP code
Explain what it is nor working, what you expect to have ...
Are you sure there is lines corresponding to your selection ?
‎2021 Sep 13 12:06 PM
Hi sahbaz,
you try to select your data with an or condition. Are you sure this is what you want?
AND ( z2~phas0 EQ cbox0
OR z2~phas1 EQ cbox1
OR z2~phas2 EQ cbox2
OR z2~phas3 EQ cbox3 )If you wan't that all checkboxes has an effect to your selection, you should consider to change it to an "and" condition:
AND z2~phas0 EQ cbox0
AND z2~phas1 EQ cbox1
AND z2~phas2 EQ cbox2
AND z2~phas3 EQ cbox3
‎2021 Sep 13 12:11 PM
If I do it with the and command as you said, if I select more than one checkbox, it does not return the data.
‎2021 Sep 13 12:27 PM
Hi Okan,
it is important to know what you want to select. A check box can have either the value true or false. If the combination of checkboxes match to your datarecord, you should be able to select the record.#
Do you want to have a additional logic, for example that only one of the phas can be set?
AND z2~phas0 EQ cbox0
AND z2~phas1 EQ cbox1
AND z2~phas2 EQ cbox2
AND z2~phas3 EQ cbox3
‎2021 Sep 13 12:39 PM
My code is as you wrote above. When this happens, if I select one by one, I can access the data, but if I select more than one, the data does not come.
‎2021 Sep 13 12:40 PM
Please clarify what result you expect with an example, so that people can understand what you have in mind. Thanks.
‎2021 Sep 13 12:43 PM
For example, I can see my data when I select cbox1 right now. But if I select more than one checkbox (cbox1 and cbox2) the data is not displayed.
‎2021 Sep 13 1:07 PM
Basically you either select some records with status flag set to 'X' or set to initial value.
So
My questions
‎2021 Sep 13 1:26 PM
I get the data if 1 checkbox is checked. But if I pull more than one checkbox, I can't get the data. What I want is to be able to view all the data when I click on 2-3 or 4 checkboxes.
‎2021 Sep 13 1:11 PM
Hi,
maybe this is the code you want?
AND ( z2~phas0 EQ cbox0 or z2~phas0 is initial )
AND ( z2~phas1 EQ cbox1 or z2~phas1 is initial )
AND ( z2~phas2 EQ cbox2 or z2~phas2 is initial )
AND ( z2~phas3 EQ cbox3 or z2~phas3 is initial )
‎2021 Sep 13 1:23 PM
‎2021 Sep 13 1:24 PM
or, depending on actual OP requirement
AND ( ( z2~phas0 EQ cbox0 AND z2~phas0 is not initial ) " select if status CREATED and box checked
OR ( z2~phas1 EQ cbox1 AND z2~phas1 is not initial ) " select if status RELEASED and box checked
OR ( z2~phas2 EQ cbox2 AND z2~phas2 is not initial ) " etc.
OR ( z2~phas3 EQ cbox3 AND z2~phas3 is not initial ) )
‎2021 Sep 13 1:38 PM
When I do as you say, I pull all the data. I just want my chosen ones to come.
‎2021 Sep 13 1:19 PM
Your code works for me, after some adaptations, I have PHAS1 = X PHAS... = blank
but it works whatever I check
TABLES: aufk, afih.
PARAMETERS: cbox0 AS CHECKBOX, cbox1 AS CHECKBOX, cbox2 AS CHECKBOX,cbox3 AS CHECKBOX.
SELECT-OPTIONS s_aufnr FOR aufk-aufnr.
SELECT-OPTIONS s_erdat FOR aufk-erdat.
SELECT-OPTIONS s_equnr FOR afih-equnr.
SELECT DISTINCT z1~aufnr,
z2~phas0,
z2~phas1,
z2~phas2,
z2~phas3,
z2~objnr,
z2~erdat,
z2~ernam,
z2~idat1,
z2~idat2,
z2~idat3,
z3~equnr
FROM afko AS z1
INNER JOIN aufk AS z2 ON ( z1~aufnr = z2~aufnr )
INNER JOIN afih AS z3 ON ( z2~aufnr = z3~aufnr )
* INNER JOIN v_fleet AS z4 ON ( z3~equnr = z4~equnr )
INTO TABLE @DATA(gt_phas)
WHERE z1~aufnr IN @s_aufnr
AND ( z2~phas0 EQ @cbox0
OR z2~phas1 EQ @cbox1
OR z2~phas2 EQ @cbox2
OR z2~phas3 EQ @cbox3 )
AND z2~erdat IN @s_erdat
AND z3~equnr IN @s_equnr.
‎2021 Sep 13 1:26 PM
I don't think it clarifies anything. If it doesn't select it's because table AUFK doesn't have a line which has both PHAS0 = 'X' and PHAS1 = 'X' (in relationship with the joined lines). No magic here.
Maybe you can simplify your code to understand what's going on. First try with AUFK alone to make sure you select the lines you want, then add one table at a time to see when the lines are not selected anymore, and analyze why.
SELECT * FROM aufk WHERE
z2~phas0 EQ @cbox0
OR z2~phas1 EQ @cbox1
OR z2~phas2 EQ @cbox2
OR z2~phas3 EQ @cbox3 ...
‎2021 Sep 13 1:35 PM