SMOD and CMOD related explanation

SMOD and CMODs:

As you know either in ECC or BW systems there are SMOD and CMODs separately.

In the beginning of the code implementation we go to SMOD and search for the required enhancements like as shown below of which we have to which Enhancement matches our requirement. And our requirement might be to enhance a “datasource” (in BW side or in ECC side) or usual “BEx Variable” or special “Virtual characteristics & Keyfigures”, these are only the popular ones that we generally used (which are also highlighted in bold color)

RFBVX001  Enhancement for bank directory transfer (Austria)

RFFOX001  Frame for user exit RFFOX001 (in program RFFOD__L)

RFFOX002  Frame for user exit RFFOX002 (in program RFFOD__U)

RHALE001  HR-CA: Enhancement for ALE functionality in HR

RHGB0001  Function Group RHGB Customer-specific field (list)

RHGP0001  FuGr RHGP Customer-Specific Field (List)

RHIV0001  OrgManagement: Customer-specific number assignment

RMCSTEXT  LIS: Determine Characteristic Texts in Standard Analyse

RSAP0001  Customer function calls in the service API

RSR00001  BI: Enhancements for Global Variables in Reporting

RSR00002  BI: Virtual Characteristics and Key Figures in Reportin

RSR00003  BW: Moving characteristic values

RTR00010  Exit in report tree (display transactions)

RTR00020  Exit in node in report tree (change mode)

In the below discussion we will be discussing on one of the popular enhancements i.e., RSAP0001 which is a std enhancement used for enhancing DATASOURCES (either in ECC or BW). Firstly we go T code SMOD and select our Enhancement i.e., RSAP0001

Below are the attributes of the enhancement RSAP0001

When we click on the “Components” button in the attributes screen of the enhancement

In the above screen when we double click on the Function module “EXIT_SAPLRSAP_001” (which is a Function module for enhancing Transaction datasources) the system will take you to the below screenAfter reaching the source code tab of the Transaction Data function module, we have to double click on the INCLUDE “ZXRSAU01” to write our ABAP logic. As we are writing the logic for the first time we will get the below shown error message (when we double click on the include ZXRSAU01)After getting the above information it is evident that we are writing the ABAP code for the first time, so in order to write our ABAP logic we have to create (its kind of activating the include) this include eventhough its available in SMOD. In order to create the object we have just press the “ENTER” key in the source tab of the function module, then a pop up appears which is as shown below, where we select ‘YES’After clicking the ‘YES’ button, the system will take us into the area where enhancement are to be written. After that we write our ABAP code, save, check and activate the include (ZXRSAU01), activate our Function module ‘EXIT_SAPLRSAP_001’. After activating Function module, our necessity with respect to SMOD is complete.

Now we go to T code CMOD (in the same system), where in which we create a PROJECT, say ZTEST (as shown below)Save the project after giving the description as shown below.After saving the project and before assigning the enhancement (RSAP0001) to project (ZTEST) when we click on the components buttons the status will be as shown below
Below is the screen shot of the error message which appears when we click on the components button of the project in CMOD before assigning any enhancementNow when we click on the enhancement button as shown in the screen shot above the system will take us to the below screen which is as shown in the below screen shotAfter entering our enhancement in the required row we have to save the assignment. And back to the initial CMOD screen (just by typing the T code)After assigning the Enhancement (here RSAP001) to the project (here ZTEST), when we click on the ‘COMPONENTS’ button then we can see our function module, EXIT_SAPLRSAP_001 for T D along with our FM we can see other FMs as well because those are also the part of the enhancement but the thing is the include in those another 3 FMs is not active we have to just go into those FMs individually and activate the respective includes (FYI –  every we activate the project ZTEST whenever there is a change)

FYI – CMOD is the way given by SAP to write our ABAP logic in the system, in other words, we are actually writing the code in SMOD but SAP has provided a way to execute the ABAP logic written by customer thru CMOD by creating a project and this project is linked to SMOD after activation

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++As discussed above (in the beginning) there are different enhancements for different purposes and below is the enhancement for BEx Variables.

Posted in Uncategorized | Leave a comment

Enhancement of Datasource in ECC

This code is been written to add the fields (DMBTR, WRBTR) to 2lis_02_itm. FYI – The procedure to extract the data from the extractors is same as that we follow for BEx Customer exit variables. WHEN ‘2LIS_02_ITM’. DATA : L_S_MC02M_0ITM … Continue reading

More Galleries | Leave a comment

Behavior of ‘Format’ field in the BI Datasource

The date field in above file screen shot is in external format (mm/dd/yyyy) if we load the data with FORMAT type as “Internal” in the datasource and when we see the preview in DSource for part of the data (shown above) will be successfully loaded because the month in these values have not exceeded the number 12 and day’s values have not exceeded the number 31. After activating the DS, if we see the data in preview then it will be definitely incorrect.

To get the correct data to be loaded and to be displayed correctly:

Say, if the date field which we’ve maintained in the Flatfile is of External type (mm/dd/yyyy) then when loading we have to select the External type compulsorily and have to maintain corresponding EXIT if the conversion exit if its is not mentioned in the Infoobject’s design (here in this case for External format like mm/dd/yyyy we have to use RSDAT EXIT, as conversion exit’s value is empty in InfoObject). If we maintain FORMAT as “Internal” but if we still keep above mentioned external format in Flat file then the system will show wrong data or the upload will fail.

In another scenario wherein if we use the RSDAT Conversion Exit and still keep the FORMAT as “Internal” in the DS then the system throws an error message that the conversion exit is not being Executed which means the Exit is not being utilized as you are beforehand giving the format as internal (this scenario is popularly known as Alpha Non Confirming Value error).

So finally if the data in the flat file is of External type we need to tell the system that the field is in External format and we should also use the Exact Conversion exit (if the conversion exit is not maintained in the Infoobject definition) to load data correctly and to display the data correctly

 

 

 

Posted in Uncategorized | Leave a comment

Process Type “Decision Between Multiple Alternative”

“Decision Between Multiple Alternative” Process Type is used little less when compared to other process types, as the situations that require this process type is less. We need to have knowledge of the formulae that we use in “Decision Between Multiple Alternative”.

Below is the screen shot of the Table T009B with fiscal year variant N1

Starting and Closing fiscal year of variant N1 are from 1st Jan 2012 to 31st Dec 2012. And 1st period is from 1st Jan to 2012 to 28th Jan 2012. 2nd Period starts from 29th Jan to Feb 25th Feb 2012. From these examples you can say that every period comprises of 4 weeks.

Below is the screenshot of the Plan view of a chain. This chain is expected to run on first Sunday of the fiscal period or Last Saturday of the current period. Most of the information needed is written in the screenshots, and in the below screenshot the I have also shown the calendar which makes the understanding easy.

In the end of the document log views of the chains will be shown to show  how the chains behaved on weekdays and weekends of the last Saturday of a period and First Sunday of the next period. But now we will be going through design of a chain starting with Decision process type – ‘Week Day’


==> 

As shown in the above fig above with a title ‘Days numbered in a week’ (i.e., SAP Calendar),  we know that digit 6 means Saturday and digit 7 means Sunday as per fiscal year variant N1, may be the numbering of days change with fiscal year variant. The behavior of the process type “Decision Between Multiple Alternative” is that it executes the logic which is true among the options. And if there is only one option then it will validate that logic and decides to make it successful or not.

Following are the formulas to be written in the ‘0Bool’

  1. DATE_WEEKDAY1(SYST-DATUM) = 6 implies that it’s a Saturday.
  2. DATE_WEEKDAY1(SYST-DATUM) = 7 implies that it’s a Sunday., And leave the End of Else condition as is, without any formula.

===>

After the ‘Last Saturday of a period-Decision’ step there is another step (as shown in the plan view) which checks that, chain has reached that step after 21:00 hrs i.e., 9 PM of the last Saturday of that period. Below is the screen shot of the time decision step:

After the above 2 steps are completed successfully the rest of the chain gets complete, whose log view will shown at the end of the document. Now we will see the definitions given in the Decision step of the ‘First Sunday of the period’ (this branch is parallel to the last Saturday’s decision step). Just notice that there is no time restriction for this branch of the chain. 

1) Date_fiscper(current date, ‘n1’) <> Date_fiscper(Add_to_date(current date, 1-), ‘n1’)

==>  Date_fiscper(20120728, ‘N1’) <> Date_fiscper(add_to_date(20120728, 1-), ‘N1’)

==>  7 <> Date_fiscper(add_to_date(20120728- 1), ‘N1’)

==>  7 <> Date_fiscper((20120727), ‘N1’)

==>  7 <> 6 i.e., Period 7 <> Period 6 which is true, so step will get executed (i.e., Pass), one more thing here we have to notice is that, there is a fiscal Variant to consider.

From the above examples it is understood that if we want the First Sunday or Last Saturday of any period we have to write logic in such a way that a minimal difference in the number of days will result in change in a period. Here in this case, if we add digit 1 or subtract digit 1 then the resulting date would belong to another period.

Few examples:

2) If we want the steps to be executed on 2nd Sunday of August (i.e., 5th Aug 2012 with fiscal year variant as N1) then,

Like:

==> Date_fiscper(20120805, ‘N1’) <> Date_fiscper(add_to_date(20120805, 8-), ‘ N1’),

==> Date_fiscper(20120805, ‘ N1’) <> Date_fiscper(20120728, ‘ N1’)

==> Period 8 <> Period 7 is True the step will pass, etc.

3) If we want the steps to be executed on Last Saturday of July (i.e., 28th Jul 2012 with fiscal year variant as N1) then,

==> Date_fiscper(20120728, ‘N1’) <> Date_fiscper(add_to_date(20120728, 1), ‘ N1’),

==> Period 7 <> Period 8 which is true, so step will get executed.

And following are the log views of the chain on 26th, 28th, 29th and 30th of July 2012:

Posted in Uncategorized | Leave a comment

How to create STEPS for a job in SM37

Let me take an example to define a job with multiple steps within it.

We know that ‘BW BEx Query’ can be Extracted using rscrm_report (T. Code)

The following BW query has been created for the purpose of extracting Invoiced Sales History from the Infocube say ZSD_C06 (SD Invoice Cube).

  1. ZZSD_C06_Q012 – Invoiced Sales by Week

The following screen shot shows the queries displayed via transaction rscrm_report.  In order for a query to be available to rscrm_report the Release for OLE DB for OLAP box in the query properties must be checked (as of Version 3.1C of BW).

In order to schedule a periodic execution of a query extract we should first have a job name, for that purpose select the query via rscrm_report and execute manually.Here in this example we have chosen ZZSD_C06_Q0012 from the above screen.

Clicking the ‘Extract’ button will cause the Create Query Extract window to be displayed.  We have to Manual execute the extract in order to get a job’s technical name, which is further used in scheduling that job.

For the query the following information should be provided

ZZSD_C06_Q012 – Invoiced Sales by Week, Table name = ZTESTWKV2, Extract type = table, you can create new name for each run.

Providing the necessary information and clicking okay will result in the following screen which allows us to limit the query selections.  Give the required values for distribution channel and other selections.

Clicking execute will return the Report Definition screen where we can select the Batch Monitor button which displays the following screen

We can take the data from the table ZTESTWKV2 and write it to a flat file using a custom ABAP program

ZSALES_DATA_TO_TI which runs with a variant and this variant has the path of the file (say, Path name =/data/apps/SAP/outbox/).

NOTE:  File path destinations are provided via an NFS mount.  The O/S level file is created with an owner of ADM.  These files will be recognized by some kind of Tibco (like seebeyond).

The batch jobs can also be monitored via SM37 as well.    Below is screenshot has the daily job along with the Month to Date job.

In order to execute this extract periodically select the ‘Completed’ job and choose ‘Repeat Scheduling’ from the job menu as follows:

This will result in the familiar scheduling window:

At this point specific scheduling criteria (viz Once a day, Twice a day, Weekly or any other condition) can be established and saved.

After saving the ‘Scheduling Window’, when we view the job then it will be in ‘RELEASED’ state

In order to add the NEXT STEP, such as the ABAP program (ZSALES_DATA_TO_TI) that follows the execution of the Weekly sales extract (via RSCRM_REPORT) as 2nd step, and then to add the custom ABAP program  (ZSALES_MOVE_FILE) to move flat file from one server to another as a 3rd step, select the ‘RELEASED’ job via SM37 and choose ‘CHANGE’ from the job menu.

This results in the following screen:

From here we select the ‘Define Steps’ button, which will display the existing steps for this job (for now we have only one i.e., RSCRMREPORT_BAPI).

After going into the change mode, Click the ‘Create Step’ button and provide the necessary information as follows:

The result is a scheduled extract with multiple steps after it.

Repeat the above procedure to add 3rd step i.e., Another ABAP Program to move the file from one server to another. Finally after completing all the procedure the 3 steps are available as shown below:

Variant – SCHEDULED has values like written below:

/data/apps/SAP/outbox/WKLY_SLS.

/BIC/0CZTESTWKV2.

Radio Selections: Scheduled, P_Neo.

Variant SCHEDULE MOVE for the ABAP move program.

Posted in Uncategorized | Leave a comment

Hello world!

Welcome to WordPress.com! This is your very first post. Click the Edit link to modify or delete it, or start a new post. If you like, use this post to tell readers why you started this blog and what you plan to do with it.

Happy blogging!

Posted in Uncategorized | 1 Comment