Ansicht
Dokumentation

SAPAPO/CMDS_SL_DATE - BAdI: Edit User-Defined Period Formats

SAPAPO/CMDS_SL_DATE - BAdI: Edit User-Defined Period Formats

RFUMSV00 - Advance Return for Tax on Sales/Purchases   CPI1466 during Backup  
This documentation is copyright by SAP AG.
SAP E-Book

You use this Business-Add-In (BAdI) to define and use your own periods, for example industry months, for sales scheduling agreement schedule lines. This means that you are also able to receive and process scheduling agreement releases from your customers that contain quantities for periods other than days, weeks or months.

This Business-Add-In is used in the component Sales Scheduling Agreement Processing (SCM-APO-PPS-CDS).

This BAdI is called up in the following cases:

  • When releases are created or changed in master data maintenance for sales scheduling agreements (Execute Function).
  • When you create new releases that you have received as IDocs.
  • When you generate a due delivery schedule from the forecast/planning delivery schedule and/or operative delivery schedule, if a delivery schedule split is carried out.

Periods (and their period type) are saved in the database as a date (internally). Depending on the implementation you have made the user either sees a period as a date or a period (external display).
Using the two BAdI methods the periods are converted to a date. It must also be possible to convert the date saved in the database into the corresponding period.

Example
If you use industry months, then the industry month March 2003 runs from March 3rd to March 28th and the industry month April from March 31st to May 4th.
If the user enters a schedule line in the industry month March 03 then 03.03.2003 is saved internally to the database as the start date of the period.
If the user enters a schedule line for March 31st (with the period type industry month) then the date is converted into the corresponding period, that is April 03. The start date of the period (31.01.2003) is saved internally.

If you use your own periods you should note the following:

  1. Define the period types that you want to use in the table /SAPAPO/TPRG.
You can use the following as your own period types:
Internal period type External period type Description (Alterable)
'A' '1' User-defined 1
'B' '2' User-defined 2
... ... ...
'I' '9' User-defined 9
'J' '0' User-defined 10

Note
Other types are not possible because these are predefined in the programs as constants.
The external name can be changed in the table /SAPAPO/TPRG.
  1. Define both methods.
If you define your own periods then you must implement the following methods:
  • CONVERT_TO_EXTERN
    This method must convert the date saved internally in the database to the external period display, dependent on the period type.
    This method is used to convert the internal format of the period (internal period type, date) to the external format of the period (external period type, external period display).

  • CONVERT_TO_INTERN
    This method must convert the external period format to the internal period format, that is, a date, dependent on the period type.
    In addition, this method must be capable of correctly converting other formats entered by the user.

  1. If you want the system to take user-defined periods, for example industry months, into account in the delivery schedule split when the due delivery schedule is generated then:

  • The delivery schedule splitting rule and profile must be assigned for the corresponding date or period type.

'0'

This BAdI is not active as a default.

'0'

After you have called the IMG activity, proceed as follows:

  1. In the following dialog box, enter in the field "Implementation" a name for the BAdI implementation and choose Copy.
If implementations have already been created for the BAdI, a dialog box with the existing implementations will be displayed. In this dialog box, choose Create.
  1. In the corresponding field, enter a short text for implementation .
  2. In the tab Propertiesenter filter properties - if this is a filter-dependent BAdI.
  3. Choose the tab Interface.
The name of the implementing class is generated by the system based on the name of your impmlementation. You can change the name.
If the BAdI is a menu exit, the tab FCodes also appears.Enter a function here and, if necessary, additional data.
  1. Save your entries and assign a package.
  2. Position the cursor on a method. Call up the Class Builder by double-clicking it.
  3. Between the statements method <Interface-Name>~<Name of Method>. and endmethod, enter the coding you request for the implementation.
  4. Save and activate your coding, and navigate back to the screen Change Implementation.
  5. Save on the screen Change Implementation.
Note: You can first create an implementation for the BAdI and then activate this later on. In this case, close the processing function at this time.
  1. Choose Activate.
When the application program is executed, the coding you have created will be run.
'0'

To display example coding choose Goto -> Example Coding -> Display.

Example Implementation

Your customers send you the requirements for an industry month in scheduling agreement releases.

The industry month contains all weeks in which the Wednesday falls within the same calendar month. Unlike in the calendar month, when you work with industry months a week is not split between different months. Instead it is always added to an industry month whole.
The week begins on Monday and ends on Sunday. This means that an industry month always begins on a Monday and ends on a Sunday.
The user sees the first day of the industry month (external format). The external display of the industry month is the first day of the month.
Internally, the industry month is also stored as the first day of the industry month. If the whole period is required internally, for example, for a delivery schedule split, then both the first and the last day of the industry month are used.
The internal period type A and the external period type 1 are used for the industry month. The descriptions used are Industriemonat (German) and Industry Month (English).

Procedure

  1. In the table /SAPAPO/TPRG define your own period type industry month in the language you want to use. If you want to use German and English then you must make the following entries:
Language Date Type (ext.) Date Type (int.) Date Type (Descr.) Print Output
(SPRAS) (PRGBZ) (PRGRS) PRGTX) PRITX)
DE 1 A Industriemonat IMonat
EN 1 A Industry month IMonth

  1. Implement the method CONVERT_TO_EXTERN so that the internally stored date of period type A (industry month) is output as a date.
    The example implementation of the method contains exactly this definition.
  2. Implement the method CONVERT_TO_INTERN in such a way that the user can enter the period with period type A (or external 1 = industry month) as a date. The user can enter the date in any of the usual formats, for example, 01.01.2002, 010102 and so on.
    The method must calculate the start and the end of the corresponding industry month from this entry, from which a date lying in the middle of the industry month is moved to the beginning of the industry month.
    In this way the date 01.01.2001 becomes the industry month 31.12.2000 - 03.02.2001.
    The example implementation of the method contains exactly this implementation.
  3. Once you have carried out steps 1 to 3 you can enter industry months when you are manually creating or changing releases for sales scheduling agreements. You do this by selecting the date type (period type) 1 (industry month) and entering a date that lies in the industry month. (Transaction Maintain Sales Scheduling Agreement /SAPAPO/SCO1)
You can also create schedule lines for industry months using IDocs which contain the period type (PRGRS) 1 (Industry Month) in the schedule line segment (E1EDP16) in which the date (EDATUV/EDATUB) must be filled accordingly.
  1. In the IDoc, if you choose F4-Help for the period type you always see User-defined 1, whilst in sales scheduling agreement maintenance you see Industry Month. For technical reasons this cannot be changed.
Industry month

Methods

Conversion of Internal Date to External Period Display (CONVERT_TO_EXTERN)

Conversion of External Period Display to Internal Date (CONVERT_TO_INTERN)

Interfaces

/SAPAPO/IF_EX_CMDS_SL_DATE






RFUMSV00 - Advance Return for Tax on Sales/Purchases   PERFORM Short Reference  
This documentation is copyright by SAP AG.

Length: 12907 Date: 20240523 Time: 194818     sap01-206 ( 155 ms )