Quantcast
Channel: SCN : All Content - ABAP Development
Viewing all articles
Browse latest Browse all 8332

Way to check functional location hierarchy

$
0
0

Hello guys,

 

I'm looking for a clever coding snippet how to check our custom functional location hierarchy.

Here is the information about it:

 

Layer 1: D

Layer 2: D0000

Layer 3: D0000VK

Layer 4: D0000VK-0100

Layer 5: D0000VK-0100-ABCD

Layer 6: D0000VK-0100-ABCD-ABCD

Layer 7: D0000VK-0100-ABCD-ABCD-ABCDE

 

The first 4 layer always look like that. At the moment only layer 7 can differ at its number of characters, but I want to make it that flexible that from layer 5 to 7 it does not matter how many characters there are, because I can get the layer with help of '-' sign.

 

Now I want for every functional location layer to check if its in its right place in the hierarchy. So far so good I tried with splitting into seven fields and asking the layer position by counting not initial layer fields.

 

MOVE gs_iflot-tplnr+0(1TO gs_data-tplnr01.

MOVE gs_iflot-tplnr+1(4TO gs_data-tplnr02.
MOVE gs_iflot-tplnr+5(2TO gs_data-tplnr03.

MOVE gs_iflot-tplnr+8(4TO gs_data-tplnr04.


SPLIT gs_iflot-tplnr+13 AT '-' INTO
    gs_data-tplnr05 gs_data-tplnr06 gs_data-tplnr07.



MOVE gs_iflot-tplma+0(1TO gs_data-tplma01.
MOVE gs_iflot-tplma+1(4TO gs_data-tplma02.
MOVE gs_iflot-tplma+5(2TO gs_data-tplma03.
MOVE gs_iflot-tplma+8(4TO gs_data-tplma04.

SPLIT gs_iflot-tplma+13 AT '-' INTO
    gs_data-tplma05 gs_data-tplma06 gs_data-tplma07.

 

When difference between layer position of superior functional location and functional location is more than 1, then there is some mistake in the hierarchy. This works fine, but unfortunately there is no need to fill every layer when creating functional locations, e.g. there can be functional locations D0000VK-0100-ABCD (layer 5) and D0000VK-0100-ABCD-ABCD-ABCDE (layer 7) without layer 6. This would only be wrong if layer 6 actually exists! (wrong hierarchy happens e.g. wehen layer 5 and layer 7 were created at once and layer 6 was created afterwards).

 

With my check I only want to display wrong layer hierarchies where some layer is taken out but the taken out layer really exists. How to do this quite smart? :-)

 

 

Regards
Michael


Viewing all articles
Browse latest Browse all 8332

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>