09-10-2014 12:45 PM
Hi ,
I am not able to get desired result from function module.
RFC_GET_ATTRIBUTES.
Actually I am trying to get SY-TCODE from caller programe which is a web service because all the check which are available in my BADI are based on Sy-Tcode which is not having the value at run time(Blank when called from outside). Hence I am TRING TO fetch s-tcode using this FM RFC_GET_ATTRIBUTES but still it is failed.
Kindly Suggest some solution.
Regards:
Himanshu Sharma.
09-10-2014 1:56 PM
Well transaction code is often undefined in background or other not transaction environment...
Regards,
Raymond
09-10-2014 1:26 PM
09-10-2014 2:34 PM
Hi Neal,
Thanks for your support.
I am wondering why this standard function module is not giving desired result.
Well it is working as Set parameter ID in starting of BAPI call and Get Parameter ID just before the BADI check. It is working.
Can you help me in this function module method.
Regards:
Himanshu Sharma
09-10-2014 3:19 PM
It is working as SAP always works. An alternative is to use an export import pair. When you would have set the PID, export. When you would have read the PID, import. You may have to export to database instead of memory.
Neal
09-10-2014 1:56 PM
Well transaction code is often undefined in background or other not transaction environment...
Regards,
Raymond
09-10-2014 2:44 PM
HI Raymond,
Thanks for your reply.
In regard to your second point.
yes, BADI is being executed in BAPI environment.
What I have done is: I have set parameter ID before calling BAPI(RFC) and putting Get Parameter ID at before the BADI check.
E.G.
Set Parameter ID 'VT01N' Field 'PID' "Just before Bapi is called
CALL FUNCTION 'BAPI_SHIPMENT_CREATE'
-----
-----
Get parameter ID 'LTCODE' field 'PID'.
use ltcode instead of sy-tcode.
If SY-TCODE = 'VT01N ' OR LTCODE = ' '.
endif.
It is working in this way. But is their any Better Solution ??
Please suggest.
Thanks.
Regards:
Himanshu Sharma
09-10-2014 3:02 PM
No you solution works and is clean, it's okay. Another solution would have to analyze the abap call stack in the BAdI to identify the caller (FM SYSTEM_CALLSTACK) but only if you want the BADI react the same way every call from this BAPI (so you no longuer have to code the SET PARAMETER ID before each call, and clear it after)
Regards,
Raymond