Skip to Content
author's profile photo Former Member
Former Member

How to check what importing parameters have been passed to the function

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Dec 18, 2008 at 05: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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 18, 2008 at 05: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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 18, 2008 at 05: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.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 18, 2008 at 06:00 AM

    Thanks a lot Karthik.

    It has solved my problem.

    Regards,

    Himanshu

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.