Application Development and Automation 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: 
Read only

Problems with CALL function .... parameter-table....

reifa
Discoverer
0 Likes
3,020

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. 
1 ACCEPTED SOLUTION
Read only

reifa
Discoverer
0 Likes
1,994

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.

7 REPLIES 7
Read only

D_Chia
Active Participant
0 Likes
1,994

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.

Read only

reifa
Discoverer
0 Likes
1,995

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.

Read only

D_Chia
Active Participant
0 Likes
1,994

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)

Read only

reifa
Discoverer
0 Likes
1,994

oh my god...all ok...sometimes I'm so stupid. I should go home 😉

Read only

Sandra_Rossi
Active Contributor
0 Likes
1,994

Just curious: why are you using the dynamic version of CALL FUNCTION here, as the static call would be much more easy to write?

Read only

reifa
Discoverer
0 Likes
1,994

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.

Read only

Sandra_Rossi
Active Contributor
0 Likes
1,994

Thx. Sounds good.