on 11-10-2009 4:14 PM
Hi,
I am expanding Easy Document Management 6 SP14 via c++ code and I am trying to send a parameter value to a RFC function.
I have succeeded calling a RFC function that requires no parameters.
I have a pointer that points to the function, but I couldn't find a way to point to the parameter and send a value to it.
I will appreciate any help (and code example if possible).
Thanks,
Eitam
Hi,
I created a custom transaction that allows the user to enter a project code (like in cj20n transaction) and then gives him the "project tree" which there he can choose an activity to connect the document to it.
In Easy DMS, after the user insert a document, when he will do a right click on it, in the context menu he will see "Add Doc To Project". when he will click on it an RFC function will run and open my custom transaction (until here everything works fine) and send the document parameters to it (here is the problem. I can't send any parameter from the c++ code to the RFC function).
I tried to send a parameter (string) from the c++ code to my RFC function (that gets string as import parameter) with no success.
The RFC function (that I used for the testing) looks like this:
if im_param = 'TEST'.
call-transaction cv04n.
else
call-transaction cj20n.
In the c++ code I tried various ways (including yours) to call this function with parameter="TEST" with no luck (it always opens cj20n and never cv04n).
for example:
pRfc->InitFunction(L"MyRfcFunction",VARIANT_TRUE);
pRfc->Field(L"im_param ")->String=(LPCTSTR)"TEST";
pRfc->Call();
another way that I tried:
ISapRfcFunction * f_Rfc;
f_Rfc = p_Rfc->GetFunction(L"MyRfcFunction",VARIANT_TRUE);
f_Rfc->GetParameter(L"im_param ")->String=(LPCTSTR)"TEST";
f_Rfc->call(0);
Many Thanks for your help.
Eitam
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I guess you can achieve this functionality by implementing BADI methods - EASYDMS_EXT_UI-GET_FUNCTION_LIST & PROCESS_FUNCTION. and write the logic for transaction call in ABAP itself. make sure use_sapguiis is set to 2.
check FM- EASYDMS_FUNCT_CALLED & EASYDMS_FUNCT_GET_LIST; notes: 821930
Regards
Surjit
Hi ,
If you are not showing any Vc++/win32 user interfaces, then implementing the BAdIu2019s as explained in the above thread or implementing equivalent Z_EASYDMS_FUNCT_CALLED & Z_EASYDMS_FUNCT_GET_LIST will be easier to realise this task. (It is always advisable to implement BAdI's than Z function modules)
For the existing plug-in issue:
As per your above reply I assume now there is no compile time error now? or is there one?
If yes, please post the complete error string and the code segment while there is no compile time error.
If no, then it is a run time issue. You can check what is really passed to your RFC function module by debugging the backend. You can easy find the note associated on how to debug EasyDMS in one of the forum threads! (I am too lazy to find it out) . Then check what is the value passed to the function module and trace the flow.
Hope this helps.
Jomerce
Edited by: Jomerce PJ on Nov 18, 2009 11:38 AM
>
> In the c++ code I tried various ways (including yours) to call this function with parameter="TEST" with no luck (it always opens cj20n and never cv04n).
>
> for example:
> pRfc->InitFunction(L"MyRfcFunction",VARIANT_TRUE);
> pRfc->Field(L"im_param ")->String=(LPCTSTR)"TEST";
> pRfc->Call();
>
Try fieldname as uppercase. Parameter names (and function names) are uppercase in the SAP.
OK guys, I finally did it (with the c++ option) and I just want to give some tips for the next ones:
For importing parameters use the "Tables" tab in your RFC function, and not in the "Import" tab.
And in your c++ code, don't forget to use the APPEND command after filling each row in the table you defined in the "Tables" tab.
Thanks to everyone for the help.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi guys,
unfortunately I coulden't send parameters to RFC functions as you all described (get the message "This function is not yet implemented" when using Rfc->Field...), so I chose to follow SAP note 821930 which describes how to do something similar in ABAP code (I only need the selected document parameters).
The problem is that in my code I open SAP gui (as I did in my c++ code: pRfc->InitFunction(L"MyRfcFunction",VARIANT_TRUE),
but now I don't know how to send the connection parameters from easyDMS to my ABAP function that perform the "call transaction" method.
my code:
FUNCTION Z_EASYDMS_FUNCT_GET_LIST. (from note 821930)
*"----
""Local Interface:
*" TABLES
*" DOCUMENTS STRUCTURE BAPI_DOC_FILES2 OPTIONAL
*" EXT_FUNCTIONS STRUCTURE ZEASYDMS_EXT_FUNC OPTIONAL
*"----
ext_functions-functioncode = 'Z_MY_FUNCTION'.
ext_functions-displayname = 'Add Doc To Project'.
APPEND ext_functions TO ext_functions.
ENDFUNCTION.
FUNCTION z_easydms_funct_called. (from note 821930)
*"----
""Local Interface:
*" IMPORTING
*" VALUE(FUNCTIONCODE) LIKE SY-UCOMM OPTIONAL
*" EXPORTING
*" VALUE(RETURN) TYPE BAPIRET2
*" TABLES
*" DOCUMENTS STRUCTURE BAPI_DOC_FILES2 OPTIONAL
*"----
IF functioncode = 'Z_MY_FUNCTION'.
CALL FUNCTION 'Z_MY_FUNCTION'.
ENDIF.
ENDFUNCTION.
FUNCTION Z_MY_FUNCTION.
call transaction 'CJ20N'
ENDFUNCTION.
now nothing happens, but if I run first my old c++ code (from easyDMS context menu I choose what I've created in c++ which basically does "pRfc->InitFunction(L"MyRfcFunction",VARIANT_TRUE)" ) and then run the implementation above from the context menu it will work (the sap gui will open because it gets the connection parameters from the c++).
Thanks for your help,
Eitam
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks again for your help guys,
I've implemented the functions Z_EASYDMS_FUNCT_GET_LIST and Z_EASYDMS_FUNCT_CALLED, but Z_EASYDMS_FUNCT_GET_LIST caused the context menu to disappear (right click doesn't open it anymore).
This is the implementation:
FUNCTION Z_EASYDMS_FUNCT_GET_LIST.
*"----
""Local Interface:
*" TABLES
*" DOCUMENTS STRUCTURE BAPI_DOC_FILES2 OPTIONAL
*" EXT_FUNCTIONS STRUCTURE ZEASYDMS_EXT_FUNC OPTIONAL
*"----
ext_functions-functioncode = 'MyRfcFunction'.
ext_functions-displayname = 'Add Doc To Project'.
APPEND ext_functions TO ext_functions.
ENDFUNCTION.
FUNCTION z_easydms_funct_called.
*"----
""Local Interface:
*" IMPORTING
*" VALUE(FUNCTIONCODE) LIKE SY-UCOMM OPTIONAL
*" EXPORTING
*" VALUE(RETURN) TYPE BAPIRET2
*" TABLES
*" DOCUMENTS STRUCTURE BAPI_DOC_FILES2 OPTIONAL
*"----
IF functioncode = 'MyRfcFunction'.
return-message = 'Add Doc To Project called.'.
return-type = 'I'.
ENDIF.
ENDFUNCTION.
Can you see what is wrong in it? And how I will be able to transfer a document parameter to 'MyRfcFunction'?
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for your help.
I have tried something similar in eDM 6 SP14, and now I updated my version to SP15 to try your proposal but still no luck. now I am getting the message "Function has not been implemented yet" when using my expansion in eDM (calling the RFC function with a parameter). What causing this message to appear? the RFC function or something in my C++ code? (the RFC function should be open in sap gui and show a popup)?
by the way, your wiki is great!!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Thanks! can you please post the code segment.
1) What code segment worked without error while you made a rfc call without parameters?
2) Code segment that is throwing error?
3) Complete error statement.
Also there are multiple ways to achieve customizations in EasyDMS. writing a c++ plug-in is one of them and mainly used if requires a c++(windows) rich UI.
The functionality you are trying to achieve may be also possible with an ABAP based customization in EasyDMS. If you do not mind to post what you are trying to achieve, there might be simpler way to achieve it!
Jomerce
I have updated wiki http://wiki.sdn.sap.com/wiki/x/fwbEB with code example. Warning:- Not compiled/not tested. But I think it works if used with Sp15.Will not work with SP14 because of the line. CSapRfcLock rfcLock(reinterpret_cast<CRITICAL_SECTION*>(pRfc->RfcCriticalSessionPtr)); . Comment out if trying with SP14. Good Luck!
Edited by: Jomerce PJ on Nov 11, 2009 7:34 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
104 | |
12 | |
11 | |
6 | |
6 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.