‎2016 Aug 09 9:44 AM
Hello @all,
I've got a problem by calling the function "RH_STRUC_GET_MULTIPLE_ROOTS" with parameter-table. I always get an CX_SY_DYN_CALL_PARAM_MISSING - exception. The reason of the exception: 'NULL' datareference.
Here is my sample, in which I only fill the required Parameters:
*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*" IMPORTING
*" VALUE(ACT_WEGID) LIKE GDSTR-WEGID
*" TABLES
*" ROOT_OBJECTS STRUCTURE HRROOTOB
*" EXCEPTIONS
*" NO_PLVAR_FOUND
*" NO_ENTRY_FOUND
*" PATH_NOT_FOUND
*" ROOT_NOT_FOUND
*" UNKNOWN_ERROR
*"----------------------------------------------------------------------
DATA: L_TAB_PTAB TYPE ABAP_FUNC_PARMBIND_TAB,
L_TAB_ETAB TYPE ABAP_FUNC_EXCPBIND_TAB,
L_STR_PTAB TYPE ABAP_FUNC_PARMBIND.
"***************************
" Importparameter
L_STR_PTAB-KIND = ABAP_FUNC_IMPORTING.
L_STR_PTAB-NAME = 'ACT_WEGID'.
L_STR_PTAB-VALUE = REF #( ACT_WEGID ).
INSERT L_STR_PTAB INTO TABLE L_TAB_PTAB.
CLEAR L_STR_PTAB.
L_STR_PTAB-KIND = ABAP_FUNC_TABLES.
L_STR_PTAB-NAME = 'ROOT_OBJECTS'.
GET REFERENCE OF ROOT_OBJECTS INTO L_STR_PTAB-TABLES_WA.
INSERT L_STR_PTAB INTO TABLE L_TAB_PTAB.
CLEAR L_STR_PTAB.
"****************************************
" ExceptionTable
L_TAB_ETAB = VALUE #( ( NAME = 'NO_PLVAR_FOUND' VALUE = 1 )
( NAME = 'NO_ENTRY_FOUND' VALUE = 2 )
( NAME = 'PATH_NOT_FOUND' VALUE = 3 )
( NAME = 'ROOT_NOT_FOUND' VALUE = 4 )
( NAME = 'OTHERS' VALUE = 5 ) ).
CALL FUNCTION 'RH_STRUC_GET_MULTIPLE_ROOTS'
PARAMETER-TABLE L_TAB_PTAB
EXCEPTION-TABLE L_TAB_ETAB.
‎2016 Aug 09 11:28 AM
thank you. Now I'm one step forward. 🙂 But now I got exception "MISSING_PARAMETER ACT_WEGID", but this parameter exists in the parameter table.
‎2016 Aug 09 10:12 AM
the reference to the internal table that you want to passed needs to be assigned with the VALUE field of the parameter table (just like your other import parameter)
'TABLES_WA' is to pass a structure ("workarea") that will be related to the internal table as it's header line - if desired/necessary
L_STR_PTAB-KIND = ABAP_FUNC_TABLES.
L_STR_PTAB-NAME = 'ROOT_OBJECTS'.
GET REFERENCE OF ROOT_OBJECTS INTO L_STR_PTAB-VALUE.
INSERT L_STR_PTAB INTO TABLE L_TAB_PTAB.
CLEAR L_STR_PTAB.
‎2016 Aug 09 11:28 AM
thank you. Now I'm one step forward. 🙂 But now I got exception "MISSING_PARAMETER ACT_WEGID", but this parameter exists in the parameter table.
‎2016 Aug 09 11:38 AM
i assume you want to pass IN the parameter 'ACT_WEGID' ... so it should look like below:-
L_STR_PTAB-KIND = ABAP_FUNC_EXPORTING.
L_STR_PTAB-NAME = 'ACT_WEGID'.
L_STR_PTAB-VALUE = REF #( ACT_WEGID ).
INSERT L_STR_PTAB INTO TABLE L_TAB_PTAB.
CLEAR L_STR_PTAB.
because you are calling the FM... thus you EXPORT the value to it ... (from the FM's perspective it is 'importing' the parameter values. that is why you define it in that section)
‎2016 Aug 09 11:45 AM
oh my god...all ok...sometimes I'm so stupid. I should go home 😉
‎2016 Aug 09 12:07 PM
Just curious: why are you using the dynamic version of CALL FUNCTION here, as the static call would be much more easy to write?
‎2016 Aug 09 12:14 PM
because I want to encapsulate these function as remote function. Not all parameters are used by the rfc call. So I can check every parameter, if it's REQUESTED and when yes, I add them to the parameter table. Some functions are reading additional data, if an special exporting parameter is requested.
‎2016 Aug 09 12:26 PM