Hi All,
Just thought of sharing a small piece of code which help you a lot in indentifying the BW system or Info package details at R/3 system while you write your custom code in CMOD at data source level. This code will help you in following below situations.
Remote Function Call: If you need to call Function Module written in BW system from R/3 system for any manual manipulation.
0.1. To Identify BW Load request details at CMOD code Level.
0.1. When a R/3 system is connected to Couple of BW system.
0.1. From one R/3 system when the data has to be sent differently for same data source to two different BW systems at CMOD level.
I don’t how many of us has faced such situation, but definitely, a system with large landscapes might have such issue or scenarios, for them the below piece of code will be helpful.
Scenario1.
Consider a R/3 system having a CMOD code for one of the data source and there you have been given a situation to identify few data from BW system based on that , records from R/3 has to be fetched to complete your extraction. Now in order to achieve this, a Function Module has been written in BW system to fetch the data, but that Function module has to be called from R/3 system using Remote function call, situation seems to very simple, but while you write the code in R/3 system there comes a complexity to identify from which BW system(either QA or Dev OR PRD) the data has to be read, because you can’t write same code in your Dev, Quality and Production System, as the client and system name will differs accordingly your remote call system will differ
If you are having only three systems then you can go ahead and hardcode the BW system values as DEV, QA, PRD using if condition and your R/3 system client details you can write your code, but tomorrow if one more system called ( Sandbox or Readiness) has been added, in that case again you have to go ahead and change the code again to work in that environment which makes you complex each and every time, so in order to avoid such situation, there is run time structure which identifies your Info package details, accordingly you can get your Target system details from your IP and pass that value in your remote Function Module to get the BW data from R/3 system for your manual calculations.
R/3 System: BKTCLNT010.
BW system: BWSCLNT010.
Code to be Used in your CMOD
* </p><p>Constants: C_receipt TYPE char28 VALUE '(SBIE0001)L_S_REQUEST-RCVPRN', "Logical System</p><p>FIELD-SYMBOLS: TYPE logsys. </p><p>DATA: bw_logsys type logsys. </p><p>ASSIGN (c_receipt) TO .</p><p> </p><p>bw_logsys = .</p><p> **** This Populates the value of RCVPRN from the structure L_S_REQUEST which is shown below******</p><p>Screenshot take from background R/3 job during debugging.</p><p> * * !https://weblogs.sdn.sap.com/weblogs/images/252198275/R3_BG.jpg|height=469|alt=R3 Job |width=450|src=https://weblogs.sdn.sap.com/weblogs/images/252198275/R3_BG.jpg|border=border: 0; vertical-align: top;!</strong></strong></p><p> * * </strong></strong></p><p>***this shows from where which system the IP is triggered to find the BW client details from R/3 during Run time****</p><p>End Of Code to be Used in your CMOD*
By using the above value bw_logsys( this holds the value of RCVPRN of the structure l_s_request), you can pass that value in the remote function call to read data from corresponding BW system and results will be from your BW system based on Function Module logic.
* </p><p>Eg:</p><p>CALL FUNCTION 'ZREAD_BWDATA' DESTINATION bw_LOGSYS</p><p>EXPORTING</p><p> DSONAME= 'ZCCA_10'</p><p> Up_mode = 'D'</p><p> IMPORTING</p><p> Data = it data.</p><p> </p><p> </p><p>**This is will return my ZCCA_10 DSO data for my manipulations at cmod level**</p><p> </p><p> </p><p>Scenario 2:</p><p>Consider you have two BW systems connected to one R/3 system. The BW system has Data source with same name, but the data from R/3 system has to go differently to two BW systems for same data sources as per the system requirements where the field is custom field. Since the data sources are same in your CMOD code of R/3 system, you can’t go with two different case statement for the same datasource in the, so how this can be handled?</p><p> </p><p>Code to be Used in your CMOD</p><p> </p><p>Constants: C_receipt TYPE char28 VALUE '(SBIE0001)L_S_REQUEST-RCVPRN', "Logical System</p><p>FIELD-SYMBOLS: TYPE any. </p><p>ASSIGN (c_receipt) TO .</p><p>**Now <fs_receipt> will have the data of the whole structure l_s_request, from this you can get your needed details accordingly***. </p><p>End Of Code to be Used in your CMOD</p><p> *
The above piece of code help you in getting the BW system details from your R/3 system.
Now using the field RCVPRN, you can identify your BW system details and accordingly logic can be written in CMOD code for same data source using IF condition to send the data accordingly.
Eg:
* </p><p>Case i_datasource.</p><p> </p><p>WHEN '2LIS_11_VAITM'.</p><p> </p><p>IF -RCVPRN EQ ‘BWSCLNT010’.</p><p> </p><p> Own logic </p><p> </p><p>Else if IF -RCVPRN EQ ‘AWSCLNT010’.</p><p>Own logic.</p><p> </p><p>ELSE.</p><p>Own logic.</p><p> </p><p>Endif.*
Here the structure *L SREQUEST *has so many fields, but I have taken a example of *RCVPRN for my requirement, so u can use available fields for your own requirements , screen shot of the structure is attached below.</p><p> </p><p>As you all aware once the info package is triggered an R/3 job will be triggered, below is the screen shot been taken from R/3 job during debugging. Here the Structure says all the details of BW job triggered , from here you can capture your needed details.</p><p> </p><p>Eg:</p><p> </p><p>R/3 System: BKTCLNT010.</p><p>BW system: BWSCLNT010.</p><p> </p><p> </p><p>Triggered a info package from BWSCLNT010 system.</p><p> !https://weblogs.sdn.sap.com/weblogs/images/252198275/IP.jpg|height=351|alt=IpDetails from BW system|width=650|src=https://weblogs.sdn.sap.com/weblogs/images/252198275/IP.jpg!</p><p> </p><p>R/3 Job Screenshot for the triggered IP.*
!https://weblogs.sdn.sap.com/weblogs/images/252198275/R3_BG.jpg|height=469|alt=R3 Job |width=450|src=https://weblogs.sdn.sap.com/weblogs/images/252198275/R3_BG.jpg!</body>
Hi Nanda,
ReplyDeleteImages are not visible...Could you post them again.
Regards
KP
Im obliged for the blog article.Thanks Again. Awesome.
ReplyDeletepython online training
python training