12-18-2008 5:41 AM
Hello Experts,
I Want to know if there is a way out for the following problem :
I have a function Z_FPLM_GET_MARA_DATA which returns me two things : Structure of MARA and Structure Of MARC (These two are the export parameters for the function).
Now when I call this function in my program, I only pass a data object corresponding to export parameter MARA like follows:
CALL FUNCTION Z_FPLM_GET_MARA_DATA
EXPORTING
matnr = 'XYZ'
IMPORTING
es_mara = ls_mara
*es_makt =
Is there a way that I can restrict the processing of my function based on the parameters passed.
I mean to say that if a dataobject for export parameter MARA is passed(like in the call above), the function bypasses the inside processing for MAKT.
Similarly, if MAKT only is passed, the processing for MARA is bypassed.
Please help me out.
Thanks/Regards,
Himanshu
12-18-2008 5:46 AM
Hi,
This is very simple with the use of IS SUPPLIED logical expression.
So you have to code like;
IF es_mara IS SUPPLIED.
"Process and return es_mara.
ENDIF.
IF es_makt IS SUPPLIED.
"Process and return es_makt.
ENDIF.
This will solve your problem. See F1 help for IS SUPPLIED for more details.
Regards
Karthik D
12-18-2008 5:46 AM
Hi,
This is very simple with the use of IS SUPPLIED logical expression.
So you have to code like;
IF es_mara IS SUPPLIED.
"Process and return es_mara.
ENDIF.
IF es_makt IS SUPPLIED.
"Process and return es_makt.
ENDIF.
This will solve your problem. See F1 help for IS SUPPLIED for more details.
Regards
Karthik D
12-18-2008 5:47 AM
Dear,
independent of importing staructures i.e. is_mara and is_makt, will execute the entire function module.
If u give only is_mara sttructure, FM will transfer data only into that structure.
If u want bypass the code related to is_mara or is_makt, u need to use conditions.
Regards
12-18-2008 5:54 AM
Hi Himanshu,
As it is a Z Function Module, we are under the impression that you have created this. If yes, then
as per your question, based on the importing parameters that you pass to the FM, you CANNOT restrict the processing inside the function module.
There is an alternative. You can define another Exporting parameter, lets say a FLAG. Using this flag, you can restrict the processing of MARA/ MAKT inside the function module.
LV_FLAG = 'X'.
CALL FUNCTION Z_FPLM_GET_MARA_DATA
EXPORTING
matnr = 'XYZ'
flag = lv_flag
IMPORTING
es_mara = ls_mara
*es_makt =
Inside the FM, you can mention the condition as
IF LV_FLAG = 'X'.
" Process Mara
ELSE.
" Process MAKT
ENDIF.
Best Regards,
Ram.
12-18-2008 6:00 AM