Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to determine if FM is triggered from other system?

Former Member
0 Kudos

Hi Experts,

I have a requirement that creates and updates a contract via transaction ME31K and ME32K and triggers ME_CREATE_DOCUMENT and ME_UPDATE_DOCUMENT respectively.

Aside from that, contract should also be created or changed from other system via an RFC FM but I don't know if SY-CPROG is enough. What I did is I filtered my change by SY-TCODE (for ECC process) and SY-CPROG (for via RFC process). Am I correct to use SY-CPROG for RFC process?

Thanks,

Trixa

8 REPLIES 8

deepan_v_s
Active Participant
0 Kudos

Hello Trixa,

So this means that you are making change or creating copy of standard code  ME_CREATE_DOCUMENT into custom code ??

In case of RFC process, the FM in ECC will be called by other system and data which is passed will be used to create contract in ECC. i don't know why you are having such query.

Regards,

Deepan.

0 Kudos

Hi Deepan,

No I'm not copying a standard code but adding an enhancement in ME_CREATE_DOCUMENT and ME_UPDATE_DOCUMENT. I have to clear EKKO-FRGGR and EKKO-FRGSX before saving but I need to filter my change by SY-TCODE and SY-CPROG.

Thanks,

Gibi

0 Kudos

Hello Trixa,

yeah i understand your requirement completely now.

So if the RFC FM is called from some other system, then it should trigger new enhancement changes or vice versa.

But if you check it via sy-code to check if the creation / change is done via ECC. This case is just fine.

But this will work only in the contract is created vie ME31K. What Contract is created using standard BAPI. ?? in this case i assume your approach will fail.

Regards,

Deepan.

0 Kudos

Hi Deepan,

The RFC FM is BBP_ES_OA_UPDATE. I debugged via SE37 and it triggers ME_CREATE_DOCUMENT and ME_UPDATE_DOCUMENT.

Thanks,

Trixa

0 Kudos

Hi Trixia,

I assume then SY-CPROG should do the job. But not sure how this behaves for RFC call.

Regards,

Deepan Swaminathan.

0 Kudos

hi Trixa,

You can make use of sy-uname, i mean to say, just quote 'if sy-uname NE 'your_user_name' ' so that the function will not trigger when you check with your login - just to make sure that the RFC is triggering or not.

To add more, it needs to enable 'Update debugging' to make RFC active.

Regards,

Suren.

0 Kudos

Hello,

Or you can use FM RFC_SYSTEM_INFO and get the caller information and if the System id of FM output is different from SY-SYSID then this is an RFC call.

Check below link for reference,

https://scn.sap.com/message/13152726#13152726

Regards,

Deepan.

raymond_giuseppi
Active Contributor
0 Kudos

Try to call RFC_GET_SYSTEM_INFO with destination BACK, if you are executed by a RFC call it will return original system in RFCSI_EXPORT-RFCSYSID. (This FM execute RFC_SYSTEM_INFO in the destination provided)

Regards,

Raymond