SAP-samples / hana-developer-cli-tool-example

Learn how to build a developer-centric SAP HANA command line tool, particularly designed to be used when performing SAP HANA development in non-SAP tooling (for example from VS Code).
Apache License 2.0
89 stars 24 forks source link

Massconvert to cds/hdbtable unsupported type #101

Closed karthicktsb closed 1 year ago

karthicktsb commented 1 year ago

Hi Thomas,

Thanks for fixing previous issue related to massconvert. Today faced another issue for a table with data type hana.char(1).

hdbdd: entity IN_PLAN_SCENARIO { key ID_PARAM: Integer; DESCRIPTION: String(255); MO: String(4); PLAN_START_DATE: String(8) not null default '20000101'; // Format YYYYMMDD PLAN_END_DATE: String(8) not null default '20700101'; // Format YYYYMMDD SALES_START_DATE: String(8) not null default '20000101'; // Format YYYYMMDD SALES_END_DATE: String(8) not null default '20700101'; // Format YYYYMMDD PRICE_REFERENCE_DATE: String(8) not null default '20150101'; // Format YYYYMMDD STATUS: hana.CHAR(1); PLAN_RUN_START: UTCDateTime; // The time/date the plan was triggered execution PLAN_RUN_END: UTCDateTime; // The time/date the plan finished execution PARENT_ID: Integer; AUDIT: a.AUDIT; RELEASENOTE: String(5000); LANGUAGEKEY: String(1); };

while converting them in cds, command ran without any error but result looks like this

@cds.persistence.exists Entity HFP_PMT_TABLE_IN_PLAN_SCENARIO { key ID_PARAM: Integer @title: 'ID_PARAM' ; DESCRIPTION: String(255) @title: 'DESCRIPTION' ; MO: String(4) @title: 'MO' ; PLAN_START_DATE: String(8) default '20000101' not null @title: 'PLAN_START_DATE' ; PLAN_END_DATE: String(8) default '20700101' not null @title: 'PLAN_END_DATE' ; SALES_START_DATE: String(8) default '20000101' not null @title: 'SALES_START_DATE' ; SALES_END_DATE: String(8) default '20700101' not null @title: 'SALES_END_DATE' ; PRICE_REFERENCE_DATE: String(8) default '20150101' not null @title: 'PRICE_REFERENCE_DATE' ; STATUS: UNSUPPORTED TYPE - CHAR @title: 'STATUS' ;** PLAN_RUN_START: String @title: 'PLAN_RUN_START' ; PLAN_RUN_END: String @title: 'PLAN_RUN_END' ; PARENT_ID: Integer @title: 'PARENT_ID' ; AUDIT_CREATED: Timestamp @title: 'AUDIT_CREATED' ; AUDIT_CREATEDBY: Integer64 @title: 'AUDIT_CREATEDBY' ; AUDIT_CHANGED: Timestamp @title: 'AUDIT_CHANGED' ; AUDIT_CHANGEDBY: Integer64 @title: 'AUDIT_CHANGEDBY' ; RELEASENOTE: String(5000) @title: 'RELEASENOTE' ; LANGUAGEKEY: String(1) @title: 'LANGUAGEKEY' ; }

And since i wanted hdbtable which failed to execute fully (none of the hdbtable are created which executed successfully)

CDS compilation failed

.cds:10:10-11: Error: Mismatched ‘*’, expecting ‹Identifier›, ‘{’, ARRAY, ASSOCIATION, COMPOSITION, LOCALIZED, MANY, TYPE .cds:10:29-30: Error: Mismatched ‘-’, expecting ‘:’, ‘{’, ‘@’, ‘=’ .cds:10:54-55: Error: Extraneous ‘;’, expecting ‹Identifier›, ‘@’, ELEMENT, KEY, MASKED, VIRTUAL .cds:10:38-43: Error: Duplicate assignment with “@title” .cds:11:27-32: Error: Duplicate assignment with “@title” .cds:10:38-43: Error: Duplicate assignment with “@title” (in entity:“HFP_PMT_TABLE_IN_PLAN_SCENARIO”/element:“PLAN_RUN_START”) .cds:11:27-32: Error: Duplicate assignment with “@title” (in entity:“HFP_PMT_TABLE_IN_PLAN_SCENARIO”/element:“PLAN_RUN_START”) I can understand both are related to data type, Can you please fix this? Also can you also make hdbtable command to store the which are successfully converted, because out of 100 tables if 1 or 2 failed i can work with those and rest i can do them manually. Can you please if that is possible in our hana-cli app. Regards, Karthick
jung-thomas commented 1 year ago

Please do not put multiple problems and feature requests into a single issue. That makes it very difficult to track.

**STATUS: UNSUPPORTED TYPE - CHAR @title: 'STATUS' ;

That's intentional when we encounter a HANA specific data type. You either have to correct those manually or If you want HANA specific types in the output then use this option:

--useHanaTypes, --hana                Use SAP HANA-Specific Data Types See
                                             (https://cap.cloud.sap/docs/cds/cdl
                                            #predefined-types)
jung-thomas commented 1 year ago

Also can you also make hdbtable command to store the which are successfully converted, because out of 100 tables if 1 or 2 failed i can work with those and rest i can do them manually. Can you please if that is possible in our hana-cli app.

I have added a log feature to the massConvert command this afternoon. It will log the status of all objects to a JSON file. It will not stop on error but process the entire list of objects.