You have obtained the service number and now need to decode the Standard Service Catalog Item of Service Master (ASMD-STLVPOS) to retrieve data for the following higher hierarchical levels in the Service Catalog.
Go to transaction code AC03 with the administration number to display the service. Check the Standard Service Catalog area. The Service Type and Version are the keys here. Now, examine the SSC Item (OTR 002 007 002 for this example). To decode the Standard Service Catalog Item of Service Master (ASMD-STLVPOS), you need to understand that the SSC Item holds the reference to your desired target hierarchical structure. The SSC Item (ASMD-STLVPOS) must be decoded to reach higher levels, such as Expert Works (002) and Contractor Makes (007).
Go to t-code ML03 with Administration Type and Release recovered from administration number presentation the help inventory. In this model Help Type OTR and Release 2. Table ASMD (Administration Expert: Essential Information) hold the assistance subtleties. Table ESLZ (Administration Type Lines) holds the assistance inventory subtleties. Check the T1, T2, T3, T4 and T5 level in Help Inventory. The comparing level at table level is field RANG (Progressive system Level of Standard Assistance Index) in ESLZ table i.e 1, 2, 3, 4, 5. If it’s not too much trouble, note Levels 2, 3, 4 and 5 can rehash. In our model we have no information for 5. The grouping where it is available in ML03, the equivalent is there in ESLZ table with RANG field.
How to automatically sort out something similar? Actually look at the code bit on SELECT and utilization of chosen information.
If it’s not too much trouble, let us know, in the event that you face any issue in any of the means. We would love to expand 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_tmp-srvpos. " 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_asmd-lbnum " service type AND ausgb = lt_asmd-ausgb " 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 = sy-langu AND lbnum = lt_eslz-lbnum AND ausgb = lt_eslz-ausgb AND zeile = lt_eslz-zeile. IF sy-subrc 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_rates-srvpos BINARY SEARCH.
IF sy-subrc EQ 0.
CLEAR: lv_textt, lv_dummy.
SPLIT ls_asmd-stlvpos AT space INTO ls_asmd-stlvpos
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_asmd-lbnum
ausgb = ls_asmd-ausgb
textt = lv_textt
rang = '2'.
* BINARY SEARCH.
IF sy-subrc EQ 0.
* Get the index of master craft. To be used to get heirarch 3
lv_index = sy-tabix.
READ TABLE lt_eslt INTO ls_eslt WITH KEY
lbnum = ls_eslz-lbnum
ausgb = ls_eslz-ausgb
zeile = ls_eslz-zeile
BINARY SEARCH.
IF sy-subrc EQ 0.
ls_approve-master_craft = ls_eslt-ktext.
ENDIF.
ENDIF.
* Going for Service Craft using level '2' index reference
LOOP AT lt_eslz INTO ls_eslz FROM lv_index.
IF ls_eslz-lbnum = ls_asmd-lbnum
AND ls_eslz-ausgb = ls_asmd-ausgb
AND ls_eslz-textt = lv_texttc
AND ls_eslz-rang = '3'.
* Get formatted object name
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = ls_eslz-ausgb
IMPORTING
output = lv_edition.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = ls_eslz-zeile
IMPORTING
output = lv_lineno.
CONCATENATE ls_eslz-lbnum lv_edition lv_lineno INTO lv_name.
* Read long text
CALL FUNCTION 'READ_TEXT'
EXPORTING
client = sy-mandt
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 sy-subrc = 0.
ls_approve-ltext = wa_lines-tdline.
ENDIF.
CLEAR: lt_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.
YOU MAY BE INTERESTED IN
Applying Enterprise Integration Patterns in SAP ABAP
ABAP Evolution: From Monolithic Masterpieces to Agile Architects
Calculator in SAP using New ABAP Syntax