SAP BAPI를 사용하여 SAP에 데이터 쓰기의 예 package

SAP BAPI package 기능을 사용하여, 데이터를 SAP 데이터베이스에 쓰는 bot을 빌드합니다.

전제 조건

Download the SAP Java connector and dynamic library files (.dll file for Windows automation and .dylib file for macOS automation) from the SAP portal.

이 자습서에서는 SAP 데모 Flight Data 애플리케이션에서 BAPI_FLCUST_CREATEFROMDATA를 호출하는 bot을 구축합니다. CUSTOMER_DATA 가져오기 매개변수를 사용하여 고객 데이터를 BAPI에 전달합니다. 실행하면 bot은 SAP 데이터베이스에 새 고객 기록을 만들고 BAPI에서 반환한 고객 번호를 표시합니다.

이 자습서에서는 다음 작업을 수행하는 방법을 보여줍니다.
  • 구조 가져오기 명령을 사용하여 가져오기 매개변수의 값을 설정합니다.
  • SAP 테이블에 새 레코드를 만듭니다.
  • BAPI의 응답을 수신합니다.

프로시저

  1. botSAP-BAPI-CreateNewFlightCustomer이라는 을 만듭니다.
    1. Control Room에 로그인합니다.
    2. 왼쪽 창에서 자동화를 클릭합니다.
    3. Bot 생성 아이콘을 클릭합니다.
    4. 이름 필드에 SAP-BAPI-CreateNewFlightCustomer을 입력하고 생성 및 편집을 클릭합니다.
  2. To connect the bot to your SAP system, from the Actions panel, find SAP BAPI > Connect action and add it to the Bot editor.
    1. In JCo: SAP Java Connector package, specify the path to the Java connector .jar file.
    2. In JCo DLL/DYLIB dependency, specify the path to the dynamic library file.
      .dll for Windows automation and .dylib for macOS automation.
    3. Choose Custom Application Server as Connection Type.
    4. In Application server host name, specify the host name of the SAP application server.
      주: As a best practice, use the Credential Vault to specify sensitive information such as host name, user name, and password.
    5. In System number, enter the instance number.
    6. In SAP instance system ID, enter the system ID.
    7. In Client number, enter the client number.
    8. In Logon language code, enter EN or the language specific to your system.
    9. In Router string, enter the SAP router string.
    10. In Username, enter your SAP username.
    11. In Password, enter your password.
    12. Run the bot to test the connection.
      If you specify the correct connection properties, the bot executes successfully.
  3. 함수를 생성하려면 SAP BAPI > 함수 생성 작업을 추가합니다.
    1. 수 별칭 이름createNewFlightCustomer을 입력합니다.
    2. BAPI 이름BAPI_FLCUST_CREATEFROMDATA를 입력합니다.
  4. CUSTOMER_DATA 매개변수는 유형 구조이므로, 가져오기 매개변수의 구조를 가져와 별칭에 할당합니다. 이렇게 하려면 SAP BAPI > 구조 가져오기 작업을 추가해야 합니다.
    1. 수 별칭 이름createNewFlightCustomer을 입력합니다.
    2. 구조 이름CUSTOMER_DATA를 입력합니다.
    3. 검색된 구조를 별칭으로 저장하려면 대상에서 별칭 탭을 클릭합니다.
    4. 구조 별칭 생성에서 CustomerData를 입력합니다.
      이 별칭은 검색된 구조에 속하는 가져오기 필드에 대한 값을 설정할 때 사용합니다.
  5. CUSTNAME 필드의 값을 설정하려면 SAP BAPI > Set field value 작업을 추가합니다.
    1. 수 별칭 이름createNewFlightCustomer을 입력합니다.
    2. 소스에서 구조 탭을 클릭합니다.
    3. 구조 별칭CustomerData을 입력합니다.
    4. 필드 이름CUSTNAME를 입력합니다.
    5. 필드 값John Doe를 입력합니다.
  6. 5단계를 반복하여 다음 각 필드에 필드 값 설정 작업을 추가하고 구성합니다.
    필드 이름 필드 값
    거리 testStreet
    우편번호 101001
    도시 testCity
    국가 US
    국가 00000000
    이메일 test@example.com
    고객 유형 P
  7. BAPI_FLCUST_CREATEFROMDATA를 실행하려면 SAP BAPI > 함수 실행 작업을 추가합니다.
    1. 수 별칭 이름createNewFlightCustomer을 입력합니다.
    주: BAPI_FLCUST_CREATEFROMDATA가 데이터를 SAP 데이터베이스에 쓰게 하려면, 시퀀스 종료트랜젝션 수행 옵션을 선택해야 합니다. 시퀀스 종료 옵션을 선택했다면, 함수 생성 작업에서 시퀀스 시작 옵션을 선택했는지 확인하십시오.

    이 자습서를 이용해 생성한 샘플 bot의 목적은 SAP BAPI package를 사용할 때 Create() BAPI가 어떻게 작용하는지를 보여주는 것입니다. 데이터베이스를 수정하지는 않습니다.

    BAPI는 새 고객 레코드가 생성되면 고객 번호를 할당하고 반환합니다.
  8. 숫자를 변수로 가져오려면 SAP BAPI > 필드 값 가져오기 작업을 추가합니다.
    1. 수 별칭 이름createNewFlightCustomer을 입력합니다.
    2. 소스에서 함수 탭을 클릭합니다.
    3. 필드 이름CUSTOMERNUMBER를 입력합니다.
    4. 결과를 변수에 저장에서 (x)를 클릭하여 strCustomerNumber라는 변수를 만들고 선택합니다.
  9. 고객 번호를 표시하려면 메시지 상자 작업을 추가합니다.
    1. 표시할 메시지 입력에서 strCustomerNumber 변수를 선택합니다.
  10. 저장하고 bot을 실행합니다.