ABAP routine for ATP check

Hi all...Is there any existing ABAP routine which does ATP check (material availability and allocation check) ??

fm 'BAPI_MATERIAL_AVAILABILITY'
BR< JAcek

Similar Messages

  • ABAP Routine  for 0FISCPER  slect options in InfoPackage

    Hi,
    I am trying to write an ABAP Routine for 0FISCPER as select options (range) dynamically.
    Ex:
    0FISCPER selection for this year as 001.2008 to 012.2008
    0FISCPER selection for next year as 001.2009 to 012.2009.
    Now  we are changing InfoPackage every year manually, so I need to write a routine for 0FISCPER in InfoPackage to handle dynamically every year
    Thanks,
    SK.

    Hi
    write an ABAP routine to get that value..But are you getting any planned data(why you want till end of the year...till infopackage runs is o.k i think, if you don't have planned data)...Any way you can check the below code, which can be useful...
    You can see the below code at->your infopackage selections>Ty-->choose variable type as 6 and enter any ABAP routine name( to create) and then there is a button on the application tool bar called 'routine info'..this give you the following information...
    Definition
    You can define complex selections for InfoPackages and control the automatic deletion of requests from InfoCubes in the scheduler, by using routines.
    Routines are processing blocks in ABAP programs that consist of a pre-defined data declaration section and an ABAP subroutine (form routine). In the subroutine you can use all of the ABAP programming functions.
    You can use the following routines for making selections in InfoPackages:
    1. Selection routines for fields, on the Data Selection tab page
    2. Selection routines for file names, on the External Data tab page
    3. Selection Routines for selecting the from and to dates for time-dependent data, on tab page Update
    4. Selection routines for determining old requests to be deleted after successfully loading a new request, on the Data Target tab page
    Program frame:
    After you have called up the Editor for routine maintenance, you get the following program frame:
    1. Selection routines for fields, on tab page Data Selection:
    program conversion_routine.
    '$*$ begin of global - insert your declaration only below this line -
    TABLES: ...
    DATA:   ...
    $$ end of global - insert your declaration only before this line    -
    FORM COMPUTE_<Fieldname>
      tables l_t_range structure rssdlrange
      changing p_subrc like sy-subrc.
    $$ begin of routine - insert your code only below this line       -
      data: l_idx like sy-tabix.
            read table l_t_range with key
                 fieldname = <Fieldname>.
            l_idx = sy-tabix.
            modify l_t_range index l_idx.
            p_subrc = 0.
    $$ end of routine - insert your code only before this line       -
    ENDFORM.
    2. Selection routines for file names, on tabstrip External Data:
    FORM compute_flat_file_filename
         changing p_filename like rsldpsel-filename
              p_subrc like sy-subrc.
    $$ begin of routine - insert your code only below this line-
              p_filename =
              p_subrc = 0.
    $$ end of routine - insert your code only before this line-
    ENDFORM.
    3. Selection routines for selecting the from and to date for time-dependent data, on tabstrip Update:
    form compute_time_dependent_dates
         changing p_datefrom type d
                  p_dateto   type d
               p_subrc like sy-subrc.
    $$ begin of routine - insert your code only below this line-
              p_datefrom =
              p_dateto   =
              p_subrc = 0.
    $$ end of routine - insert your code only before this line-
    ENDFORM.
    4. Routines for determining the old requests to be deleted after successfully loading a new request, on tab page Data Targets:
    form compute_<InfoCube-Name>
      tables l_t_request_to_delete structure rsreqdelstruc
      using l_request like rsreqdone-rnr
      changing p_subrc like sy-subrc.
    *Insert Source Code to decide if requests should be deleted.
    *All Requests in table l_t_request_to_delete will be deleted
    *from Infocube <InfoCube-Name>.
    *Add new requests if you want to delete more (from this cube).
    *Remove requests you did not want to be deleted.
    $$ begin of routine - insert your code only below this line-
         loop at l_t_request_to_delete.
         endloop.
         clear p_subrc.
    $$ end of routine - insert your code only before this line-
    ENDFORM.
    Note:
    Those fields flagged with <...> are dependent on the selection fields and are filled automatically by the system when you call up the Editor.
    Procedure
    Make the following entries:
    1. Between $$ begin of global ... and $$ end of global ... you can define data declarations. These are the declaration sections for the local data in the routine. This data is only visible in the routines.
    2. The subroutines begin with FORM and end with ENDFORM.
    The subroutines for the particular routines are:
    Selection routines for fields on tab page Data Selection: FORM COMPUTE_<Field name>
    Selection routines for file names on tab page External Data : FORM compute_flat_file_filename
    Selection routines for selecting the from and to dates for time-dependent data on tab page Update: FORM compute_time_dependent_dates
    Routines for determining old requests to be deleted after successfully loading a new request on tab page Data Target: FORM COMPUTE_<InfoCube-Name>
    The subprograms have the following parameters:
    Subprogram FORM COMPUTE_<Field name>:
    l_t_range
    In the table l_t_range the routines for all selection fields that are filled, or have a routine, are made available.
    The routines are executed in the scheduler last of all and therefore, you can change all the selections that you have carried out previously.
    p_subrc
    Using the variable p_subrc you can report errors to the scheduler. p_subrc <> 0 signals an error and means the data request is terminated.
    Subprogram FORM compute_flat_file_filename:
    p_filename:
    You give the name of the file that is to be loaded in parameter p_filename.
    This is useful if your file name contains date dependencies that should be determined by sy-datum and calculated during runtime.
    p_subrc
    You can inform the scheduler of an error with variable p_subrc. p_subrc <> 0 signals an error and means that the data request is terminated.
    Subprogram FORM compute_time_dependent_dates:
    p_datefrom and p_dateto
    Fill these parameters with the from and to dates for time-dependent master data and texts.
    p_subrc
    You can inform the scheduler about an error using variable >LS>p_subrc. p_subrc <> 0 signals an error and means the data request is terminated.
    Subprogram FORM COMPUTE_<InfoCube-Name>:
    l_t_request_to_delete
    You give the request number of the request that is to be deleted in parameter l_t_request_to_delete. You can also delete requests from the table. These are then not deleted.
    p_subrc
    You can inform the scheduler about an error with the variable p_subrc. p_subrc  signals an error and means the data request is terminated.
    3. Insert your program code for the routines between $$ begin of routine ... and $$ end of routine ... so that the respective subprogram variables are supplied with the corresponding values.
    4. Check the syntax of your routine with the Check function.
    5. You can then transfer the routine with the Save function.
    You end routine maintenance when you exit the Editor.
    Hope it helps
    Thanks,
    Teja

  • ABAP routine for loading data of current month in InfoPackage

    Hello experts,
    I want to load data of current month. Therefore I implemented the following ABAP-Routine for field 0CALDAY in the InfoPackage's data selection:
    data: lv_datum_l like sy-datum,
             lv_datum_h like sy-datum. 
      concatenate sy-datum(6) '01' into lv_datum_l.
      call function 'RP_LAST_DAY_OF_MONTHS'
      exporting
      day_in = sy-datum
      importing
      last_day_of_month = lv_datum_h.
      l_t_range-sign = 'I'.
      l_t_range-option = 'BT'.
      l_t_range-low = lv_datum_l.
      l_t_range-high = lv_datum_h.
    But function 'RP_LAST_DAY_OF_MONTHS' cannot be found!
    Any other suggestions for getting last day of current month?
    regards
    hiza

    Hi,
    Add this code. When u complete execution of this code, ZDATE will have ur month end date.
    data : zdate_c(2) type c,
           zyear_c(4) type c,
           zmonth_c(2) type c.
    data :  zdate like sy-datum.
    data :  zday(2) type n.
    zdate = sy-datum
          zyear_c = zdate(4).
          zmonth_c = zdate+4(2).
          zdate_c = '01'.
          concatenate zyear_c zmonth_c zdate_c into zdate.
          CALL FUNCTION 'FIMA_END_OF_MONTH_DETERMINE'
          EXPORTING
            I_DATE         = zdate
          IMPORTING
            E_DAYS_OF_MONTH = NO_OF_DAYS.
          zday = NO_OF_DAYS.
          concatenate zyear_c zmonth_c zday into zdate.

  • Abap Routine for Date selection in Infopackage

    Hi
    I have to write an abap routine for date selections in the infopackage,
    There are two date begda and enda.
    Do i code for BEGDA and fill in the begin date using routine and use another routine to fill the ENDA.
    JPJP

    Hi JP,
      If you have two info objects BEGDA and ENDA in the Info package for selection
      then you will have to write seperate routine for each of them.
      If you want to give single value for each date field then update only the field l_t_range- low otherwise if you want to give range then you can update the internal table fields l_t_range-low and l_t_range-high .
    Regards,
    Prakash

  • 3rd party process using product allocation for ATP-check

    Hi all,
    is there anybody out there who can share experience in setting up the 3rd party process using product allocation on APO for ATP-check? As the documentation is not that impressive any help is higly appreceated.
    Thanks
    Michael

    This will not be correct forum to reply to your query.
    Still, try following Hyperlink for some understanding,
    [Third-Party Order Processing by Product Allocation|http://help.sap.com/saphelp_scm70/helpdata/EN/7c/2b7941601b030de10000000a1550b0/frameset.htm]
    Thanks & Regards
    JP

  • Using ABAP routines for data selection

    Hello,
    I want to use ABAP routine to determine value range of data selection in Data Package but when I use routine for one field, selection criterias for other fields are ignored, e.g.:
    in Data Package I have two selection fields:
    CPUDT     Accounting Document Entry Date
    AEDAT     Date of the Last Document Change by Transaction
    For CPUDT I wrote ABAP routine
    and for AEDAT I have just typed in period of time.
    I started data extraction and open Monitor for this Data Package.
    At Header tag I checked selections info and there is selection only for CPUDT.
    Could somebody explain me is it normal system behaviour?
    Thanks
    Andrzej

    Thanks for reply but that would be too easy...
    I have tried your advice but nothing changed.
    I think this is data extraction configuration problem.
    Andrzej

  • ABAP Routine for Deleting and creating index for ODS in Process chains

    Any pointers for the ABAP Routine code for deleting and creating index for ODS in Process chains.

    Hi Sachin,
    find the following ABAP code to delete ODS ondex.
    data : v_ods type RSDODSOBJECT.
    move 'ODSname' to v_ods .
    CALL FUNCTION 'RSSM_PROCESS_ODS_DROP_INDEXES'
      EXPORTING
        I_ODS = v_ods.
    To create index:
    data : v_ods type RSDODSOBJECT.
    move 'ODSname' to v_ods .
    CALL FUNCTION 'RSSM_PROCESS_ODS_CREA_INDEXES'
      EXPORTING
        I_ODS = v_ods.
    hope it helps....
    regards,
    Raju

  • InfoPackage ABAP Routine for Date Range - Only Start Date Extracted

    I am using an ABAP Routine in an InfoPackage to select data for a 2 year period.  The routine converts SY-DATUM into the Current Fiscal Year and Period, and then calculates the Starting and Ending Fiscal Year / Period of a 24 month period.  The Start and End values are passed to the InfoPackage as l_t_range-low and l_t_range-high.
    The Source and Target are both Basic Infocubes.
    The InfoPackage executes successfully, and the Selection values on the Header tab of the monitor reflect a 24 month period.  Unfortunately, on closer review of the data in the cube, only data for the first month appears to have been loaded.  I’m guessing that the extract was only performed with the From value, even though a To value was also provided.
    I created a simple Infopackage and manually input the selection parameter values just to be sure I wasn’t overlooking something. The InfoPackage performed as expected, loading more data which spanned the selection time period.
    I can provide the code if it helps, but the fact that the monitor reflects a Start and End value suggests that the problem is with the InfoPackage, not the ABAP routine.
    Has anybody ever experienced this before ?  Any ideas would be greatly appreciated ?
    Thanks,
    Lyle

    We can write ABAP routine in Infopackage with a range of values (From & To). Make sure you fill all the following information while building the final range information as below,
       l_s_range-sign    = 'I'.
       l_s_range-option  = 'BT'.
       l_s_range-low     = lowvalue.
       l_s_range-high    = highvalue.
      MODIFY l_t_range FROM l_s_range INDEX l_idx.
    As you can see the key is passing the "BT" information for capturing range.
    Hope it helps..
    thanks
    Kumar

  • ABAP routine for Top 10 material

    Hi All,
    I want to write an ABAP routine to get the Top 10 material as per their sales data.
    I have written a query where I have put condition (for Top 10).
    But I need to create an APD taking this query as base query. But conditions fail to filter data when it comes into a transactional ODS via an APD.
    So, I want to write a routine for transaformation of data (to get top 10 material based on their sales data) from base query to the transactional ODS.
    Please help me in writing this code.
    I am an amatuer in ABAP.
    Thanks,
    SB

    Hi ,
    You Need to read Data from the ODS for Top 10 Materials. I can give you the Logic but you would need to take the Help of an ABAPPER to convert this into the code
    Lets consider an ODS : ZODS which has a KF for Sales Data (ZKF)
    *****Define Internal Table ****************
    TABLES :
    /BIC/AZODS
    DATA:
    BEGIN of ITAB OCCURS 0,
        0material(18)       TYPE c,
        ZKF           like /bic/AZODS-/bic/ZKF,
    END OF ITAB.
    DATA:
    BEGIN of ITAB1 OCCURS 0,
        0material(18)       TYPE c,
        ZKF           like /bic/AZODS-/bic/ZKF,
    END OF ITAB1.
    Select MATERIAL, /BIC/ZKF from /BIC/AZODS into corresponding fields of ITAB1.
    LOOP AT ITAB1
    ITAB-MATERIAL = ITAB1-MATERIAL
    ITAB-ZKF= ITAB1-ZKF
    COLLECT ITAB.
    ENDLOOP.
    SORT ITAB ZKF.
    ************this will have the materials sorted take the first 10 Material Nos*****

  • CO09 and BAPI_MATERIAL_AVAILABILITY for ATP Check

    Hi all,
    On R/3 4.6c...
    I am trying to find if there is a BAPI or funciton module out there which I can use to get the material availability (ATP quantity) as per the results of CO09.
    I looked at BAPI_MATERIAL_AVAILABILITY but the BAPI only accepts the checking rule. This does not have a switch to check with requirements. On CO09, there is a check box which allows us to check with requirements or not (With reqmts quants).
    For my ATP check, I would like the system to assume that the total requirements quantity is taken into account during the availability check, rather than the quantities that have already been committed.
    This is required for a system to system call hence the need for a BAPI or funciton module.
    Thanks for any help!
    Fred

    Hi,
    You can get the ATP quantity by using function module 'AVAILABILITY_CHECK'.
       ls_atpcsx-matnr  = lt_ekpo-matnr.
       ls_atpcsx-werks  = 'D001'.
       ls_atpcsx-prreg  = '01'.
       ls_atpcsx-lgort  = 'CS'.
       ls_atpcsx-idxatp = '1'.
       ls_atpcsx-chkflg = 'X'.
       ls_atpcsx-bdter  = sy-datum.
       APPEND ls_atpcsx to lt_atpcsx.
       clear ls_atpcsx.
       CALL FUNCTION 'AVAILABILITY_CHECK'
         TABLES
           p_atpcsx            = lt_atpcsx
         EXCEPTIONS
           ERROR               = 1
           OTHERS              = 2.
       IF sy-subrc = 0.
         READ TABLE lt_atpcsx INTO ls_atpcsx INDEX 1.
         it_result_cspo-atpqty = ls_atpcsx-atpm1.
         REFRESH lt_atpcsx.
         clear ls_atpcsx.
       ENDIF.

  • ABAP Routine for FISCPER

    Dear members
    Y would like your help to create an abap routine into the infopackage.
    I want to obtain last period from current month (sy-datum), for the characteristic 0fiscper at the infopackage
    those anyone know how to create a routine that do that?
    For example
    2010001 to 2009012
    Thanks
    Ariel

    Give tnis a try:
    Global Declarations
    CONSTANTS: c_1(1) TYPE n VALUE 1,
               c_fiscvarnt TYPE /bi0/oifiscvarnt VALUE 'Z1',  "Use whatever your default Fiscal Year Variant is"
               c_i(1) TYPE c VALUE 'I',
               c_bt(2) TYPE c VALUE 'BT'.
    DATA: l_tabix LIKE sy-tabix,
          l_fiscper3 TYPE /bi0/oifiscper3,
          l_fiscyear TYPE /bi0/oifiscyear,
          l_min TYPE /bi0/oifiscper,
          l_max LIKE /bi0/oifiscper.
    Routine
    CLEAR: l_fiscper3,
           l_fiscyear.
    CALL FUNCTION
      'DATE_TO_PERIOD_CONVERT'
    EXPORTING
      i_date  = sy-datum
      i_periv = c_fiscvarnt
    IMPORTING
      e_buper = l_fiscper3
      e_gjahr = l_fiscyear.
    CONCATENATE: l_fiscyear l_fiscper3 INTO l_max.
    l_fiscper3 = l_fiscper3 - c_1.
    IF l_fiscper3 LT 1.
      l_fiscyear = l_fiscyear - c_1.
      l_fiscper3 = c_1.
    ENDIF.
    CONCATENATE: l_fiscyear l_fiscper3 INTO l_min.
    READ TABLE
      l_t_range
    WITH KEY
      fieldname = 'FISCPER'.
    MOVE: sy-tabix TO l_tabix,
          c_i TO l_t_range-sign,
          c_bt TO l_t_range-option,
          l_min TO l_t_range-low,
          l_max TO l_t_range-high.
    MODIFY
      l_t_range
    INDEX
      l_tabix.
    p_subrc = 0.

  • Warehouse blocked for ATP Check

    Hello Everybody.
    I need create a warehouse with the characteristic that the stock in this warehouse must not be considered in the ATP check.
    Where I can customize this characteristic?
    Thanks in advance.

    Silvia,
    Warehouse management has nothing to do with ATP check. ATP check works at IM level only, please control it through SLoc.
    - you can use SLoc MRP to exlude SLoc from planning and ATP check
    http://help.sap.com/erp2005_ehp_04/helpdata/EN/f4/7d2d2644af11d182b40000e829fbfe/frameset.htm
    - you can exlude ceratain stock types from ATP check - see SPRO > Sales and Distribution > Basic Functions > Availibility Check and Trnasfer of Requirements > Availability Check > AC with ATP Logic or Against Planning > Carry out Control For Availability Check (OVZ9)
    - you can use MRP area
    http://help.sap.com/erp2005_ehp_04/helpdata/EN/c4/106956ae8a11d1a6720000e83235d4/frameset.htm
    Regards,
    Csaba

  • BPI req for ATP check

    Hi All,
    kindly suggest some bapi for material ATP check.
    Thanks

    Search the forum - it's been discussed many times.  A basic SE37 search or BAPI search would also give you the answer...

  • How to read a word in a abap program for syntax check

    program for finding keywords:
    into a given program name in selection screen.
    e.g Parameters Keyword in YXABC propgram.
    How to find a word in a abap program for syntax check

    Hi!
    Read table TNAPR for the program names.
    Then use the READ REPORT  statement for it and load the program into an internal table.
    Then loop at the table.
    Regards
    Tamá

  • ABAP routin for geeting previous month

    Hello.......
    I want to writ an ABAP routin at the infopackage level.
    I want to get the previous month ( period ).
    example : if sy-datum is 2007.01.01
    output : 2006.12.01.
    reply.
    Thanks in advance.

    Hi,
    Write this in the start routine of infosource or update rules...
    Try this:
      DATA: L_DATE LIKE SY-DATUM.
      DATA: L_YEAR TYPE I.
      DATA: L_MONTH TYPE I.
      L_DATE = (Here enter your input).
      MOVE '01' TO L_DATE+6(2).
      MOVE L_DATE(4) TO L_YEAR.
      MOVE L_DATE+4(2) TO L_MONTH.
      L_MONTH = L_MONTH - 1.
      IF L_MONTH LT 1.
        L_YEAR = L_YEAR - 1.
        L_MONTH = 12.
      ENDIF.
      MOVE L_YEAR TO L_DATE(4).
      MOVE L_MONTH TO L_DATE+4(2).
      MOVE:  L_DATE TO P_DATE.
    Hope this helps
    PB

Maybe you are looking for

  • Using iMac G5 as a display for Macbook

    Is there any possibility to use iMac G5 20'' as a display for my new Macbook.

  • Saving in Acrobat 9 and Opening file in Acrobat 8... text wrap does not work

    I work with a client who has Acrobat 8, I use Acrobat 9. I am saving a pdf that has form fields that need to wrap text and scroll. They have the properties of "multi-line" and "scroll text" already checked, and when I test it on my computer, the text

  • How to go fullscreen in windows instead of full display?

    I'm trying to find a way to tell Firefox that fulscreen = window size as opposed to my display size. ie, when I have a floating window (not-maximized, taking up only part of the screen) I want Firefox to be contained in that window instead of taking

  • CF4.5 on Linux crashing

    In the last week or so the service has started crashing regularly. I'm new to CF so have looked into this like I would any other web app. There haven't been any changes made to code on the server since some time before this started happening. And the

  • FI CO Reconciliation

    Hi Experts, I need to answer a question for our client which is not using SAP New GL... so I need to find an answer in the past... thanks for your helps, FX Question: Determine the cause, corrective action, or reconciliation measures to remedy differ