if(재능이 없으면 시간으로 극복하라){return 성공;}

SAP BTP - Work Zone Standard Subscription 사용해보기

Work Zone Standard Subscription 사용해보기

manifest.json의 sourceTempltate block에 crossNavigation 및 sap.cloud 추가

{
  "_version": "1.59.0",
  "sap.app": {
    "id": "ns.risks",
    "type": "application",
    "i18n": "i18n/i18n.properties",
    "applicationVersion": {
      "version": "0.0.1"
    },
    "title": "",
    "description": "",
    "resources": "resources.json",
    "sourceTemplate": {
      "id": "@sap/generator-fiori:lrop",
      "version": "1.13.0",
      "toolsId": "f4aaa498-80f2-462b-a253-41b13870047d"
    },
    "crossNavigation": {
      "inbounds": {
        "Risks-display":{
          "signature": {
            "parameters": {},
            "additionalParameters":"allowed"
          },
          "semanticObject": "Risks",
          "action": "display"
        }
      }
    },
    "dataSources": {
      "mainService": {
        "uri": "/odata/v4/service/risk/",
        "type": "OData",
        "settings": {
          "annotations": [],
          "odataVersion": "4.0"
        }
      }
    }
  },
  "sap.ui": {
    "technology": "UI5",
    "icons": {
      "icon": "",
      "favIcon": "",
      "phone": "",
      "phone@2": "",
      "tablet": "",
      "tablet@2": ""
    },
    "deviceTypes": {
      "desktop": true,
      "tablet": true,
      "phone": true
    }
  },
  "sap.ui5": {
    "flexEnabled": true,
    "dependencies": {
      "minUI5Version": "1.122.0",
      "libs": {
        "sap.m": {},
        "sap.ui.core": {},
        "sap.ushell": {},
        "sap.fe.templates": {}
      }
    },
    "contentDensities": {
      "compact": true,
      "cozy": true
    },
    "models": {
      "i18n": {
        "type": "sap.ui.model.resource.ResourceModel",
        "settings": {
          "bundleName": "ns.risks.i18n.i18n"
        }
      },
      "": {
        "dataSource": "mainService",
        "preload": true,
        "settings": {
          "synchronizationMode": "None",
          "operationMode": "Server",
          "autoExpandSelect": true,
          "earlyRequests": true
        }
      },
      "@i18n": {
        "type": "sap.ui.model.resource.ResourceModel",
        "uri": "i18n/i18n.properties"
      }
    },
    "resources": {
      "css": []
    },
    "routing": {
      "routes": [
        {
          "pattern": ":?query:",
          "name": "RisksList",
          "target": "RisksList"
        },
        {
          "pattern": "Risks({key}):?query:",
          "name": "RisksObjectPage",
          "target": "RisksObjectPage"
        }
      ],
      "targets": {
        "RisksList": {
          "type": "Component",
          "id": "RisksList",
          "name": "sap.fe.templates.ListReport",
          "options": {
            "settings": {
              "contextPath": "/Risks",
              "variantManagement": "Page",
              "navigation": {
                "Risks": {
                  "detail": {
                    "route": "RisksObjectPage"
                  }
                }
              }
            }
          }
        },
        "RisksObjectPage": {
          "type": "Component",
          "id": "RisksObjectPage",
          "name": "sap.fe.templates.ObjectPage",
          "options": {
            "settings": {
              "editableHeaderContent": true,
              "contextPath": "/Risks"
            }
          }
        }
      }
    }
  },
  "sap.fiori": {
    "registrationIds": [],
    "archeType": "transactional"
  },
  "sap.cloud": {
    "public": true,
    "service": "cpapp.service"
  }
}

root folder내 mta.yaml파일내 resource항목 및 moduels내에 destinataion 추가

_schema-version: "3.1"
ID: cpapp
description: A simple CAP project.
version: 1.0.0
modules:
- name: cpapp-srv
  type: nodejs
  path: gen/srv
  requires:
  - name: cpapp-db
  - name: cpapp-uaa
  - name: cpapp-logs
  provides:
  - name: srv-api
    properties:
      srv-url: ${default-url}
  parameters:
    buildpack: nodejs_buildpack
  build-parameters:
    builder: npm
- name: cpapp-db-deployer
  type: hdb
  path: gen/db
  requires:
  - name: cpapp-db
  - name: cpapp-logs
  parameters:
    buildpack: nodejs_buildpack
- name: cpapp-destinations
  type: com.sap.application.content
  requires:
  - name: cpapp-uaa
    parameters:
      service-key:
        name: cpapp-uaa-key
  - name: cpapp-html5-repo-host
    parameters:
      service-key:
        name: cpapp-html5-repo-host-key
  - name: srv-api
  - name: cpapp-destination
    parameters:
      content-target: true
  parameters:
    content:
      instance:
        destinations:
        - Authentication: OAuth2UserTokenExchange
          Name: cpapp-app-srv
          TokenServiceInstanceName: cpapp-uaa
          TokenServiceKeyName: cpapp-uaa-key
          URL: ~{srv-api/srv-url}
          sap.cloud.service: cpapp.service
        - Name: cpapp-html5-repo-host
          ServiceInstanceName: cpapp-html5-repo-host
          ServiceKeyName: cpapp-html5-repo-host-key
          sap.cloud.service: cpapp.service
        - Name: cpapp-html5-repo-host
          ServiceInstanceName: cpapp-html5-repo-host
          ServiceKeyName: cpapp-html5-repo-host-key
          sap.cloud.service: cpapp.service
        - Authentication: OAuth2UserTokenExchange
          Name: cpapp-uaa
          ServiceInstanceName: cpapp-uaa
          ServiceKeyName: cpapp-uaa-key
          sap.cloud.service: cpapp.service
        existing_destinations_policy: update
  build-parameters:
    no-source: true
- name: cpapp-app-content
  type: com.sap.application.content
  path: .
  requires:
  - name: cpapp-html5-repo-host
    parameters:
      content-target: true
  build-parameters:
    build-result: resources
    requires:
    - artifacts:
      - nsrisks.zip
      name: nsrisks
      target-path: resources/
- name: nsrisks
  type: html5
  path: app/risks
  build-parameters:
    build-result: dist
    builder: custom
    commands:
    - npm install
    - npm run build:cf
    supported-platforms: []
resources:
- name: cpapp-db
  type: com.sap.xs.hdi-container
  parameters:
    service: hana
    service-plan: hdi-shared
- name: cpapp-uaa
  type: org.cloudfoundry.managed-service
  parameters:
    config:
      role-collections:
      - description: Manage Risks
        name: RiskManager-${space}
        role-template-references:
        - $XSAPPNAME.RiskManager
      - description: View Risks
        name: RiskViewer-${space}
        role-template-references:
        - $XSAPPNAME.RiskViewer
      tenant-mode: dedicated
      xsappname: cpapp-${org}-${space}
    path: ./xs-security.json
    service: xsuaa
    service-plan: application
- name: cpapp-destination
  type: org.cloudfoundry.managed-service
  parameters:
    config:
      HTML5Runtime_enabled: true
      init_data:
        instance:
          destinations:
          - Authentication: NoAuthentication
            Name: ui5
            ProxyType: Internet
            Type: HTTP
            URL: https://ui5.sap.com
          existing_destinations_policy: update
    service: destination
    service-plan: lite
- name: cpapp-html5-repo-host
  type: org.cloudfoundry.managed-service
  parameters:
    service: html5-apps-repo
    service-plan: app-host
- name: cpapp-logs
  type: org.cloudfoundry.managed-service
  parameters:
    service: application-logs
    service-plan: lite
parameters:
  deploy_mode: html5-repo
  enable-parallel-deployments: true
build-parameters:
  before-all:
  - builder: custom
    commands:
    - npm install --production
    - npx -p @sap/cds-dk cds build --production
    - npx rimraf gen/db/src/gen/data

이후 SAPUI5, SAP Fiori, MTA 설치

npm install --global @sap/ux-ui5-tooling
npm install --global @sap/generator-fiori
npm install --global mta

app/risks 폴더로 이동해 fiori deployment 설정을 추가 하려고 했는데 아래 오류가 뜨면서 이후 과정 진행 불가

C:\Users\nuruh\OneDrive\바탕 화면\project\tutorial\cpapp\app\risks>fiori add deploy-config cf
Adding deploy-config to the project.
warn Add:Deploy-config Not able to parse VSCode settings.json file.
info Add:Deploy-config Using: @sap/fiori:deploy-config
Do you need to install @sap/generator-fiori globally?
npm install -g @sap/generator-fiori
OR
yarn global add @sap/generator-fiori
spawnSync yo.cmd EINVAL

global로 sap/generator-fiori가 설치 되어있는지 확인 image

되어있는데.. 그래도 같은 오류 발생

혹시 경로가 한글이 들어가서 그런가 싶어서 경로를 옮겨봄 image

그래도 같은 에러 발생 도저히 모든 방법을 통해서 되지 않아 진행된 인원들에게 일부 파일을 받음 image

새로 빌드하고

mbt build -t ./

배포

cf deploy cpapp_1.0.0.mtar

후에 서비스를 확인해보니 image

실행중인 앱들도 확인 image

하위 계정으로 들어가 SAP Build Work Zone 스탠다드 에디션에서 생성을 클릭해준다. image

플랜에서 Standard Instance가 아닌 Standard Subscribed를 선택해야한다. image

Work Zone에서 사용자에 대한 역할 컬렉션을 지정한다. image

인스턴스에서 WorkZone으로 이동 image

컨텐츠 관리자에서 컨텐츠 탐색기를 통해 컨텐츠 확인 후에 HTML5 App를 클릭 image

Risks 선택하고 추가 image

컨텐츠 관리자에 Risks 추가됨 image

Everyone을 선택하여 편집을 누르고 Risks를 지정상태 변경해준다 image

신규 그룹에서 제목을 Risk Management로 변경하고 Risks의 지정상태를 변경하여 저장해준다. image

Site Driectory에서 사이트를 생성해주고 Risk Management Site로 만들어준다. image

Risk Management Site로 이동하여 Risks 앱을 확인한다. image image

권한이 없어 조회 불가 image

역할을 추가 하고 image

아래 명령어를 쳐서 데이터베이스 인스턴스를 업데이트 쳐준다.

cf update-service cpapp -c '{"data":{"serviceStopped":false}}'

정상 조회 가능 (데이터는 없지만) image xs-security.json 배포 방식이 아닌 수작업 role 추가 image image