SAP Function Modules

FM_SUBSTRING_LENGTH_SEQUENCE SAP Function module - It gives the length and sequence of a substring of Master Data







FM_SUBSTRING_LENGTH_SEQUENCE is a standard SAP function module available within R/3 SAP systems depending on your version and release level. Below is the pattern details for this FM showing its interface including any import and export parameters, exceptions etc as well as any documentation contributions (Comments) specific to the object.

See here to view full function module documentation and code listing, simply by entering the name FM_SUBSTRING_LENGTH_SEQUENCE into the relevant SAP transaction such as SE37 or SE80.

Associated Function Group: FMMD_SUBD_1
Released Date: Not Released
Processing type: Normal fucntion module
Normal function module settings


Pattern for FM FM_SUBSTRING_LENGTH_SEQUENCE - FM SUBSTRING LENGTH SEQUENCE





CALL FUNCTION 'FM_SUBSTRING_LENGTH_SEQUENCE' "It gives the length and sequence of a substring of Master Data
  EXPORTING
    i_masdatid =                " fmmdactiv-masdat_id  Master Data-Type
    i_strid =                   " fmmdstrid-str_id  Master Data Subdivision Structure ID
    i_subid =                   " fmmdsubdiv-sub_id  Master Data Substring ID
  IMPORTING
    e_sublen =                  " fmmdsubdiv-sublen  Master Data Substring Length
    e_subseq =                  " fmmdsubdiv-subseq  Master Data Substring Sequence
    e_subcut1 =                 " fmmdsubdiv-subcut1  Breakdown of substrings 1
    e_subcut2 =                 " fmmdsubdiv-subcut2  Breakdown of substrings 2
    e_subcut3 =                 " fmmdsubdiv-subcut3  Breakdown of substrings 3
    e_subcut4 =                 " fmmdsubdiv-subcut4  Breakdown of substrings 4
    e_subcut5 =                 " fmmdsubdiv-subcut5  Breakdown of substrings 5
    e_subcut6 =                 " fmmdsubdiv-subcut6  Breakdown of substrings 6
  EXCEPTIONS
    DB_FAILURE = 1              "               Failure in getting data from DB
    .  "  FM_SUBSTRING_LENGTH_SEQUENCE

ABAP code example for Function Module FM_SUBSTRING_LENGTH_SEQUENCE





The ABAP code below is a full code listing to execute function module FM_SUBSTRING_LENGTH_SEQUENCE including all data declarations. The code uses the latest in-line data DECLARATION SYNTAX but I have included an ABAP code snippet at the end to show how declarations would look using the original method of declaring data variables up front. This will allow you to compare and fully understand the new inline method. Please note some of the newer syntax such as the @DATA is not available until a later 4.70 service pack (SP8).

DATA:
ld_e_sublen  TYPE FMMDSUBDIV-SUBLEN ,
ld_e_subseq  TYPE FMMDSUBDIV-SUBSEQ ,
ld_e_subcut1  TYPE FMMDSUBDIV-SUBCUT1 ,
ld_e_subcut2  TYPE FMMDSUBDIV-SUBCUT2 ,
ld_e_subcut3  TYPE FMMDSUBDIV-SUBCUT3 ,
ld_e_subcut4  TYPE FMMDSUBDIV-SUBCUT4 ,
ld_e_subcut5  TYPE FMMDSUBDIV-SUBCUT5 ,
ld_e_subcut6  TYPE FMMDSUBDIV-SUBCUT6 .


SELECT single MASDAT_ID
FROM FMMDACTIV
INTO @DATA(ld_i_masdatid).


SELECT single STR_ID
FROM FMMDSTRID
INTO @DATA(ld_i_strid).


SELECT single SUB_ID
FROM FMMDSUBDIV
INTO @DATA(ld_i_subid).
. CALL FUNCTION 'FM_SUBSTRING_LENGTH_SEQUENCE' EXPORTING i_masdatid = ld_i_masdatid i_strid = ld_i_strid i_subid = ld_i_subid IMPORTING e_sublen = ld_e_sublen e_subseq = ld_e_subseq e_subcut1 = ld_e_subcut1 e_subcut2 = ld_e_subcut2 e_subcut3 = ld_e_subcut3 e_subcut4 = ld_e_subcut4 e_subcut5 = ld_e_subcut5 e_subcut6 = ld_e_subcut6 EXCEPTIONS DB_FAILURE = 1 . " FM_SUBSTRING_LENGTH_SEQUENCE
IF SY-SUBRC EQ 0. "All OK ELSEIF SY-SUBRC EQ 1. "Exception "Add code for exception here ENDIF.







ABAP code to compare 7.40 inline data declaration with original syntax

The below ABAP code uses the older none in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. It may also be useful if you are using an older version of SAP as some of the newer syntax above, such as the @DATA is not available until 4.70 EHP 8.

DATA:
ld_e_sublen  TYPE FMMDSUBDIV-SUBLEN ,
ld_i_masdatid  TYPE FMMDACTIV-MASDAT_ID ,
ld_e_subseq  TYPE FMMDSUBDIV-SUBSEQ ,
ld_i_strid  TYPE FMMDSTRID-STR_ID ,
ld_e_subcut1  TYPE FMMDSUBDIV-SUBCUT1 ,
ld_i_subid  TYPE FMMDSUBDIV-SUB_ID ,
ld_e_subcut2  TYPE FMMDSUBDIV-SUBCUT2 ,
ld_e_subcut3  TYPE FMMDSUBDIV-SUBCUT3 ,
ld_e_subcut4  TYPE FMMDSUBDIV-SUBCUT4 ,
ld_e_subcut5  TYPE FMMDSUBDIV-SUBCUT5 ,
ld_e_subcut6  TYPE FMMDSUBDIV-SUBCUT6 .


SELECT single MASDAT_ID
FROM FMMDACTIV
INTO ld_i_masdatid.


SELECT single STR_ID
FROM FMMDSTRID
INTO ld_i_strid.


SELECT single SUB_ID
FROM FMMDSUBDIV
INTO ld_i_subid.

Contribute (Add Comments)

Please help keep this info upto date and use the comments section below to add useful hints, tips and information specific to this SAP function. This will then be available for you and other users to easily find by simply searching on the object name FM_SUBSTRING_LENGTH_SEQUENCE or its description.