01-14-2006 4:50 PM
i want to write this function within a subroutine. i don't know how to pass the parameter for I_TAB_IVTYP etc. Can u show me the coding that has uses the subroutine that has something like this.
perform ........
LOOP AT I_TAB_RBKPV_A INTO WA_TAB_RBKPV_A.
WRITE: / WA_TAB_RBKPV_A-BELNR .
ENDLOOP.
form .........
CALL FUNCTION 'MRM_INVHEAD_MANY_READ'
EXPORTING
T_IVTYP = I_TAB_IVTYP
TABLES
T_BLART = S_BLART
T_XBLNR = S_XBLNR
T_BKTXT = S_BKTXT
T_USNAM = S_USNAM
T_ERFNAM =
T_GJAHR = S_GJAHR
T_LIFNR = S_LIFNR
T_BUKRS = S_BUKRS
T_BELNR = S_BELNR
T_BLDAT = S_BLDAT
T_BUDAT = S_BUDAT
T_REPART =
T_RBSTAT = L_RG_RBSTAT
T_RBKPV = I_TAB_RBKPV_A
EXCEPTIONS
ENTRY_NOT_FOUND = 1
OTHERS = 2
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endform.
01-14-2006 4:53 PM
01-14-2006 4:53 PM
01-14-2006 5:12 PM
when i tried using the given example it thrown an run time error.
01-14-2006 5:13 PM
01-14-2006 5:26 PM
01-14-2006 5:31 PM
the field t_ivtyp no defined. that u no error while activating, this occurs only during execution.
01-14-2006 6:00 PM
Ok, go back to that example. We must make a change, then it will work. That parameter is defined in the function module as "Pass by Value", this means that you cannot pass by reference here. So we need to get around it if we want to call it in a subroutine. Here is the changes that you will to make(in BOLD), then the example will work. Make sure to award points to the other thread and mark it as solved as well as this thread. Thanks.
*&---------------------------------------------------------------------*
*& Form read_invhead
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_LT_IVTYP text
* -->P_LT_BLART text
* -->P_LT_XBLNR text
* -->P_LT_BKTXT text
* -->P_LT_USNAM text
* -->P_LT_GJAHR text
* -->P_LT_LIFNR text
* -->P_LT_BUKRS text
* -->P_LT_BELNR text
* -->P_LT_BLDAT text
* -->P_LT_BUDAT text
* -->P_LT_RBKPV text
*----------------------------------------------------------------------*
form read_invhead tables lt_ivtyp type mrm_tab_ivtyp
lt_blart type mrm_tab_soblart
lt_xblnr type mrm_tab_soxblnr
lt_bktxt type mrm_tab_sobktxt
lt_usnam type mrm_tab_sousnam
lt_gjahr type mrm_tab_sogjahr
lt_lifnr type mrm_tab_solifnr
lt_bukrs type mrm_tab_sobukrs
lt_belnr type mrm_tab_sobelnr
lt_bldat type mrm_tab_sobldat
lt_budat type mrm_tab_sobudat
lt_rbkpv type mrm_tab_rbkpv.
<b> data: i_ivtyp type mrm_tab_ivtyp.</b>
data: lt_rbstat type mrm_tab_sorbstat,
lwa_rbstat like line of lt_rbstat.
lwa_rbstat-sign = 'I'.
lwa_rbstat-option = 'EQ'.
lwa_rbstat-low = '2'.
append lwa_rbstat to lt_rbstat.
<b> i_ivtyp[] = lt_ivtyp[].</b>
call function 'MRM_INVHEAD_MANY_READ'
exporting
<b> t_ivtyp = i_ivtyp</b>
tables
t_blart = lt_blart
t_xblnr = lt_xblnr
t_bktxt = lt_bktxt
t_usnam = lt_usnam
* T_ERFNAM =
t_gjahr = lt_gjahr
t_lifnr = lt_lifnr
t_bukrs = lt_bukrs
t_belnr = lt_belnr
t_bldat = lt_bldat
t_budat = lt_budat
* T_REPART =
t_rbstat = lt_rbstat
t_rbkpv = lt_rbkpv
exceptions
entry_not_found = 1
others = 2.
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
endform. " read_invhead
REgards,
Rich Heilman
01-14-2006 4:55 PM
Hi Anitha,
You can go to SE37 & give the FM name & go to display.then press 'where used list' button,you can see the programs where this FM is used & how the parameters are passed.Do it accordingly in your code.
01-14-2006 5:04 PM