Abap query with constante value

hello,
I wish to create several abap query since tables MKPF and MSEG for the inventory mouvements. each query for a type of inventory turnover (101, 501,…), but I should not put the code movement in criteria of selection. it is necessary that the code movement should be fixed in the query. should-I declare the MSEG-BWART as a constante? where I can do it?
thank you for your assistance.
cordialy Said

Hi,
Variant is a good option. Here is one more stable option.
Other option is to use following Code.
RANGES : ran1  FOR MSEG-BWART.
ran1-sign = 'I'.
  ran1-option = 'EQ'.
  ran1-low = 101.
  APPEND ran1.
ran1-sign = 'I'.
  ran1-option = 'EQ'.
  ran1-low = 501.
  APPEND ran1.
Then use ran1 similar to select option.
Hope this will help you.
Darshan

Similar Messages

  • How could I replace hard coded value in my sql query with constant value?

    Hi all,
    Could anyone help me how to replace hardcoded value in my sql query with constant value that might be pre defined .
    PROCEDURE class_by_day_get_bin_data
         in_report_parameter_id   IN   NUMBER,
         in_site_id               IN   NUMBER,
         in_start_date_time       IN   TIMESTAMP,
         in_end_date_time         IN   TIMESTAMP,
         in_report_level_min      IN   NUMBER,
         in_report_level_max      IN   NUMBER
    IS
      bin_period_length   NUMBER(6,0); 
    BEGIN
      SELECT MAX(period_length)
         INTO bin_period_length
        FROM bin_data
         JOIN site_to_data_source_lane_v
           ON bin_data.data_source_id = site_to_data_source_lane_v.data_source_id
         JOIN bin_types
           ON bin_types.bin_type = bin_data.bin_type 
       WHERE site_to_data_source_lane_v.site_id = in_site_id
         AND bin_data.start_date_time     >= in_start_date_time - numtodsinterval(1, 'DAY')
         AND bin_data.start_date_time     <  in_end_date_time   + numtodsinterval(1, 'DAY')
         AND bin_data.bin_type            =  2
         AND bin_data.period_length       <= 60;
      --Clear the edr_class_by_day_bin_data temporary table and populate it with the data for the requested
      --report.
      DELETE FROM edr_class_by_day_bin_data;
       SELECT site_to_data_source_lane_v.site_id,
             site_to_data_source_lane_v.site_lane_id,
             site_to_data_source_lane_v.site_direction_id,
             site_to_data_source_lane_v.site_direction_name,
             bin_data_set.start_date_time,
             bin_data_set.end_date_time,
             bin_data_value.bin_id,
             bin_data_value.bin_value
        FROM bin_data
        JOIN bin_data_set
          ON bin_data.bin_serial = bin_data_set.bin_serial
        JOIN bin_data_value
          ON bin_data_set.bin_data_set_serial = bin_data_value.bin_data_set_serial
        JOIN site_to_data_source_lane_v
             ON bin_data.data_source_id = site_to_data_source_lane_v.data_source_id
            AND bin_data_set.lane = site_to_data_source_lane_v.data_source_lane_id
        JOIN (
               SELECT CAST(report_parameter_value AS NUMBER) lane_id
                 FROM report_parameters
                WHERE report_parameters.report_parameter_id    = in_report_parameter_id
                  AND report_parameters.report_parameter_group = 'LANE'
                  AND report_parameters.report_parameter_name  = 'LANE'
             ) report_lanes
          ON site_to_data_source_lane_v.site_lane_id = report_lanes.lane_id
        JOIN (
               SELECT CAST(report_parameter_value AS NUMBER) class_id
                 FROM report_parameters
                WHERE report_parameters.report_parameter_id    = in_report_parameter_id
                  AND report_parameters.report_parameter_group = 'CLASS'
                  AND report_parameters.report_parameter_name  = 'CLASS'
             ) report_classes
          ON bin_data_value.bin_id = report_classes.class_id
        JOIN edr_rpt_tmp_inclusion_table
          ON TRUNC(bin_data_set.start_date_time) = TRUNC(edr_rpt_tmp_inclusion_table.date_time)
       WHERE site_to_data_source_lane_v.site_id = in_site_id
         AND bin_data.start_date_time     >= in_start_date_time - numtodsinterval(1, 'DAY')
         AND bin_data.start_date_time     <  in_end_date_time   + numtodsinterval(1, 'DAY')
         AND bin_data_set.start_date_time >= in_start_date_time
         AND bin_data_set.start_date_time <  in_end_date_time
         AND bin_data.bin_type            =  2
         AND bin_data.period_length       =  bin_period_length;
    END class_by_day_get_bin_data;In the above code I'm using the hard coded value 2 for bin type
    bin_data.bin_type            =  2But I dont want any hard coded number or string in the query.
    How could I replace it?
    I defined conatant value like below inside my package body where the actual procedure comes.But I'm not sure whether I have to declare it inside package body or inside the procedure.
    bin_type     CONSTANT NUMBER := 2;But it does't look for this value. So I'm not able to get desired value for the report .
    Thanks.
    Edited by: user10641405 on May 29, 2009 1:38 PM

    Declare the constant inside the procedure.
    PROCEDURE class_by_day_get_bin_data(in_report_parameter_id IN NUMBER,
                                        in_site_id             IN NUMBER,
                                        in_start_date_time     IN TIMESTAMP,
                                        in_end_date_time       IN TIMESTAMP,
                                        in_report_level_min    IN NUMBER,
                                        in_report_level_max    IN NUMBER) IS
      bin_period_length NUMBER(6, 0);
      v_bin_type     CONSTANT NUMBER := 2;
    BEGIN
      SELECT MAX(period_length)
        INTO bin_period_length
        FROM bin_data
        JOIN site_to_data_source_lane_v ON bin_data.data_source_id =
                                           site_to_data_source_lane_v.data_source_id
        JOIN bin_types ON bin_types.bin_type = bin_data.bin_type
       WHERE site_to_data_source_lane_v.site_id = in_site_id
         AND bin_data.start_date_time >=
             in_start_date_time - numtodsinterval(1, 'DAY')
         AND bin_data.start_date_time <
             in_end_date_time + numtodsinterval(1, 'DAY')
         AND bin_data.bin_type = v_bin_type
         AND bin_data.period_length <= 60;
      --Clear the edr_class_by_day_bin_data temporary table and populate it with the data for the requested
      --report.
      DELETE FROM edr_class_by_day_bin_data;
      INSERT INTO edr_class_by_day_bin_data
        (site_id,
         site_lane_id,
         site_direction_id,
         site_direction_name,
         bin_start_date_time,
         bin_end_date_time,
         bin_id,
         bin_value)
        SELECT site_to_data_source_lane_v.site_id,
               site_to_data_source_lane_v.site_lane_id,
               site_to_data_source_lane_v.site_direction_id,
               site_to_data_source_lane_v.site_direction_name,
               bin_data_set.start_date_time,
               bin_data_set.end_date_time,
               bin_data_value.bin_id,
               bin_data_value.bin_value
          FROM bin_data
          JOIN bin_data_set ON bin_data.bin_serial = bin_data_set.bin_serial
          JOIN bin_data_value ON bin_data_set.bin_data_set_serial =
                                 bin_data_value.bin_data_set_serial
          JOIN site_to_data_source_lane_v ON bin_data.data_source_id =
                                             site_to_data_source_lane_v.data_source_id
                                         AND bin_data_set.lane =
                                             site_to_data_source_lane_v.data_source_lane_id
          JOIN (SELECT CAST(report_parameter_value AS NUMBER) lane_id
                  FROM report_parameters
                 WHERE report_parameters.report_parameter_id =
                       in_report_parameter_id
                   AND report_parameters.report_parameter_group = 'LANE'
                   AND report_parameters.report_parameter_name = 'LANE') report_lanes ON site_to_data_source_lane_v.site_lane_id =
                                                                                         report_lanes.lane_id
          JOIN (SELECT CAST(report_parameter_value AS NUMBER) class_id
                  FROM report_parameters
                 WHERE report_parameters.report_parameter_id =
                       in_report_parameter_id
                   AND report_parameters.report_parameter_group = 'CLASS'
                   AND report_parameters.report_parameter_name = 'CLASS') report_classes ON bin_data_value.bin_id =
                                                                                            report_classes.class_id
          JOIN edr_rpt_tmp_inclusion_table ON TRUNC(bin_data_set.start_date_time) =
                                              TRUNC(edr_rpt_tmp_inclusion_table.date_time)
         WHERE site_to_data_source_lane_v.site_id = in_site_id
           AND bin_data.start_date_time >=
               in_start_date_time - numtodsinterval(1, 'DAY')
           AND bin_data.start_date_time <
               in_end_date_time + numtodsinterval(1, 'DAY')
           AND bin_data_set.start_date_time >= in_start_date_time
           AND bin_data_set.start_date_time < in_end_date_time
           AND bin_data.bin_type = v_bin_type
           AND bin_data.period_length = bin_period_length;
    END class_by_day_get_bin_data;

  • How to create an ABAP Query with OR logical expression in the select-where

    Hi,
    In trying to create an ABAP query with parameters. So it will select data where fields are equal to the parameters entered. The default logical expression is SELECT.. WHERE... AND.. However I want to have an OR logical expression instead of AND.. how can I attain this??
    Please help me on this.. Points will be rewarded.
    Thanks a lot.
    Regards,
    Question Man

    Hi Bhupal, Shanthi, and Saipriya,
    Thanks for your replies. But that didn't answer my question.
    Bhupal,
    You cannot just replace AND with OR in an ABAP QUERY. ABAP QUERY is a self generated SAP code. You'll just declare the tables, input parameters and output fields to be displayed and it will create a SAP standard code. If you'll try to change the code and replace the AND with OR in the SAP standard code, the system will require you to enter access key/object key for that particular query.
    Shanthi,
    Yes, that is exactly what need to have. I need to retireve DATA whenever one of the conditions was satisfied.
    Saipriya,
    Like what I have said, this is a standard SAP code so we can't do your suggestion.
    I have already tried to insert a code in the ABAP query (there's a part there wherein you can have extra code) but that didn't work. Can anybody help me on this.
    Thanks a lot.
    Points will be rewarded.
    Regards,
    Question Man

  • How to create a matrix with constant values and multiply it with the output of adc

    How to create a matrix with constant values and multiply it with the output of adc 

    nitinkajay wrote:
    How to create a matrix with constant values and multiply it with the output of adc 
    Place array constant on diagram, drag a double to it, r-click "add dimension". There, a constant 2D double array, a matrix.
    /Y
    LabVIEW 8.2 - 2014
    "Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
    G# - Free award winning reference based OOP for LV

  • Validation Rules: create a dummy account with constant value 0

    Hi,
    I need to define a control like the following:
    TA00000 >= 0
    I think that I need to create a dummy account with constant value 0 and compare TA00000 against it. I need help to create the dummy account because I'm not sure if I have to use a script logic or not. If anybody could help, I would be very grateful.
    Thanks in advance.
    Almudena

    Hi,
    Thank you for your answer. It works perfectly.
    I have other question related to validation rules. I need to create a validation like this:
    A39300 + A39110 + A39130 + A39010 >= H97300
    It is not supported in BPC NW version to leave blank in ACCOUNT_R in details of validation rule. Do you know how I could define this control?
    Thanks in advance.
    Almudena

  • How to force readObejct query with PK value to go to DB?

    The default behaviour for read-object queries with a PK value is to use the cache and not go to the database. How can we change this behaviour?
    We have cases that a row was deleted by some other process not through toplink, but the corresponding object still in the cache and if you use the readObject query with PK value, the object will be returned as result.
    Thanks in advance,

    There are several mechanisms to disable caching in TopLink. Note that disabling caching will affect your performance.
    In 9.0.4 you can use:
    - You can configure you cache type to use a WeakIdentityMap to ensure that only referenced objects are cached.
    - On descriptor you can call disableCacheHits() and alwaysRefreshCache() in code or click these options on the Caching/Identity tab in the Mapping Workbench.
    - Or to explicitly remove a deleted object from the cache uses session.removeFromIdentityMap(), but you must ensure there are no other objects referencing it.
    In 10.1.3 you can also use:
    - On descriptor you can call setIsIsolated(true) in code, or select isolated in the Caching tab in the Mapping Workbench.
    - Alternatively you can set a CacheInvalidationPolicy on your descriptor to ensure objects are not cached for longer than a specified time, or invalidated daily.
    - Or to explicitly invalidate a deleted object use, session.getIdentityMapAccessor().invalidateObject()

  • How can i do with labview program,when i have 20 different values,and 1 want to add it with constant value.and how to get the results?

    how can i do with labview program,when i have   20 different values,and 1 want to add it with constant value.and how to get the results?

    Why do the 20 values have to be different? The same code should work even if some are equal.
    What do you mean by "get the result"? The result is available at the output terminal and all you need is a wire to get it where you need it. That could be an indicator, another operation, or even a hardware device.
    What is the data type of the 20 values? An array? A cluster? A bunch of scalars? A waveform? Dynamic data?
    LabVIEW Champion . Do more with less code and in less time .

  • SAP Query with constante code mvt value

    hello,
    I wish to create several abap query since tables MKPF and MSEG for the inventory mouvements. each query for a type of inventory turnover (101, 501,…), but I should not put the code movement in criteria of selection. it is necessary that the code movement should be fixed in the query. should-I declare the MSEG-BWART as a constante? where I can do it?
    thank you for your assistance.
    cordialy Said

    Hello Esperado9 Said,
    You can think about MB51 / MB5B report where you can define the selection variant and make settings as per your requirement. These both reports will serve your requirement if you are looking for material mvt documents or stock.
    Hope this helps.
    Regards
    Arif Mansuri

  • Adding new field with constant value for pre-existing records

    Hi,
    I have to introduce in different tables (ztable and standard one) a new field, containing the company code. The problem is that all the records already inserted in these tables should be filled with a particular company code ('DD01').
    I'd like to have this field automatically filled with a constant value without having to develop a program in order to update all the preexisting data. The reason is that cardinality of these tables is aroud 100 Millions of rec....
    Ideal solution should be to have some rule/routine defined in the data dictionary CR, so to get the field value during the import of the related CR.
    I've seen that is possible to define routine, but only for maintainance view (so new records..). If I open the db view, the situation is the following (example):
    Campi di ZKR_CRPU  
    Nm.campo Pos. Tp. dati Lngh. Decimali Not null Default
    MANDT 1 VARCHAR 3   X '000'
    ZZKDATANNO 2 VARCHAR 4   X '0000'
    ZZKDATMESE 3 VARCHAR 2   X '00'
    ZZKCODZONA 4 VARCHAR 3   X ' '
    ZZKDCODCTDIS 5 VARCHAR 6   X ' '
    ZZKCRPU 6 DECIMAL 10 9 X 0
    Is it possible to change the default value? is there a solution to my problem without developing a tool just for updating a field? I can also define a custom data element if the problem can be solved.
    Thanks a lot,
    Gabriele

    Hi!
    If I were you, I will not look for another solution, because it's pretty easy task for ABAP.
    It can be solved within 1 line:
    UPDATE ztable SET zzcompany = 'DD01' WHERE zzcompany = ''.
    Regards
    Tamá

  • ABAP Query - Selection Screen Values Usage

    Hi,
       I have created an ABAP Query. For one of the selection-screen fields (CAUFV-FTRMI)
    which is select-options, I want to use the values during coding (in the where clause of a select query)
    in Extras section under the event "record processing". Please suggest how to make the the selection-screen values
    available during record processing event. Thanks in advance.
    Regards,
    Tejas Savla

    Hi Kartik,
                  I need to fetch data from some table KEKO depending on the values entered on the selection-screen for the field CAUFV-FTRMI. So, I need to find a way by which the selection-screen input values are available in the record processing event. The values are available in some variable SP$00002 of the automatically generated report program. But, this variable cannot be used in the Coding section of the ABAP QUERY. Please advise.
    Thanks & Regards,
    Tejas Savla

  • Infoset query with cero values

    Hi
    I have an infoset query that reads the information from an infoset. The infoset query is able to read the values, because it shows me values, but everything is cero, although I have values different from 0.
    But if it didn`t find values it would tell me a different message as "No application data found" or something like this.
    Then the problem is, my infoset read values, but everything that shows me is cero, and that´s not true.
    Thanks and regards
    SEM SEM

    Hi,
    What do you mean with the join condition ?
    I have an infoset query with only one ODS inside. I didn´t want to build a query directly to the ODS as I did´t want to mark the flag available for reporting in the ODS, as it already had very importat data and I didn´t want to damage the ODS  data. That´s why I have built and infoset query with one ODS inside, and in this case I don´t understand the join condition....
    Regards
    SEM SEM
    Does anybody know something ????
    Regards
    SEM SEM
    Message was edited by:
            SEM SEM

  • Creation of ABAP Query- with SQ01.

    Dear Friends,
    Please provide the full notes to create ABAP Queries with the T.code SQ01.
    Thanks & Regards
    Sreehari.

    Dear Frind,
    My Mail ID - [email protected]
    Thanks & Regards,
    Sreehari

  • ABAP Query with Debit/Credit Columns

    Dear All
    I need to develop an ABAP Query in which the user should be able to see Debit and Credit balances seperately . I understand that i will have to include two ( DR and CR ) additional fields and then do some kind of coding to pull info from either BSEG/BSIS  ( which one would be better ? )
    table but i just dont know how. Would appreciate if someone can guide me through .
    Thanks
    Sameer

    Bharath
    In some cases when you need to pull info from other tables like this , you create additional fields and then you give joining conditions to pull the information. My Requirement is that i need to develop a query
    Period Year CoCode  G/L G/L Text    Debit Bal  Credit Bal
    Now you dont have Debit and Credit as fields in any table so you need to create those fields and populate it by using suitable codes. Thats what i am really looking for
    Thanks for your effort though
    Just for your Knowledge goto sq02 and hit on extras you will  see those different options

  • JMS Sender Adapter with constant values

    Hello Friends,
    My scenario is,
    1. I am having 6 Sender JMS CCs with different Queues
    2. One Inbound Proxy to post the data into R/3
    Sender (JMS) -
    > XI -
    > R/3 (Inbound Proxy)
    Note: There is no Message Mapping used.
    Problem:  When my sender JMS adapter picks the data from JMS Queue then before sending it to Proxy I want to add some more data (lets say a kind of header info) along with the original data.
    Reason: Based on this additional data I will process my data in proxy in 6 different ways.
    Regards,
    Sarvesh

    You can use the DynamicConfigurationBean to set constants to the message header:
    http://help.sap.com/saphelp_nw04/helpdata/en/45/da2239feb22e98e10000000a155369/frameset.htm
    The configuration would be something like this:
    key.0 insert http://sap.com/xi/XI/System/ABC XYZ
    value.0 123
    Regards
    Stefan

  • CAML Query with Javascript value

    Hey everyone,
    I am building an Sharepoint 2013 app (SharePoint-Hosted) and using a CAML Query to get the current Item.
    The Current Item ID is 1 and i stored it in AccountID, but i want that variable inserted in the CAML Query so i get the proper information.
    var AccountID = 1
    camlQuery.set_viewXml('<View><Query><Where><Eq><FieldRef Name=ID LookupId="TRUE"/><Value Type="Text">1</Value></Eq></Where></Query></View>');
    But instead of putting the '1' value in the CAML Query, i want the variable AccountID in it... but how?
    Already tried this, but that didn't work:
    camlQuery.set_viewXml('<View><Query><Where><Eq><FieldRef Name=ID LookupId="TRUE"/><Value Type="Text">' + AccountID + '</Value></Eq></Where></Query></View>');
    Can someone help me with this?
    In forward, many thanks!

    Right, you have to use single quotes in a string literal inside double quotes. Just making sure it didn't have NO quotes, as your initial post showed.
    Is the ID field actually a lookup field? Or is it just the built-in ID field of the list? If it isn't a field of TYPE Lookup, try this:
    camlQuery.set_viewXml("<View><Query><Where><Eq><FieldRef Name='ID' /><Value Type='Number'>" + AccountID + "</Value></Eq></Where></Query></View>");
    Danny Jessee
    MCPD - SharePoint Developer 2010
    MCTS - SharePoint 2010, Configuring
    dannyjessee.com/blog

Maybe you are looking for

  • How to write code for this logic in a routine, very urgent --help me

    hi all, i want to apply this logic into one subroutin ZABC. here i m giving my logic ,can any body help me in coding for this, this is very urgent, i hv to submit on wednesday. 4.1 Read the company code number BSEG-BUKRS from document line item. 4.2

  • Condition Technique- Tax

    I am having one issue --- please see the example Invoice has the component.. MRP (Base Price) (ZP52) -          1855.00 (after exclusion of 5% tax) Retail price (ZPRP)-                   1766.67 (After Discount of 5%) Price To Retailer (ZPTR)-       

  • HT5167 how do I upgrade my Powerbook OS 10.4.11 to OS 10.5.8

    Hi  I'm new to apple laptops and I need help upgrading my powerbook with OS 10.4.11 to a higher OS but I don't have the restoring Dics any can someone help please

  • offtopic javascript + flash

    the evil content people are asking me evil questions which i must direct to you: is it possible for a flash file embedded on a page to call a javascript function? does flash even know about the page it is executing in? the problem is that certain lin

  • Endless start-up loop?

    Hi, our 14" ibook w/ recently repaired logic bd from Apple is now stuck in endless start-up. Powers up ok goes to blue "home" screen, dock appears at the bottom, macintosh hd icon visible, then starts again. I can click on any icon and it seems as if