Decode the Standard Service Catalog Item of Service Master (ASMD-STLVPOS)

Share on Facebook3Share on LinkedIn9Tweet about this on TwitterShare on Google+0
Please Share!!

You got the service number and you want to fetch information of the next upper hierarchical levels on the Service Catalog.

1

Go to t-code AC03 with service number to display service. Check the Standard Serv. Cat area. Service Type and Edition are the keys. Now, check SSC Item (OTR 002 007 002 for this example). SSC Item holds the address to your desired destination/target hierarchy. SSC Item (ASMD-STLVPOS) has to be decoded to reach the higher levels (say Master crafts (002) and Contractor crafts (007)).

[adToAppearHere]

Go to t-code ML03 with Service Type and Edition retrieved from service number display the service catalog. In this example Service Type OTR and Edition 2. Table ASMD (Service Master: Basic Data) hold the service details. Table ESLZ (Service Type Lines) holds the service catalog details. Check the T1, T2, T3, T4 and T5 level in Service Catalog. The corresponding level at table level is field RANG (Hierarchy Level of Standard Service Catalog) in ESLZ table i.e 1, 2, 3, 4, 5. Please note Levels 2, 3, 4 and 5 can repeat. In our example we have no data for 5. The sequence in which it is present in ML03, the same is there in ESLZ table with RANG field.

2

How to figure out the same programatically? Check the code snippet on SELECT and usage of selected data.

Please let us know, if you face any issue in any of the steps. We would be glad to elaborate them.

*————————————————————-
* Code snippet 1 to extract data from tables.
*————————————————————-

* Get service details
select asnum
lbnum
ausgb
stlvpos
from asmd
into table lt_asmd
for all entries in lt_rates_tmp ” internal table with Service Numbers
where asnum lt_rates_tmpsrvpos” service number

IF lt_asmd IS NOT INITIAL.
SORT lt_asmd BY asnum.

* Get Service Catalog details
SELECT lbnum
ausgb
zeile
textt
rang
FROM eslz
INTO TABLE lt_eslz
FOR ALL ENTRIES IN lt_asmd
WHERE lbnum lt_asmdlbnum ” service type
AND ausgb lt_asmdausgb ” edition
AND rang ‘2’ ” Master craft hierarchy
OR rang ‘3’)” Contractor craft hierarchy

IF lt_eslz[] IS NOT INITIAL.
SORT lt_eslz BY lbnum ausgb zeile textt rang.

* Get Service Catalog texts
SELECT spras
lbnum
ausgb
zeile
ktext
FROM eslt
INTO TABLE lt_eslt
FOR ALL ENTRIES IN lt_eslz
WHERE spras sylangu
AND lbnum lt_eslzlbnum
AND ausgb lt_eslzausgb
AND zeile lt_eslzzeile.
IF sysubrc EQ 0.
SORT lt_eslt BY lbnum ausgb zeile.
ENDIF.
ENDIF.

*————————————————————————————————————–
Code snippet 2 to read extracted table data and long text of higher hierarchy
*————————————————————————————————————–

* Get Master Craft
READ TABLE lt_asmd INTO ls_asmd WITH KEY
asnum ls_ratessrvpos BINARY SEARCH.
IF sysubrc EQ 0.
CLEARlv_texttlv_dummy.
SPLIT ls_asmdstlvpos AT space INTO ls_asmdstlvpos
lv_textt lv_texttc lv_dummy. (Splitting OTR 002 007 002 )    ” Important trick
* Going for Master Craft
READ TABLE lt_eslz INTO ls_eslz WITH KEY
lbnum ls_asmdlbnum
ausgb ls_asmdausgb
textt lv_textt
rang ‘2’.
* BINARY SEARCH.
IF sysubrc EQ 0.
* Get the index of master craft. To be used to get heirarch 3
lv_index sytabix.
READ TABLE lt_eslt INTO ls_eslt WITH KEY
lbnum ls_eslzlbnum
ausgb ls_eslzausgb
zeile ls_eslzzeile
BINARY SEARCH.
IF sysubrc EQ 0.
ls_approvemaster_craft ls_esltktext.
ENDIF.
ENDIF.

* Going for Service Craft using level ‘2’ index reference
LOOP AT lt_eslz INTO ls_eslz FROM lv_index.
IF ls_eslzlbnum ls_asmdlbnum
AND ls_eslzausgb ls_asmdausgb
AND ls_eslztextt lv_texttc
AND ls_eslzrang ‘3’.

* Get formatted object name
CALL FUNCTION ‘CONVERSION_EXIT_ALPHA_INPUT’
EXPORTING
input  ls_eslzausgb
IMPORTING
output lv_edition.

CALL FUNCTION ‘CONVERSION_EXIT_ALPHA_INPUT’
EXPORTING
input  ls_eslzzeile
IMPORTING
output lv_lineno.

CONCATENATE ls_eslzlbnum lv_edition lv_lineno INTO lv_name.

* Read long text
CALL FUNCTION ‘READ_TEXT’
EXPORTING
client                  symandt
id                      lv_id
language                lv_lang
name                    lv_name
object                  lv_object
TABLES
lines                   lt_lines
EXCEPTIONS
id                      1
language                2
name                    3
not_found               4
object                  5
reference_check         6
wrong_access_to_archive 7
OTHERS                  8.

READ TABLE lt_lines INTO wa_lines INDEX 1.
IF sysubrc 0.
ls_approveltext wa_linestdline.
ENDIF.

CLEARlt_lines[],
wa_lines,
lv_edition,
lv_lineno,
lv_name.

* There would be just one destination from level 2 to level 3 for the input,hence exiting

EXIT.

ENDIF.
ENDLOOP.
ENDIF.

 

 

Image source: via Free Stock Photos foter.com

Share on Facebook3Share on LinkedIn9Tweet about this on TwitterShare on Google+0
Please Share!!