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

pass by value in BAPI

Hi frnds,

I am new to BAPI. I have a doubt why we hav to give... both import as well as export parameter as PASS BY VALUE....

I M ALSO IN DOUBT REGARDING FORMAL PARAMETER AND ACTUAL PARAMETERS.... If i can get a simple example in that i can clear my doubt.

Thnaks to u all for helpful contribution.

regards,

suraj

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jul 03, 2007 at 05:32 AM

    www.sapdevelopment.co.uk/java/jco/bapi_jco.pdf

    Go through the attached link.It might be of some help .

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 03, 2007 at 05:31 AM

    go thru the code below

    * calling the BAPI to update the Asset Master AS02
      loop at it_final into is_final.
    
    * If updating of floor area only
        if p_farea = 'X'.
    * passing new area value to the BAPI
          is_realestate-area     = is_final-grufl.
          is_realestatex-area    = 'X'.
    
          call function 'BAPI_FIXEDASSET_CHANGE'
               exporting
                    companycode = is_final-bukrs
                    asset       = is_final-anln1
                    subnumber   = is_final-anln2
                    realestate  = is_realestate
                    realestatex = is_realestatex
               importing
                    return      = it_return.
    
    * If Asset Master is changed with out any errors
          read table it_return with key type = 'E'.
          if sy-subrc = 0.
            flag = ' '.
          else.
            flag = 'X'.
    * Call the COMMIT BAPI
            call function 'BAPI_TRANSACTION_COMMIT'
                 exporting
                      wait = 'X'.
            wait up to 2 seconds.
          endif.
    * If the Asset Master is changed with out any errors
          if flag = 'X'.
            read table it_output into is_output with key
                                      bukrs = is_final-bukrs
                                      anln1 = is_final-anln1
                                      anln2 = is_final-anln2
                                      binary search.
            if sy-subrc = 0.
    *          is_output-c_icon  = c_green.
              is_output-grufl_n = is_final-grufl.
              is_output-message = it_return-message.
    * Modify the output internal table with the changed new values
              modify it_output from is_output
                               transporting grufl_n message
                               where bukrs = is_output-bukrs
                                 and anln1 = is_output-anln1
                                 and anln2 = is_output-anln2.
            endif.
          elseif flag = ' '.
            read table it_output into is_output with key
                                      bukrs = is_final-bukrs
                                      anln1 = is_final-anln1
                                      anln2 = is_final-anln2
                                      binary search.
            if sy-subrc = 0.
    *          is_output-c_icon  = c_red.
              is_output-grufl_n = is_realestate-area.
              is_output-message = it_return-message.
    * Modify the output internal table with the changed new values
              modify it_output from is_output
                               transporting grufl_n message
                               where bukrs = is_output-bukrs
                                 and anln1 = is_output-anln1
                                 and anln2 = is_output-anln2.
            endif.
          endif.
    
        endif.
    
    * If updating of lease commencement date only
        if p_ldate = 'X'.
    * Passing new lease start date value to the BAPI
          is_leasing-start_date  = is_final-leabg.
          is_leasingx-start_date = 'X'.
    
    * Call the BAPI to change the Asset Master
          call function 'BAPI_FIXEDASSET_CHANGE'
               exporting
                    companycode = is_final-bukrs
                    asset       = is_final-anln1
                    subnumber   = is_final-anln2
                    leasing     = is_leasing
                    leasingx    = is_leasingx
               importing
                    return      = it_return.
    * If Asset Master is changed with out any errors
          read table it_return with key type = 'E'.
          if sy-subrc = 0.
            flag = ' '.
          else.
            flag = 'X'.
    * Call the COMMIT BAPI
            call function 'BAPI_TRANSACTION_COMMIT'
                 exporting
                      wait = 'X'.
            wait up to 2 seconds.
          endif.
    
    * If the Asset Master is changed with out any errors
          if flag = 'X'.
            read table it_output into is_output with key
                                      bukrs = is_final-bukrs
                                      anln1 = is_final-anln1
                                      anln2 = is_final-anln2
                                      binary search.
            if sy-subrc = 0.
    *          is_output-c_icon  = c_green.
              is_output-leabg_n = is_final-leabg.
              is_output-message = it_return-message.
    * Modify the output internal table with the changed new values
              modify it_output from is_output
                               transporting leabg_n message
                               where bukrs = is_output-bukrs
                                 and anln1 = is_output-anln1
                                 and anln2 = is_output-anln2.
            endif.
          elseif flag = ' '.
            read table it_output into is_output with key
                                      bukrs = is_final-bukrs
                                      anln1 = is_final-anln1
                                      anln2 = is_final-anln2
                                      binary search.
            if sy-subrc = 0.
    *          is_output-c_icon  = c_red.
              is_output-leabg_n = is_leasing-start_date.
              is_output-message = it_return-message.
    * Modify the output internal table with the changed new values
              modify it_output from is_output
                               transporting leabg_n message
                               where bukrs = is_output-bukrs
                                 and anln1 = is_output-anln1
                                 and anln2 = is_output-anln2.
            endif.
          endif.
        endif.
    
        clear : is_final, is_realestate, is_leasing,
                it_return, flag , is_output.
      endloop.

    Regards

    Gopi

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 03, 2007 at 05:39 AM

    Hi Suraj,

    BAPI's are generally RFC (Remote Function Calls) enabled function modules. In this type of FM's, we can not pass a parameter by reference. So, U see only Pass by Value option selected in both import and export parameters.

    Actual parameters: Lets suppose that u r calling a subroutine where u have different kind of parameters like TABLES, USING and CHANGING... these parameters are called as Actual Parameters...

    For Example: PERFORM F_GET_DATA TABLES G_ITAB

    USING LV_VAR1

    CHANGING LV_VAR2.

    Here G_ITAB, LV_VAR1 and LV_VAR2 are actual parameters...

    Formal Parameters: Names given to the actual parameters in subroutine definition are called as formal paramaters or formal names given to actual parameters...

    For Example: FORM F_GET_DATA TABLES P_G_ITAB

    USING P_LV_VAR1

    CHANGING P_LV_VAR2.

    ENDFORM.

    Here P_G_ITAB, P_LV_VAR1 and P_LV_VAR2 are formal parameters...

    Hope it clears your doubt...

    Regards,

    Phani.

    Message was edited by:

    Sivapuram Phani Kumar

    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.