SAP GET_POSITIONS_BY_DIFF_REP Function Module for Return Positions
GET_POSITIONS_BY_DIFF_REP is a standard get positions by diff rep SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Return Positions processing and below is the pattern details for this FM, showing its interface including any import and export parameters, exceptions etc. there is also a full "cut and paste" ABAP pattern code example, along with implementation ABAP coding, documentation and contribution comments specific to this or related objects.
See here to view full function module documentation and code listing for get positions by diff rep FM, simply by entering the name GET_POSITIONS_BY_DIFF_REP into the relevant SAP transaction such as SE37 or SE38.
Function Group: TPM_TRL_REP
Program Name: SAPLTPM_TRL_REP
Main Program: SAPLTPM_TRL_REP
Appliation area:
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function GET_POSITIONS_BY_DIFF_REP pattern details
In-order to call this FM within your sap programs, simply using the below ABAP pattern details to trigger the function call...or see the full ABAP code listing at the end of this article. You can simply cut and paste this code into your ABAP progrom as it is, including variable declarations.CALL FUNCTION 'GET_POSITIONS_BY_DIFF_REP'"Return Positions.
EXPORTING
* IM_RNG_BUKRS = "Range Table for Company Code
* IM_RNG_ACGRP = "Range Table for Securities Account Group
* IM_RNG_PORTF = "Range Table for Portfolio (Position)
* IM_RNG_LONG_SHORT = "Range Table Indicator: Long/Short
* IM_RNG_LOT = "Range for Lot ID
* IM_RNG_LTF = "Range for Lot ID
* IM_RNG_FUND = "Range Table for Fund
* IM_RNG_GRANT = "Range Table for Grant
* IM_RNG_EXTACC = "Range Table for External Accounts
* IM_RNG_EXTACC_DEAL = "Range Table: External Account
* IM_RNG_EACURR = "Range Table for EA Currency
* IM_RNG_VAREA = "Range Table for Valuation Areas
* IM_RNG_DEALNR = "Range Table for Transaction Number
* IM_RNG_ACCT_CODE = "Range Table for Treasury Codes
* IM_RNG_TRADER = "Range for Traders
* IM_TAB_OTC_DEAL = "Table Type for Transaction Key Structure
* IM_FLG_USE_TABLE4OTC = "'X' = Tabelle, ' ' = Range-Tabelle
* IM_FLG_SEC = "Single-Character Indicator
* IM_FLG_LOA = "Single-Character Indicator
* IM_FLG_POS = "Single-Character Indicator
* IM_FLG_DEA = "Single-Character Indicator
* IM_FLG_EA = "Single-Character Flag
* IM_RNG_VCLS = "Range Table for Valuation Classes
* IM_RNG_PT = "Range Table for Product Types
* IM_RNG_RANL = "Range Table for Security ID Numbers
* IM_RNG_RANLP = "Range Table for Security ID Numbers
* IM_RNG_LOANR = "Range Table for Loan Contracts
* IM_RNG_POSAC = "Range Table for Futures Account
* IM_RNG_SECAC = "Range Table for Securities Accounts
IMPORTING
EX_TAB_POSITION = "Table Type Treasury Ledger Position
EX_TAB_DIF_POS_IDENT = "Table Type: DIFV_POS_IDENT Standard
IMPORTING Parameters details for GET_POSITIONS_BY_DIFF_REP
IM_RNG_BUKRS - Range Table for Company Code
Data type: TRGR_COMPANY_CODEOptional: Yes
Call by Reference: Yes
IM_RNG_ACGRP - Range Table for Securities Account Group
Data type: TRGR_ACCOUNT_GROUPOptional: Yes
Call by Reference: Yes
IM_RNG_PORTF - Range Table for Portfolio (Position)
Data type: TRGR_PORTFOLIOOptional: Yes
Call by Reference: Yes
IM_RNG_LONG_SHORT - Range Table Indicator: Long/Short
Data type: TRGR_FLAG_LONG_SHORTOptional: Yes
Call by Reference: Yes
IM_RNG_LOT - Range for Lot ID
Data type: TRGR_LOT_IDOptional: Yes
Call by Reference: Yes
IM_RNG_LTF - Range for Lot ID
Data type: TRGR_LOT_IDOptional: Yes
Call by Reference: Yes
IM_RNG_FUND - Range Table for Fund
Data type: TRGR_FUNDOptional: Yes
Call by Reference: Yes
IM_RNG_GRANT - Range Table for Grant
Data type: TRGR_GRANT_NBROptional: Yes
Call by Reference: Yes
IM_RNG_EXTACC - Range Table for External Accounts
Data type: TRGR_EXTERNAL_ACCOUNTOptional: Yes
Call by Reference: Yes
IM_RNG_EXTACC_DEAL - Range Table: External Account
Data type: TRGR_EXTERNAL_ACCOUNTOptional: Yes
Call by Reference: Yes
IM_RNG_EACURR - Range Table for EA Currency
Data type: TRGR_DIFF_CURRENCYOptional: Yes
Call by Reference: Yes
IM_RNG_VAREA - Range Table for Valuation Areas
Data type: TRGR_VALUATION_AREAOptional: Yes
Call by Reference: Yes
IM_RNG_DEALNR - Range Table for Transaction Number
Data type: TRGR_DEAL_NUMBEROptional: Yes
Call by Reference: Yes
IM_RNG_ACCT_CODE - Range Table for Treasury Codes
Data type: TRGR_ACCOUNTING_CODEOptional: Yes
Call by Reference: Yes
IM_RNG_TRADER - Range for Traders
Data type: TRGR_TRADEROptional: Yes
Call by Reference: Yes
IM_TAB_OTC_DEAL - Table Type for Transaction Key Structure
Data type: TRGY_BUKRS_DEALNUMBEROptional: Yes
Call by Reference: Yes
IM_FLG_USE_TABLE4OTC - 'X' = Tabelle, ' ' = Range-Tabelle
Data type: XFELDOptional: Yes
Call by Reference: Yes
IM_FLG_SEC - Single-Character Indicator
Data type: CHAR1Optional: Yes
Call by Reference: Yes
IM_FLG_LOA - Single-Character Indicator
Data type: CHAR1Optional: Yes
Call by Reference: Yes
IM_FLG_POS - Single-Character Indicator
Data type: CHAR1Optional: Yes
Call by Reference: Yes
IM_FLG_DEA - Single-Character Indicator
Data type: CHAR1Optional: Yes
Call by Reference: Yes
IM_FLG_EA - Single-Character Flag
Data type: CHAR1Optional: Yes
Call by Reference: Yes
IM_RNG_VCLS - Range Table for Valuation Classes
Data type: TRGR_VALUATION_CLASSOptional: Yes
Call by Reference: Yes
IM_RNG_PT - Range Table for Product Types
Data type: TRGR_PRODUCT_TYPEOptional: Yes
Call by Reference: Yes
IM_RNG_RANL - Range Table for Security ID Numbers
Data type: TRGR_SECURITY_IDOptional: Yes
Call by Reference: Yes
IM_RNG_RANLP - Range Table for Security ID Numbers
Data type: TRGR_SECURITY_IDOptional: Yes
Call by Reference: Yes
IM_RNG_LOANR - Range Table for Loan Contracts
Data type: TRGR_LOANS_CONTRACTOptional: Yes
Call by Reference: Yes
IM_RNG_POSAC - Range Table for Futures Account
Data type: TRGR_POSITION_ACCOUNTOptional: Yes
Call by Reference: Yes
IM_RNG_SECAC - Range Table for Securities Accounts
Data type: TRGR_SECURITY_ACCOUNTOptional: Yes
Call by Reference: Yes
EXPORTING Parameters details for GET_POSITIONS_BY_DIFF_REP
EX_TAB_POSITION - Table Type Treasury Ledger Position
Data type: TRLY_POSITIONOptional: No
Call by Reference: Yes
EX_TAB_DIF_POS_IDENT - Table Type: DIFV_POS_IDENT Standard
Data type: DIFY_POS_IDENT_STANDARDOptional: No
Call by Reference: Yes
Copy and paste ABAP code example for GET_POSITIONS_BY_DIFF_REP Function Module
The ABAP code below is a full code listing to execute function module POPUP_TO_CONFIRM including all data declarations. The code uses the original data declarations rather than 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 newer method of declaring data variables on the fly. 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), which i why i have stuck to the origianl for this example.| DATA: | ||||
| lv_im_rng_bukrs | TYPE TRGR_COMPANY_CODE, " | |||
| lv_ex_tab_position | TYPE TRLY_POSITION, " | |||
| lv_im_rng_acgrp | TYPE TRGR_ACCOUNT_GROUP, " | |||
| lv_im_rng_portf | TYPE TRGR_PORTFOLIO, " | |||
| lv_im_rng_long_short | TYPE TRGR_FLAG_LONG_SHORT, " | |||
| lv_im_rng_lot | TYPE TRGR_LOT_ID, " | |||
| lv_im_rng_ltf | TYPE TRGR_LOT_ID, " | |||
| lv_im_rng_fund | TYPE TRGR_FUND, " | |||
| lv_im_rng_grant | TYPE TRGR_GRANT_NBR, " | |||
| lv_im_rng_extacc | TYPE TRGR_EXTERNAL_ACCOUNT, " | |||
| lv_im_rng_extacc_deal | TYPE TRGR_EXTERNAL_ACCOUNT, " | |||
| lv_im_rng_eacurr | TYPE TRGR_DIFF_CURRENCY, " | |||
| lv_im_rng_varea | TYPE TRGR_VALUATION_AREA, " | |||
| lv_ex_tab_dif_pos_ident | TYPE DIFY_POS_IDENT_STANDARD, " | |||
| lv_im_rng_dealnr | TYPE TRGR_DEAL_NUMBER, " | |||
| lv_im_rng_acct_code | TYPE TRGR_ACCOUNTING_CODE, " | |||
| lv_im_rng_trader | TYPE TRGR_TRADER, " | |||
| lv_im_tab_otc_deal | TYPE TRGY_BUKRS_DEALNUMBER, " | |||
| lv_im_flg_use_table4otc | TYPE XFELD, " | |||
| lv_im_flg_sec | TYPE CHAR1, " | |||
| lv_im_flg_loa | TYPE CHAR1, " | |||
| lv_im_flg_pos | TYPE CHAR1, " | |||
| lv_im_flg_dea | TYPE CHAR1, " | |||
| lv_im_flg_ea | TYPE CHAR1, " | |||
| lv_im_rng_vcls | TYPE TRGR_VALUATION_CLASS, " | |||
| lv_im_rng_pt | TYPE TRGR_PRODUCT_TYPE, " | |||
| lv_im_rng_ranl | TYPE TRGR_SECURITY_ID, " | |||
| lv_im_rng_ranlp | TYPE TRGR_SECURITY_ID, " | |||
| lv_im_rng_loanr | TYPE TRGR_LOANS_CONTRACT, " | |||
| lv_im_rng_posac | TYPE TRGR_POSITION_ACCOUNT, " | |||
| lv_im_rng_secac | TYPE TRGR_SECURITY_ACCOUNT. " |
|   CALL FUNCTION 'GET_POSITIONS_BY_DIFF_REP' "Return Positions |
| EXPORTING | ||
| IM_RNG_BUKRS | = lv_im_rng_bukrs | |
| IM_RNG_ACGRP | = lv_im_rng_acgrp | |
| IM_RNG_PORTF | = lv_im_rng_portf | |
| IM_RNG_LONG_SHORT | = lv_im_rng_long_short | |
| IM_RNG_LOT | = lv_im_rng_lot | |
| IM_RNG_LTF | = lv_im_rng_ltf | |
| IM_RNG_FUND | = lv_im_rng_fund | |
| IM_RNG_GRANT | = lv_im_rng_grant | |
| IM_RNG_EXTACC | = lv_im_rng_extacc | |
| IM_RNG_EXTACC_DEAL | = lv_im_rng_extacc_deal | |
| IM_RNG_EACURR | = lv_im_rng_eacurr | |
| IM_RNG_VAREA | = lv_im_rng_varea | |
| IM_RNG_DEALNR | = lv_im_rng_dealnr | |
| IM_RNG_ACCT_CODE | = lv_im_rng_acct_code | |
| IM_RNG_TRADER | = lv_im_rng_trader | |
| IM_TAB_OTC_DEAL | = lv_im_tab_otc_deal | |
| IM_FLG_USE_TABLE4OTC | = lv_im_flg_use_table4otc | |
| IM_FLG_SEC | = lv_im_flg_sec | |
| IM_FLG_LOA | = lv_im_flg_loa | |
| IM_FLG_POS | = lv_im_flg_pos | |
| IM_FLG_DEA | = lv_im_flg_dea | |
| IM_FLG_EA | = lv_im_flg_ea | |
| IM_RNG_VCLS | = lv_im_rng_vcls | |
| IM_RNG_PT | = lv_im_rng_pt | |
| IM_RNG_RANL | = lv_im_rng_ranl | |
| IM_RNG_RANLP | = lv_im_rng_ranlp | |
| IM_RNG_LOANR | = lv_im_rng_loanr | |
| IM_RNG_POSAC | = lv_im_rng_posac | |
| IM_RNG_SECAC | = lv_im_rng_secac | |
| IMPORTING | ||
| EX_TAB_POSITION | = lv_ex_tab_position | |
| EX_TAB_DIF_POS_IDENT | = lv_ex_tab_dif_pos_ident | |
| . " GET_POSITIONS_BY_DIFF_REP | ||
ABAP code using 7.40 inline data declarations to call FM GET_POSITIONS_BY_DIFF_REP
The below ABAP code uses the newer in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. Please note some of the newer syntax below, such as the @DATA is not available until 4.70 EHP 8.Search for further information about these or an SAP related objects