cancel
Showing results for 
Search instead for 
Did you mean: 

Not able to receive data from a bapi with changing tables

achim_hauck2
Active Contributor
0 Kudos

hi,

i'm using a bapi that uses two changing tables. in the first table i have to input data before the call that gets updated and on the second table i just want to receive results.

but in the scond table i have to give an initial line, too, otherwise the bapi complains, that mandatory input fields are not filled.

the problem is, that i'm not able to get the values from the second table. even if i store not an empty line but some values in it, i receive exactly the same values in the output node of the table i stored before the call. if we add a line <b>manually</b> in the table <b>inside the bapi</b>, i receive this line additionally, too. but not the lines, that are evaluated during the bapi call.

is there a special thing to consider about changing tables (not using import/export tables)?

kr, achim

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member182372
Active Contributor
0 Kudos

Hi Achim,

Use tables not from input parameters but from output because they are becoming "output". Here is cite from Chris Whealy book: "...duplicate parameter names will be found on both input and output sides of interface. In this situation, the ABAP dictionary strustures used in these parameters types will appear both as children of the _Input and _Output clesses".

Best regards, Maksim Rashchynski.

Former Member
0 Kudos

Achim,

in Bapi's you can't use CHANGING.

You can only use IMPORT / EXPORT.

make sure you check 'pass by value' for all paramaters as well.

Regards,

Joris

Former Member
0 Kudos

I am surprised that you have an RFC Function Module which allows changing parameters.

No changing parameters are allowed in RFC R/3 Function Modules.

BAPI's are RFC enabled R/3 function modules.

Regards,

Subramanian V.

achim_hauck2
Active Contributor
0 Kudos

Subramanian,

see below the code we're using for the RFM.

on the ct_containers table i'm passing a line, and its getting updated after the call.

on the ct_errors table i just want to receive the errors and i only receive the line, we add manually there ('Serious error with validation code').

kr, achim


FUNCTION zbapi_ra_validations .
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     VALUE(IS_RA_SCREEN) TYPE  ZBAPI_S_RA_SCREEN
*"  CHANGING
*"     VALUE(CT_ERRORS) TYPE  ZRA_T_ERRORS
*"     VALUE(CT_CONTAINERS) TYPE  ZRA_T_CONT_IP
*"----------------------------------------------------------------------

  DATA:
    lo_badi_handle TYPE REF TO zra_validation_rule,
    ls_error       TYPE zra_s_error.


  GET BADI lo_badi_handle.


  TRY.
      CALL BADI lo_badi_handle->validate_rules
        EXPORTING
          is_screen_flds = is_ra_screen
        CHANGING
          ct_containers  = ct_containers
          ct_errors      = ct_errors.

    CATCH zcx_ra.
      ls_error-message = 'Serious error with validation code'.
      APPEND ls_error TO ct_errors.
  ENDTRY.



ENDFUNCTION.

if i call this rfm in SE37 the ct_errors table is populated with all errors and the manually created line.

Message was edited by: Achim Hauck