Skip to content

Commit

Permalink
abap-value-helps elementary help parser exposed
Browse files Browse the repository at this point in the history
  • Loading branch information
bsrdjan committed Mar 17, 2021
1 parent 053a3f9 commit 85f84b6
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 29 deletions.
11 changes: 4 additions & 7 deletions abap-value-help/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,13 @@
[![TypeScript](https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg)](https://www.typescriptlang.org/)
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-f8bc45.svg)](https://github.com/prettier/prettier)

Server component exposing generic Value Helps for [pattern based applications](https://github.com/SAP/fundamental-tools/blob/main/doc/app.md) and ui frameworks supported by [Fundamental Library for ABAP](https://github.com/SAP/fundamental-tools).

- ABAP API works the way ABAP developers are familiar with: like in SAPGUI:
Generic Value Helps for [conventions' based applications](https://github.com/SAP/fundamental-tools/blob/main/doc/app.md) and front-ends supported by [Fundamental Library for ABAP](https://github.com/SAP/fundamental-tools)

- ABAP API, well-known to SAPGUI developers:
- ABAP Fixed Domain Values (FV)
- ABAP Elementary and complex Search Helps (SH)
- ABAP Check Tables (CT, CH)
- Custom value helps

- [Installation](#installation)
- [Usage](#usage)
- [Components](#components)
Expand All @@ -27,7 +25,6 @@ Server component exposing generic Value Helps for [pattern based applications](h
- [Contributing](#contributing)
- [License](#license)


## Installation

```shell
Expand Down Expand Up @@ -106,9 +103,9 @@ Generic ABAP API exposes:

### Server

- [index.js](https://github.com/SAP/fundamental-tools/blob/main/abap-value-help/doc/server/index.js)
- [client.js](https://github.com/SAP/fundamental-tools/blob/main/abap-value-help/doc/server/client.js) or [pool.js](https://github.com/SAP/fundamental-tools/blob/main/abap-value-help/doc/server/pool.js)

- Check unit tests for [data structures'](https://github.com/SAP/fundamental-tools/tree/main/abap-value-help/tests/data) details
- Check unit-tests for [data structures'](https://github.com/SAP/fundamental-tools/tree/main/abap-value-help/tests/data) details

Server routes can be tested by REST client JSON payloads, or from any web browser, in which case hardcoded requests are sent to ABAP system:

Expand Down
4 changes: 2 additions & 2 deletions abap-value-help/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion abap-value-help/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "abap-value-help",
"description": "ABAP Value Help",
"version": "0.9.5",
"version": "0.9.6",
"homepage": "https://github.com/sap/fundamental-tools",
"author": "SAP",
"license": "Apache-2.0",
Expand Down
19 changes: 3 additions & 16 deletions abap-value-help/src/ts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,8 @@
//
// SPDX-License-Identifier: Apache-2.0

import { Client } from "node-rfc";
import {
ValueInputHelp,
ShlpApiType,
ShlpDefaultsType,
ShlpDescriptorType,
ShlpSelectOptions,
ShlpSearchOptions,
SearchResultHeaderType,
SearchResultLineType,
SearchResultType,
log,
} from "./valueInputHelp";

export {
ValueInputHelp,
ElementaryHelpType,
ShlpApiType,
ShlpDefaultsType,
ShlpDescriptorType,
Expand All @@ -26,5 +12,6 @@ export {
SearchResultHeaderType,
SearchResultLineType,
SearchResultType,
ValueInputHelp,
log,
};
} from "./valueInputHelp";
12 changes: 9 additions & 3 deletions abap-value-help/src/ts/valueInputHelp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,10 @@ export class ValueInputHelp {
for (const elem_shlp of this.Descriptors[shlpName]) {
const elem_shlpname = `${elem_shlp.SHLPTYPE} ${elem_shlp.SHLPNAME}`;
if (!this.Elementary[elem_shlpname]) {
this.Elementary[elem_shlpname] = this.elementary(elem_shlp);
this.Elementary[elem_shlpname] = ValueInputHelp.elementary(
elem_shlp,
this._userParameters
);
}
}
}
Expand All @@ -189,7 +192,10 @@ export class ValueInputHelp {
}
}

private elementary(shlp: RfcStructure): ElementaryHelpType {
public static elementary(
shlp: RfcStructure,
userParameters: RfcTable = []
): ElementaryHelpType {
const newhelp: ElementaryHelpType = {
INTDESCR: shlp.INTDESCR as RfcStructure,
SCRLENMAX: 0,
Expand Down Expand Up @@ -239,7 +245,7 @@ export class ValueInputHelp {
// user param defaults maintained in SU01/SU3 are taken over,
// thus more input fields defaulted than in SAPGUI. __todo: check this ...
if (fd.DEFAULTVAL && (fd.DEFAULTVAL as string).length > 0) {
for (const p of this._userParameters) {
for (const p of userParameters) {
if (p.PARID === fd.MEMORYID) {
fd.PARVA = p.PARVA;
// fd['PARTXT'] = p['PARTXT']
Expand Down

0 comments on commit 85f84b6

Please sign in to comment.