Formula for selection criteria

Hello all.
I have a questions regarding creating a selection formula and parameters.
See attached picture. I have a table that houses all the data I need for my report .
I want to create a report with the following selection parameters
Monthly
yearly
quarterly.
if the user selects monthly I want the report to return  the most recent 12 months
if the user select yearly I want the report to return the last 5 years
and if the user selects quarterly I want the report to return the last completed 10 quarters.
Any idea how I can accomplish that?
thanks in advance for your help.

This is actually not that difficult.  Assuming that the parameter is named {?Time Period} you'll create a formula for start date.  I'm also assuming that you want to show up to the current date, not the end of the most recent complete time period and that you want to start on the first day of the period, not the day that corresponds to the current day and that quarters start on the first days of Jan, Apr, Jul, and Oct.  So, it will look something like this:
{@StartDate}
DateVar tmpDate;
DateVar startDate;
if {?Time Period} = 'Monthly' then
     tmpDate := DateAdd('m', -12, CurrentDate);
     startDate := Date(Year(tmpDate), Month(tmpDate), 1);
else if {?Time Period} = 'Yearly' then
     tmpDate := DateAdd('y', -5, CurrentDate);
     startDate := Date(Year(tmpDate), 1, 1);
else if {?Time Period} = 'Quarterly' then
  tmpDate := DateAdd('q', -10, CurrentDate);
  if Month(tmpDate) in [2, 5, 8, 11] then //the second month of the quarter
    tmpDate := DateAdd('m', -1, tmpDate);
  else if Month(tmpDate) in [3, 6, 9, 12] then //the third month of the quarter
    tmpDate: = DateAdd('m', -2, tmpDate);
  startDate := Date(Year(tmpDate), Month(tmpDate), 1);
startDate
You'll then go to the Select Expert and manually edit the selection formula to read something like this:
{MyTable.DateField} >= {@StartDate} and
{MyTable.DateField} <= CurrentDate
-Dell

Similar Messages

  • No valid task list for material ""  plant "" for selection criteria

    I am getting the following error while creating a production order:
    No valid task list for material ""  plant "" for selection criteria
    Does anyone know how to fix this?
    thanks,
    Scott

    Dear,
    1. Check in Order type dependent parameter - OPL8, select your Plant & Order type. In this check the task list, it should be N. then selection priority in OPJF settings
    2. Chek the routing valid from date for this material by CA02. The production order start date must be between valid date.
    3)Kindly check the routing header.Whether it is for usage 1 and Release status '4'
    4) Task list we maintain in OP8B please check and come back.
    Regards,
    R.Brahmankar
    Edited by: R Brahmankar on Nov 19, 2008 9:57 AM

  • SLED for selection criteria for batch search

    good day gurus,
    Is it possible to use SLED (LOBM_VFDAT) as a selection criteria for my batch search? how do i set this up?
    Thanks in advance
    Edited by: obie villamosa on Jun 30, 2008 11:06 AM

    hi
    maintained class in t-code CL01 for you characteristics then sort sequence CU70 as per shelf life, setting expiration date check by OMJE for your plamt and movment type,
    maintained strategy type in spro in production
    Define Batch search procedure and assign your strategy there.
    then allocate your search procedure to your plant in spro
    and then maintained condition type in t -code COB1 for your plant.
    also maintained your class in material master in classification view for batch class
    Regards
    Pravin
    Edited by: pravin dhokey on Jun 30, 2008 8:07 AM

  • SNC- New field adding to the Purchase due list for selection criteria

    Hi SNC Experts,
    I have to Add new fields from the existing available fields from the configuration in the purchasing  due list and for PO over view selection criteria. I want to know the configuration spot where should I go and look for thew list of exisitng fields which are not displayed for the selection criteria.

    HI Lata,
    which version is the system running on? We have BSP UI in lower releases and WD UI in latest releases.
    Best Regards,
    Harsha Gatt

  • POWL: Freely Programmed Input help for Selection Criteria possible

    Hi,
    is it possible to add a freely programmed value help to a POWL-selection field? In this case the use of OVS is unsufficient from the user perspective.
    Can anybody guide me?
    Thanks, Elke.

    I dont intend to create another search help component for my 2nd input field because if let say i have 20 input fields that requires search help, does that means I need to create 20 search help components and embed 20 of them into my parent component?
    NO need of creating 20 more search helps if you have these 20 attributes in the result table of the value help.
    just check in the help from where the help is getting called and then pass the value accordingly.
    here is a sample code where i am checking whether the search help is called from ID field or Location field and then passing
    the required info back.
    lo_listener = wd_comp_controller->value_help_listener.
    lv_attrib_name = lo_listener->f4_attribute_info-name.
    IF lv_attrib_name EQ 'ID'.
    lo_listener->f4_context_element->set_attribute( value = lv_id
    name = lv_attrib_name ).
    ENDIF.
    IF lv_attrib_name EQ 'LOCATION'.
    lo_listener->f4_context_element->set_attribute( value = LOC
    name = lv_attrib_name ).
    ENDIF.
    wd_comp_controller->fire_vh_data_selected_evt( ).
    thanks
    sarbjeet singh

  • No unpaid tax lines exist for the given selection criteria.

    Hi
    at the time of remittance challan,getting following error:
    No unpaid tax lines exist for the given selection criteria.
    Message no. 8I702
    Diagnosis
    The corresponding withholding tax line  &1& is not present in WITH_ITEM table.
    System Response
    For withholding tax recovered from the vendor, tax line is present in table BSIS, but the corresponding entry is missing in table WITH_ITEM , which is necessary for challan updation. Check the entries.
    Procedure
    check entries in table WITH_ITEM for the open tax items chosen for clearing.

    Hi,
    It may cleared Manual posting at the time of posting.  If manual clear postings reverse and do through J1INCHLN only.
    and check the Date range for selection criteria.
    Regards,
    Kishore

  • Can we change the selection criteria for RV60SBAT Background Job for Billin

    We have a requirement to add a new selection criteria for RV60SBAT Background Job for Billing. We want to process back order invoices first. So we want a specific background job to select these. So we want to select any orders that are eligible to be invoiced where order date < the date of background job(r sy-datum ). Any ideas where we can introduce this logic for selection criteria?
    Thanks,
       Matt

    Hi Matt
    For your requirement , copy the standard  RV60SBAT program to Z program and in that copied RV60SBAT program , maintain the logic that the backorder invoices should be first processed.Then after that regular background job for billing should take happen .Then your requirement can be fulfilled
    Regards
    Srinath

  • Hide Particular Item Group from Selection Criteria of Sales Analysis Report

    Hello Experts,
    Is this possible to Hide Particular Item Group from Selection Criteria of Sales Analysis Report?
    I have one Item Group as 'Special Items'.
    Now, when I open  Item wise sales analysis report, I want to hide above mentioned group from selection criteria.
    Thanks in advance.
    Best Regards,
    Pankit Sheth

    Hi,
    1. Not possible to put validation for selection criteria windows.
    2. In standard, I don't think it is possible to hide only one item group.
    3. Alternatively don't give authorization to user for running sales reports. If still need create customized query and ask user run every month.
    Thanks & Regards,
    Nagarajan

  • How to suppress blank page and selection criteria in SPOOL ?

    My Z program submits two programs to spool and converts the ABAP List in the spool to PDF and emails.
    After upgrade to ECC6, the first (a report painter report) resulting PDF there was one blank page and the contents were displayed on second page. For the second report (RKPEP003 - CJI3)  the selection criteria that the report used was printed as the first page of output and the result on a subsequent page. The same thing happens when I individually execute these two reports directly in SE38 with the same selection criteria. I believe the blank page is there in the spool because when I view the spool as a RAW, there is a P in the first column, however the spool shows that there is only one page in the first and two in the second (this is true - one for selection criteria "which I don't want" and then the actual content). In 46C, when I look at the RAW view of the spool there is no additional P's in the first column.
    I do not want to have the blank page on the first report and the selection criteria listed on the output of the report. How can I do that ? I am thinking get_print_parameters can in someway get me there, but I am not sure.
    Thanks
    Hari
    Edited by: Hari Sudarsanan on Apr 8, 2009 7:28 PM
    Edited by: Hari Sudarsanan on Apr 8, 2009 8:05 PM

    The first report painter program writes a regular ABAP list.
    The second outputs an ALV.

  • Validation for selection screen

    hi all,
       can anyone help me on the particular issue for adding f4 functionality based on selection criteris.i am using the code below but i am not able to get the selection.
      SELECTION-SCREEN: BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
         PARAMETERS:     P_MBLNR LIKE MKPF-MBLNR OBLIGATORY, "Customer Number
                         P_WERKS LIKE MSEG-WERKS OBLIGATORY.
      SELECTION-SCREEN:SKIP 2.
             SELECTION-SCREEN: BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-001.
                PARAMETERS:    RAD1 RADIOBUTTON GROUP RAD DEFAULT 'X',
                               RAD2 RADIOBUTTON GROUP RAD.
             SELECTION-SCREEN END OF BLOCK B2.
      SELECTION-SCREEN END OF BLOCK B1.
      AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_MBLNR.
      DATA: BEGIN OF I_MBLNR OCCURS 0,
              V_MBLNR LIKE MSEG-MBLNR,
              V_BWART LIKE MSEG-BWART,
            END OF I_MBLNR.
    IF NOT P_MBLNR IS INITIAL.
       IF RAD1 = 'X'.
        SELECT SINGLE MBLNR INTO I_MBLNR-V_MBLNR FROM MSEG
                WHERE BWART = '541'.
    ELSEIF RAD2 = 'X'.
        SELECT SINGLE MBLNR INTO I_MBLNR-V_MBLNR FROM MSEG
                WHERE BWART = '551'.
    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
       EXPORTING
        DDIC_STRUCTURE         = MSEG-MBLNR
         RETFIELD               = IT_HEADER-MBLNR
       PVALKEY                = ' '
       DYNPPROG               = ' '
       DYNPNR                 = ' '
       DYNPROFIELD            = ' '
       STEPL                  = 0
       WINDOW_TITLE           =
       VALUE                  = ' '
       VALUE_ORG              = 'C'
       MULTIPLE_CHOICE        = ' '
       DISPLAY                = ' '
       CALLBACK_PROGRAM       = ' '
       CALLBACK_FORM          = ' '
       MARK_TAB               =
    IMPORTING
       USER_RESET             =
       TABLES
         VALUE_TAB              = IT_HEADER.
       FIELD_TAB              =
       RETURN_TAB             =
       DYNPFLD_MAPPING        =
    EXCEPTIONS
       PARAMETER_ERROR        = 1
       NO_VALUES_FOUND        = 2
       OTHERS                 = 3
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDIF.
    ENDIF.

    HI NAVNEET ,
       thanks for replying actuallty i have n internal table it_header which i have used it for my program but this interna table i have used only for selection criteria. can you plz see the portion of my code which i have used for selection criteria.please find below
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_MBLNR.
      DATA: BEGIN OF I_MBLNR OCCURS 0,
              MBLNR LIKE MSEG-MBLNR,
            END OF I_MBLNR.
    IF NOT ( P_MBLNR IS INITIAL ).
       refresh i_mblnr.
       clear i_mblnr.
      IF ( RAD1 = 'X' ).
         SELECT  MBLNR INTO I_MBLNR FROM MSEG
                WHERE BWART = '541'.
            ENDSELECT.
      ELSEIF ( RAD2 = 'X' ).
         SELECT MBLNR INTO I_MBLNR FROM MSEG
                WHERE BWART = '551'.
            ENDSELECT.
      ENDIF.
    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
       EXPORTING
       DDIC_STRUCTURE         = 'MSEG'
         RETFIELD               = 'MBLNR'
       PVALKEY                = ' '
        DYNPPROG               = SY-REPID
        DYNPNR                 = SY-DYNNR
        DYNPROFIELD            = 'P_MBLNR'
        VALUE_ORG              = 'S'
        CALLBACK_FORM          = SY-REPID
       TABLES
         VALUE_TAB              = I_MBLNR
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDIF.

  • SUBMIT rkaep000 with "Further Selection Criteria"

    Hi all,
    Could anyone please tell me how to call the transaction KSB1 with it's "Further Selection Criteria" (i.e. Document Number). I have tried the following but it didn't work.
    SUBMIT rkaep000
      WITH p_tcode = 'KSB1'
      WITH kostl = '7062'
      WITH r_belnr BETWEEN '101727316' AND '101727316'
      WITH r_budat BETWEEN '20070101' AND '20070131'
      AND RETURN.
    Many thanks!
    Steve.

    try using submit rkaep000 with with selection-table t_Screen_tab.
    t_screen_tab is a table of type rsparams.
    rsparams is a structure with following field.
    SELNAME
    KIND
    SIGN
    OPTION
    LOW
    HIGH
    fill with an entry for each screen selection object.
    eg.
    t_screen_Tab-selname = 'R_BELNR'.
    t_Screen_tab-kind = 'S'. "S for select option, P for parameter
    t_Screen_tab-sign = 'I'. "I include E exclude
    t_screen_tab-option = 'BT'. "between, EQ or NE
    t_Screen_Tab-low = '101727316'.
    t_screen_tab-high = '101727316'.
    append t_screen_Tab.
    repeat for all selection entries required.
    Here is the abap help on topic
    Addition 3
    ... WITH SELECTION-TABLE rspar
    Effect
    If you specify this addition, parameters and selection criteria on the selection screen are supplied from an internal table rspar. You must specify an internal table with the row type RSPARAMS for rspar. The structured data type RSPARAMS is defined in the ABAP Dictionary and has the following components, all of which are data type CHAR:
    SELNAME (length 8),
    KIND (length 1),
    SIGN (length 1),
    OPTION (length 2),
    LOW (length 45),
    HIGH (length 45).
    To supply parameters and selection criteria for the selection screen with specific values, the lines in the internal table rspar must contain the following values:
    SELNAME must contain the name of a parameter or selection criterion for the selection screen in block capitals
    KIND must contain the type of selection screen component (P for parameters, S for selection criteria)
    SIGN, OPTION, LOW, and HIGH must contain the values specified for the selection table columns that have the same names as the selection criteria; in the case of parameters, the value must be specified in LOW and all other components are ignored.
    If the name of a selection criterion is repeated in rspar, this defines a selection table containing several lines and passes it on to the selection criterion. If parameter names occur several times, the last value is passed on to the parameter.
    The contents of the parameters or selection tables for the current program can be entered in the table by the function module RS_REFRESH_FROM_SELECTOPTIONS.
    Note
    In contrast to selection tables, the data types of the components LOW and HIGH in table rspar are always of type CHAR and are converted to the type of the parameter or selection criterion during transfer, if necessary.

  • Report for Sales and purchase tax (selection criteria-Tax code)

    Hi
    I have one query for sales tax details which gives me detail for all A/R invoices and taxes involved in it. But i want that while executing query system should ask tax code and gives detail of tax amount in front of item and invoice according to tax code selected.
    The query is:
    SELECT M.DocNum AS 'Inv.No ', M.DocDate as 'Date', M.CardName as 'Customer Name',L.Dscription,L.Quantity,L.Price, (Select Sum(LineTotal) FROM INV1 L Where L.DocEntry=M.DocEntry) as 'Base Amt.(Rs.)', (SELECT Avg(TaxRate) FROM INV4 where statype=1 and DocEntry=M.DocEntry) as ' VAT % ', (SELECT Sum(TaxSum) FROM INV4 where statype=1 and DocEntry=M.DocEntry) as ' VAT (Rs.) ', (SELECT Avg(TaxRate) FROM INV4 where statype=4 and DocEntry=M.DocEntry) as ' CST % ', (SELECT Sum(TaxSum) FROM INV4 where statype=4 and DocEntry=M.DocEntry) as ' CST (Rs.) ', (SELECT Avg(TaxRate) FROM INV4 where statype=7 and DocEntry=M.DocEntry) as ' TAXEXEMPT % ', (SELECT Sum(TaxSum) FROM INV4 where statype=7 and DocEntry=M.DocEntry) as ' TAXEXEMPT ', (SELECT Avg(TaxRate) FROM INV4 where statype=8 and DocEntry=M.DocEntry) as ' VAT% ', (SELECT Sum(TaxSum) FROM INV4 where statype=8 and DocEntry=M.DocEntry) as 'VAT12.5 ', (SELECT Avg(TaxRate) FROM INV4 where statype=9 and DocEntry=M.DocEntry) as ' CST 2% ', (SELECT Sum(TaxSum) FROM INV4 where statype=9 and DocEntry=M.DocEntry) as ' CST @2 ', (SELECT Avg(TaxRate) FROM INV4 where statype=11 and DocEntry=M.DocEntry) as ' CENVCST % ', (SELECT Sum(TaxSum) FROM INV4 where statype=11 and DocEntry=M.DocEntry) as ' CENVCST ', (SELECT Avg(TaxRate) FROM INV4 where statype=-90 and DocEntry=M.DocEntry) as ' BED % ', (SELECT Sum(TaxSum) FROM INV4 where statype=-90 and DocEntry=M.DocEntry) as ' BED ', (SELECT Avg(TaxRate) FROM INV4 where statype=-60 and DocEntry=M.DocEntry) as ' Cess% ', (SELECT Sum(TaxSum) FROM INV4 where statype=-60 and DocEntry=M.DocEntry) as ' Cess ', (SELECT Avg(TaxRate) FROM INV4 where statype=-55 and DocEntry=M.DocEntry) as ' HCess % ', (SELECT Sum(TaxSum) FROM INV4 where statype=-55 and DocEntry=M.DocEntry) as ' Hcess ', L.LineTotal as 'Row Total (Rs.)',M.DocTotal as 'Doc Total' FROM OINV M LEFT OUTER JOIN INV1 L on L.DocEntry=M.DocEntry LEFT OUTER JOIN INV4 T on T.DocEntry=L.DocEntry and L.LineNum=T.LineNum LEFT OUTER JOIN INV5 J ON M.DocEntry = J.AbsEntry LEFT OUTER JOIN INV3 Q ON M.DocEntry = Q.DocEntry WHERE (M.DocDate >= '[%0]' AND M.DocDate <= '[%1]') AND TargetType ! = 14 GROUP BY M.DocNum,M.DocDate,M.CardName,M.NumAtCard,M.DocEntry,M.DiscSum,M.WTSum,L.Dscription,L.Quantity,L.Price,L.LineTotal,M.DocTotal ORDER BY M.DocNum,M.DocDate,M.CardName,M.NumAtCard,M.DocEntry,M.DiscSum,M.WTSum,L.Dscription,L.Quantity,L.Price,L.LineTotal,M.DocTotal
    I want 2 queries which asks tax code during selection criteria for both cases sales and purchase.

    Hi Malhotra,
    Try this,
    1st remove the FROM/TO Doc. Date where Condition in your Query report.
    AND add the below where condition in your Query report.
    WHERE statype = '[%0]'
    OR
    Try this Query Report.
    SELECT
    M.DocNum as 'A/R Invoice No.',
    M.DocDate as 'Inv. Date',
    M.CardCode as 'Customer Code',
    M.CardName as 'Customer Name',
    M.NumAtCard as 'Bill No. & Date',
    ISNULL(L.ItemCode,'Service Item') as 'Item Code',
    L.Dscription,
    L.Quantity,
    L.LineTotal,
    L.TaxCode,
    L.[VatSum],
    M.WTSum AS 'TDS (Rs.)',
    M.DocTotal as 'Total (Rs.)'
    FROM OINV M
    LEFT OUTER JOIN INV1 L on L.DocEntry=M.DocEntry
    LEFT OUTER JOIN INV4 T on T.DocEntry=L.DocEntry and L.LineNum=T.LineNum
    LEFT OUTER JOIN INV5 J ON M.DocEntry = J.AbsEntry
    LEFT OUTER JOIN INV3 Q ON M.DocEntry = Q.DocEntry
    WHERE
    (M.DocDate >= '[%0]' AND M.DocDate <= '[%1]')
    AND
    L.TaxCode='[%2]'
    GROUP BY
    M.DocNum,M.DocDate,M.CardCode,M.CardName,M.NumAtCard,L.ItemCode,L.Dscription,L.Quantity,
    L.LineTotal,M.DocEntry,M.[DiscSum],L.TaxCode,L.[VatSum],M.WTSum,M.DocTotal
    ORDER BY
    M.DocNum,M.DocDate,M.CardCode,M.CardName,M.NumAtCard,L.ItemCode,L.Dscription,L.Quantity,
    L.LineTotal,M.DocEntry,M.[DiscSum],L.TaxCode,L.[VatSum],M.WTSum,M.DocTotal
    Regards,
    Madhan.

  • PS report: multible selection for report selection criteria

    Is there a possibility to define multible selections in the report selection variables of a PS hierarchy report?
    I tried to define them via
    CJE6 -> EDIT -> General data selction
    and entered valiables in the FROM column and the TO column. But when I execute the report it will not show multible selction, but only single selection. Also, I did not find a SAP standard report which has multible selection in the report selection criteria screen.
    I found the multible selections only in the DB profile selection screen and the dynamic selection, but that is not the solution I am searching for.
    Can anybody kindly help me with this?

    E.g. S_ALR_87013532
    here you can see multible selection in the DB profile selection group, but not in the report selection group. I would like to use multible selection in the report selection group, as mentioned above.
    I am aware of the possibility of creating a new DB profile, but this is only my option B.

  • How to use a subreport field as selection criteria for the main report

    Dear All,
       I created a report with one subreport and im comparing information from both reports but i need to apply selection criteria in the main report using one of the fields in the subreport, the problem is that the subreport field doesnt appear in the select expert screen. By any chance, someone knows how make a subreport field be used by the select expert.
    Thanks,
    Martha Medrano

    Dear Dom,
       I created the subreport table called IIM (748 items) in sql in the main report as you suggested with the below code:
    SELECT "IIM"."IPROD", "IIM"."IDESC", "IIM"."IID"
    FROM   "S102F360"."BPCS405CDF"."IIM" "IIM"
    WHERE   NOT ("IIM"."IDESC" LIKE 'GEN%' OR "IIM"."IDESC" LIKE 'OBS%') AND "IIM"."IID"<>'IZ' AND "IIM"."IPROD" LIKE '3%'
    and i have another table called ITEM_MASTER (3221 items):
    SELECT "ITEM_MASTER"."ITEM_ID", "ITEM_MASTER"."DESCRIPTION"
    FROM   "WHSPRO"."dbo"."ITEM_MASTER" "ITEM_MASTER"
    ORDER BY "ITEM_MASTER"."ITEM_ID"
    and im trying to display all items in the ITEM_MASTER table that are not in the IIM file but i haven't been able to accomplish this, i am using as primary the ITEM_MASTER table with 'Inner Join' as Join Type,  and '!=" as Link Type. Do you have any ideas on how can i display the requested items.
    Thanks for your help

  • TPM_MIGRATION No position exists for the selected criteria Msg no. TRQ0020

    Hello Experts.
    I'm facing a error when execute the STEP B06 in TPM_MIGRATION Transaction, the message was:
    No position exists for the selected criteria
    Message no. TRQ0020
    Diagnosis
    This is the position that is characterized by the following details:
    CC=1020;PT=V4I;SA=DEPBCCR;SE=1000013
    When I look the Security ID number in the old system, the Document is obsolete, but the migration transaction seek the FLOW information for this ID number and not return any information.
    Thanks for you help.
    Regards.
    Edited by: k3n_rao on Mar 31, 2011 7:32 PM

    Hi Lorenz,
    Thank you very much for the answer, My colleague, the one who posted the threat is not longer available, he went on hollydays.
    We did check TPM12 & TPM13  and the reports said:
    TPM12 : "no positions selected"
    TPM13: "No flows found"
    Just to double check that we have understood, which "Migration date"  are you reffering to?
    thank you very much
    best regards,

Maybe you are looking for