Merged PR 306: SAP Tipps und tricks ergänzt

Hoi @<Luca Frey>  und @<Christian Fravi> ,

Da wir zusammen in Migrationsprojekten arbeiten, hier meine aktuelle Sammlung an Tipps und Tricks, welche ich immer wieder verwende. Hauptsächlich um Daten aus SAP raus zu bekommen.

Anregungen, Korrekturen und Ergänzungen sind willkommen und erwünscht.

Gruss
JJ
This commit is contained in:
Jan Jambor 2024-08-14 08:12:53 +00:00
commit 39e404ce0c
17 changed files with 158 additions and 29 deletions

2
.order
View file

@ -7,5 +7,7 @@ versioning
branching-code-review-process
network
service-catalogue
know-how/git-commands
know-how/sap-tricks
faq
CHANGELOG

View file

@ -1,26 +1,26 @@
# Git Commands
## Random ideas
## Random Ideas
[Kart: DVC for geospatial and tabular data. Git for GIS](https://kartproject.org/), [Discussion](https://news.ycombinator.com/item?id=38073512#git), [Go to Post from 2023-10-30T20:40:06](https://social.lansky.name/@hn50/111325898767760054)
[Use KeePassXC to sign your git commits](https://code.mendhak.com/keepassxc-sign-git-commit-with-ssh/)
[Use KeePassXC to sign your Git commits](https://code.mendhak.com/keepassxc-sign-git-commit-with-ssh/)
## Git commands and examples
## Git Commands and Examples
Create a new branch locally within a already cloned repository:
Create a new branch locally within an already cloned repository:
```bash
git branch -b <branch-name>
git checkout -b <branch-name>
```
Delete local branch
Delete a local branch:
```bash
git branch -d <branch-name>
```
Rebase auf main branch:
Rebase onto the main branch:
```bash
git fetch
@ -28,54 +28,54 @@ git rebase origin/main
git push origin HEAD -f
```
Abort rebase:
Abort a rebase:
```bash
git rebase --abort
```
Stash changes
Stash changes:
```bash
git stash
git stash pop
git stash pop
```
Revwert a commit:
Revert a commit:
```bash
# Sollte funktionieren, wenn nur 1 Commit geamcht wurde
# Should work if only 1 commit was made
git reset --soft HEAD~1
# Eher Brechstange:
# More forceful approach:
git revert cb7cf15b54ff09495201244b070d18d96d4703ce
git reset --hard HEAD~2
```
Show changes beween two tags:
Show changes between two tags:
```bash
# tag from previouse version
# Tag from previous version
git tag -a v0.1.0 -m "Release version 0.1.0"
# add changes
# Add changes
git commit -am "add hint for change log"
# and more
# add final tag vor version
# Add final tag for version
git tag -a v0.2.0 -m "Release version 0.2.0"
# show diff between tags
# Show diff between tags
git log v0.1.0..v0.2.0 --no-merges --format="%h - %s" --date=short
```
Git diff log between commits
Git diff log between commits:
```bash
git log 79e28d9cef4cc777afc9e5b2569a5d34d9331867..6888fd61ae9d5744effcf27620a645e1750cbafc --no-merges --format="%h - %s (%an, %ad)" --date=short
```
Debug SSH connection via git
Debug SSH connection via Git:
```bash
GIT_SSH_COMMAND="ssh -v"
@ -83,16 +83,15 @@ git pull
unset GIT_SSH_COMMAND
```
Add executable flag on windows
Add executable flag on Windows:
```bash
git update-index --chmod=+x git_mirror.sh
```
check the remote branch of a cloned repository and change it
Check the remote branch of a cloned repository and change it:
```bash
git remote -v
git remote set-url origin xwr@vs-ssh.visualstudio.com:v3/xwr/jambor.pro/app-docker-compose
@ -106,19 +105,18 @@ for branch in $(git branch -r | grep -v '\->'); do
done
```
Renaming branches
Renaming branches:
```bash
# delete remote branch
# Delete remote branch
git push origin --delete wikiMaster
# delete local branch
# Delete local branch
git branch -d wikiMaster
# move branch
# Move branch
git branch -m main wikiMaster
# push
# Push
git push origin HEAD
```

129
know-how/sap-tricks.md Normal file
View file

@ -0,0 +1,129 @@
# SAP Tricks
Navigation mit Fenstern im Transaktionsfeld:
`/N` = Wechsel
`/O` = Neue Session
## Tabellen
Ansicht via SE16N:
- T001W - Werke
- T024E - EKORG
- TVKO - VKORG
- PROJ - Projekte
- T179 - Produkthierarchie
## Transaktionen
- Projekte: CJ20N
- SQ00: Start Queries (haben manchmal Leute, die alle anderen SQ** nicht haben)
- SQ01: Queries pflegen
- SQ02: Infoset pflegen
- SQ03: Benutzergruppen pflegen
- SE38: ABAP Editor
- SA38: ABAP ausführen
- SU01: Benutzer pflegen
- SU01D: Benutzer anzeigen
- /UI2/FLP: Fiori Launchpad
## SAP Darstellung
- Dark Theme = Quartz Dark Theme
- Old School = Blue Crystal Theme
![SAP Dark Theme](../resources/images/sap-tricks-theme-1.png)
![SAP Dark Theme](../resources/images/sap-tricks-theme-2.png)
## Text markieren
So kann man zum Beispiel mehrere Zellen markieren, geht aber nur auf einem Bildschirm ohne Scrollen.
```text
CTRL+Y
```
## SE16N
Wenn keine Berechtigung, dann mal mit "ZSE16N" versuchen zu starten. Gemäss Alex Friess soll das dasselbe sein, nur ohne Änderungsberechtigung.
Feldlängen anzeigen via "Technische Sicht":
![Feldlängen anzeigen](../resources/images/sap-tricks-se16n-1.jpg)
Varianten speichern oder holen:
![Varianten speichern oder holen](../resources/images/sap-tricks-se16n-2.png)
Technische Felder in Listenausgabe:
![Technische Felder in Listenausgabe](../resources/images/sap-tricks-se16n-3.png)
![Technische Felder in Listenausgabe](../resources/images/sap-tricks-se16n-4.png)
## SQ01/SQ02 Export in Excel
Ein Excel-Export funktioniert über diesen Knopf nicht in jedem Fall. Hier geht es aber immer:
![SQ01/SQ02 Export in Excel](../resources/images/sap-tricks-sq0102-1.png)
Oder der Button, wenn vorhanden:
![SQ01/SQ02 Export in Excel](../resources/images/sap-tricks-sq0102-2.png)
## SQ02 InfoSet: Berechnete Spalte
Kann mittels ABAP erreicht werden.
![SQ02 InfoSet Berechnete Spalte](../resources/images/sap-tricks-sq02-1.png)
Typ und Länge vom Feld am besten bei einem anderen ähnlichen Feld abgucken in der SE16N.
CHAR = C
![SQ02 InfoSet Berechnete Spalte](../resources/images/sap-tricks-sq02-2.png)
Den neuen Eintrag dann selektieren und Coding zum Feld anlegen.
![SQ02 InfoSet Berechnete Spalte](../resources/images/sap-tricks-sq02-3.png)
Beispiel-Code:
```ABAP
DATA: lv_vbund TYPE vbund.
CLEAR: lv_vbund.
CHECK: kna1-kunnr IS NOT INITIAL OR lfa1-lifnr IS NOT INITIAL.
IF kna1-kunnr IS NOT INITIAL.
SELECT SINGLE vbund INTO lv_vbund FROM kna1 WHERE kunnr = kna1-kunnr.
ELSEIF lfa1-lifnr IS NOT INITIAL.
SELECT SINGLE vbund INTO lv_vbund FROM lfa1 WHERE lifnr = lfa1-lifnr.
ENDIF.
vbund = lv_vbund. " Assign the value to the additional field
```
SAP ist, was Queries angeht, eine mühsame Angelegenheit, wenn man keine Berechtigung oder Ahnung hat als Developer.
1. Infoset anlegen. Da bildet man die Beziehung zwischen Tabellen mittels JOIN ab. Aber es ist sehr limitiert. Im konkreten Fall habe ich das gebaut:
![SQ02 InfoSet Berechnete Spalte](../resources/images/sap-tricks-sq02-4.jpg)
1. Query bauen. Hier gibt es keine CASE-WHEN-Funktion. Im konkreten Fall hätte ich dann 2 Spalten mit VBUND gehabt, einmal die aus der LFA1 und einmal die aus der KNA1. Ich will aber je nachdem, was es ist, was ich da gerade selektiere, das Ergebnis in einer Spalte haben.
Das ABAP-Code-Schnipselchen ist der Inhalt eines sogenannten Zusatzfeldes. Dies ist eine berechnete Spalte im SAP-Slang. Es wird also in der Spalte geschaut, haben wir eine KNA1 oder eine LFA1 und dann je nachdem, was es ist, die VBUND genommen.
## Änderungshistorie BP Geschäftspartner Felder
Transaktion BP:
- Geschäftspartner auswählen
- Feld suchen, das man ansehen will und Text markieren
- Zusätze > Änderungshistorie > Für dieses Feld
![Änderungshistorie](../resources/images/sap-tricks-aenderungshistorie-1.png)
![Änderungshistorie](../resources/images/sap-tricks-aenderungshistorie-2.png)

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 811 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 219 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 217 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB