Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

SAP ABAP Query

Former Member
0 Kudos

Hi All,

I need to add a where clause with constant value in SAP Query.

Example:

I joined VBAK and VBAP table to get the output. I used SQ01, SQ02 and SQ03 to build the querr and it is working fine as expected.

Now i need to restrict the VBAP-CHARG = '9953981656'. It has to be hard-coded in the query. How to achieve this?

Thanks,

Raj.

1 ACCEPTED SOLUTION

Former Member

Hi Rajesh,

Open the code behind the SAP query, modify the SQL query and activate it.

Regards,

Amitava

4 REPLIES 4

Former Member

Hi Rajesh,

Open the code behind the SAP query, modify the SQL query and activate it.

Regards,

Amitava

former_member214857
Contributor
0 Kudos

Hi

You can add field VBAP-CHARG to the selection screen and pre-define it with the required value

Kind regards

Former Member
0 Kudos

Hi,

I Think the easiest ist to adding a little check in your code.

Directly in SQ02 open your infoset in change mode.

click on the extras button

select that you want to add a code.

insert the below line

   CHECK VBAP-CHARG= '9953981656'.

Save and generate your infoset and it's done.

After some test I figured out that the mehode proposed in a post above, meaning add your field in the selection screen and fill it there is much better by performance point of view.

I do the following to handle such requestes.

  1. Add fiield in the selection screen
  2. create a variant setting the value and hiding the field.
  3. create Z transaction with as default the variante create above
  4. to the user I only handle out the transaction

Hope it helps

Best regards

jogeswararao_kavala
Active Contributor
0 Kudos

As suggested by Yannick,

In SQ02

in the 'Record processing' section of the 'Code' tab of Extras, put the 'CHECK code' as shown below.

Save the code, Save and Generate the Infoset.

Run SQ01 afresh, and then see the result.

Jogeswara Rao K