FUNCTION z_bapi_login.
*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*"  IMPORTING
*"     VALUE(ID) TYPE  SCUSTOM-ID
*"     VALUE(NAME) TYPE  SCUSTOM-NAME
*"  EXPORTING
*"     VALUE(CUSTOM) TYPE  SCUSTOM
*"  TABLES
*"      RETURN STRUCTURE  BAPIRET2 OPTIONAL
*"----------------------------------------------------------------------

  SELECT SINGLE * FROM scustom INTO custom
    WHERE id   = id
    AND   name = name.
  IF sy-subrc <> 0.
*   Login-Daten nicht korrekt
    CALL FUNCTION 'BALW_BAPIRETURN_GET2'
      EXPORTING
        type   = 'E'
        cl     = 'BC_IBF'
        number = 001
      IMPORTING
        return = return.
  ELSE.
    CALL FUNCTION 'BALW_BAPIRETURN_GET2'
      EXPORTING
        type   = 'I'
        cl     = 'BC_IBF'
        number = 000
      IMPORTING
        return = return.
  ENDIF.
  APPEND return.
ENDFUNCTION.