on 08-01-2007 12:23 PM
hi friends,
i am calling suroutine in script i write in main window of script this
/: PERFORM ZVEND IN PROGRAM ZRFI_CONF_SUB
/: USING &BSIK-LIFNR&
/:USING &BSIK-BUDAT&
/:ENDPERFORM .
i created subroutine pool ZRFI_CONF_SUB.
but when i am debugging form it is not going in that subroutine
where i am wrong plz reply me .
regards,
sonu
I think you may hav not activated your subroutine pool or the function group may not be the same in which all other codes of other subroutine pool is created..
try saving your subroutine pool in the same function group in which all the subroutines are created..n then let's see,
thanks,
shamim
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Check any IF statements or PERFORM statemtents in your main window did not end with ENDIF or ENDPERFORM. I guess somewhere you missed to conculde with the end statement
Note: all IF should be concluded by ENDIF in form
& all PERFORM should conclude with ENDPERFORM.
Else sub-routine pool will not be called.
This could be one of the reason why it is not calling your program in debugging.
Regards,
SaiRam
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi..
Specify the program name as below.
/: PERFORM ZVEND IN PROGRAM <b>'ZRFI_CONF_SUB'</b>
/: USING &BSIK-LIFNR&
/:USING &BSIK-BUDAT&
/:ENDPERFORM
<b>reward if Helpful</b>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
chk this link
[Removed by the moderator.]
more help on this.
here is the total logic for your requirement.
in the script layout,
/: PERFORM Get_Pack IN PROGRAM ZTEST
/: USING &V_FIELD1&
/: USING &V_FIELD2&
/: CHANGING &RESULT&
*----and so onn
/: ENDPERFORM
/* HERE WE are printing the result
result : &RESULT&
Then in the program in SE38,
all the paramters you pass from SCRIPT with USING command will come into ITAB.
all parameters with CHANGING command will comes into OTAB
FORM Get_Pack TABLES ITAB STRUCTURE ITCSY
OTAB STRUCTURE ITCSY.
data: v_field1 type i,
v_field2 type i,
v_result type i.
*--TO read the values from the ITAB you have to use this logic.
READ TABLE ITAB WITH KEY NAME = 'V_FIELD1'
TRANSPORTING VALUE.
IF SY-SUBRC = 0.
CONDENSE ITAB-VALUE.
V_FIELD1 = ITAB-VALUE.
ENDIF.
READ TABLE ITAB WITH KEY NAME = 'V_FIELD2'
TRANSPORTING VALUE.
IF SY-SUBRC = 0.
CONDENSE ITAB-VALUE.
V_FIELD2 = ITAB-VALUE.
ENDIF.
*--to modify PACK value
*--write your logic to get the value inTO RESULT.
V_RESULT = V_FIELD1 + V_FIELD2.
OTAB-VALUE = V_RESULT.
condense OTAB-VALUE.
MODIFY OTAB TRANSPORTING VALUE
WHERE NAME = 'RESULT'.
ENDFORM.]]>
You can create the program either as Executable or subroutine pool in SE38.
i think u have write this code in SE38
<b>FORM Get_Pack TABLES ITAB STRUCTURE ITCSY</b>
Reward Points if it is Useful.
Thanks,
Manjunath MS
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
see the sample code and do accordingly
How to call a subroutine form SAPscripts
The Form :
/:PERFORM CDE_CENT IN PROGRAM ZKRPMM_PERFORM_Z1MEDRUCK
/:USING &EKKO-EBELN&
/:CHANGING &CDECENT&
/:ENDPERFORM
The report :
REPORT zkrpmm_perform_z1medruck .
DATA : BEGIN OF it_input_table OCCURS 10.
INCLUDE STRUCTURE itcsy.
DATA : END OF it_input_table.
déclaration de la table output_table contenant les
variables exportées
DATA : BEGIN OF it_output_table OCCURS 0.
INCLUDE STRUCTURE itcsy.
DATA : END OF it_output_table.
DATA : w_ebeln LIKE ekko-ebeln,
w_vbeln LIKE vbak-vbeln,
w_zcdffa LIKE vbak-zcdffa.
*----
*
FORM CDE_CENT
*
*----
*
FORM cde_cent TABLES input output.
it_input_table[] = input[].
it_output_table[] = output[].
READ TABLE it_input_table INDEX 1.
MOVE it_input_table-value TO w_ebeln.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = w_ebeln
IMPORTING
output = w_ebeln.
SELECT SINGLE zcdffa FROM ekko
INTO w_zcdffa
WHERE ebeln = w_ebeln.
it_output_table-name = 'CDECENT'.
MOVE w_zcdffa TO it_output_table-value.
MODIFY it_output_table INDEX 1.
output[] = it_output_table[].
ENDFORM.
*************************************************************************
REPORT ZMPO1 .
form get_freight tables in_par structure itcsy out_par structure itcsy.
tables: ekko,konv,t685t.
data: begin of itab occurs 0,
ebeln like ekko-ebeln,
knumv like ekko-knumv,
end of itab.
data: begin of itab1 occurs 0,
knumv like konv-knumv,
kposn like konv-kposn,
kschl like konv-kschl,
kbetr like konv-kbetr,
waers like konv-waers,
kwert like konv-kwert,
end of itab1.
data: begin of iout occurs 0,
kschl like konv-kschl,
vtext like t685t-vtext,
kbetr like konv-kbetr,
kwert like konv-kwert,
end of iout.
data v_po like ekko-ebeln.
read table in_par with key 'EKKO-EBELN'.
if sy-subrc = 0.
v_po = in_par-value.
select
ebeln
knumv
from ekko
into table itab
where ebeln = v_po.
if sy-subrc = 0.
loop at itab.
select
knumv
kposn
kschl
kbetr
waers
kwert
into table itab1
from konv
where knumv = itab-knumv and
kappl = 'M'.
endloop.
loop at itab1.
if itab1-kposn <> 0.
select single * from t685t
where kschl = itab1-kschl
and kappl = 'M'
and spras = 'EN'.
iout-vtext = t685t-vtext.
iout-kschl = itab1-kschl.
iout-kbetr = itab1-kbetr.
iout-kwert = itab1-kwert.
append iout.
clear iout.
endif.
endloop.
sort itab1 by kposn.
loop at iout.
sort iout by kschl.
if ( iout-kschl eq 'GSDC' OR
iout-kschl eq 'GSFR' OR
iout-kschl eq 'GSIR' ).
at end of kschl.
read table iout index sy-tabix.
sum.
write:/ iout-kschl,iout-vtext,iout-kwert.
out_par-name = 'A1'.
out_par-value = iout-vtext.
append out_par.
out_par-name = 'A2'.
out_par-value = iout-kwert.
append out_par.
endat.
endif.
endloop.
endif.
endif.
endform.
IN THE FORM I AM WRITING THIS CODE.
/:DEFINE &A1& = ' '
/:DEFINE &A2& = ' '
/:PERFORM GET_FREIGHT IN PROGRAM ZMFORM_PO1
/:USING &EKKO-EBELN&
/:CHANGING &A1&
/:CHANGING &A2&
/:ENDPERFORM
&A1&
&A2&
This Code is to be written in the PO form under ADDRESS window.
-
-
/:DEFINE &A1& = ' '
/:DEFINE &A2& = ' '
/:DEFINE &A3& = ' '
/:DEFINE &A4& = ' '
/:DEFINE &A5& = ' '
/:DEFINE &A6& = ' '
/:PERFORM GET_VENDOR IN PROGRAM ZMFORM_PO
/:USING &EKKO-EBELN&
/:CHANGING &A1&
/:CHANGING &A2&
/:CHANGING &A3&
/:CHANGING &A4&
/:CHANGING &A5&
/:CHANGING &A6&
/:ENDPERFORM
&A1&
&A2&
&A3&
&A4&
&A5&
&A6&
Reward points for useful Answers
Regards
Anji
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi anji,
i am pesting my code plz plz help me plz go through the code .
in script
PERFORM ZVEND IN PROGRAM ZRFI_CONF_SUB
USING &BSIK-LIFNR&
USING &BSIK-BUDAT&
ENDPERFORM
.
&----
*& Subroutine pool ZRFI_CONF_SUB *
*& *
&----
*& *
*& *
&----
PROGRAM ZRFI_CONF_SUB.
DATA : BEGIN OF I_BSID OCCURS 0,
KUNNR LIKE BSID-KUNNR,
WRBTR LIKE BSID-WRBTR,
BUDAT LIKE BSID-BUDAT,
SHKZG like BSID-shkzg,
BSTAT LIKE BSID-BSTAT,
END OF I_BSID.
DATA : BEGIN OF I_BSAD OCCURS 0,
KUNNR LIKE BSAD-KUNNR,
WRBTR LIKE BSAD-WRBTR,
BUDAT LIKE BSAD-BUDAT,
SHKZG like BSAD-SHKZG,
BSTAT LIKE BSAD-BSTAT,
END OF I_BSAD.
DATA : BEGIN OF I_BSIK OCCURS 0,
LIFNR LIKE BSIK-LIFNR,
WRBTR LIKE BSIK-WRBTR,
BUDAT LIKE BSIK-BUDAT,
shkzg like bsik-shkzg,
BSTAT LIKE BSIK-BSTAT,
END OF I_BSIK.
DATA : BEGIN OF I_BSAK OCCURS 0,
LIFNR LIKE BSAK-LIFNR,
WRBTR LIKE BSAK-WRBTR,
BUDAT LIKE BSAK-BUDAT,
shkzg like bsak-shkzg,
BSTAT LIKE BSAK-BSTAT,
END OF I_BSAK.
************************************************************************
*****This is form to get the total in Vendor Bal.ConformationForm*****
************************************************************************
FORM ZVEND TABLES IN_BSIK STRUCTURE ITCSY
OUT_BSIK STRUCTURE ITCSY.
data : year(4),
month(2),
day(2),
date(8).
DATA : V_AMNT TYPE P DECIMALS 2,
V_AMT TYPE P DECIMALS 2,
V_TOT TYPE P DECIMALS 2,
V_TOTAL(20),
V_LIFNR(10) TYPE N,
V_BUDAT(10),
V_WRBTR LIKE BSID-WRBTR.
READ TABLE IN_BSIK INDEX 1.
V_LIFNR = IN_BSIK-VALUE.
READ TABLE IN_BSIK INDEX 2.
V_BUDAT = IN_BSIK-VALUE.
year = V_BUDAT+6(4).
month = V_BUDAT+3(2).
day = V_BUDAT+0(2).
CONCATENATE year month day into date.
SELECT LIFNR WRBTR BUDAT SHKZG BSTAT FROM BSIK
INTO table I_BSIK
WHERE LIFNR = V_LIFNR.
SELECT LIFNR WRBTR BUDAT SHKZG BSTAT FROM BSAK
INTO table I_BSAK
WHERE LIFNR = V_LIFNR.
LOOP AT I_BSIK WHERE LIFNR = V_LIFNR.
if i_bsik-BUDAT <= date and i_bsik-bstat ne 'S'.
if i_bsik-shkzg = 'S' .
V_AMNT = V_AMNT + I_BSIK-WRBTR .
else.
V_AMNT = V_AMNT - I_BSIK-WRBTR.
endif.
endif.
ENDLOOP.
LOOP AT I_BSAK WHERE LIFNR = V_LIFNR.
if i_bsak-BUDAT <= date and i_bsak-bstat ne 'S'.
if i_bsak-shkzg = 'S'.
V_AMT = V_AMT + I_BSAK-WRBTR .
else.
V_AMT = V_AMT - I_BSAK-WRBTR.
endif.
endif.
ENDLOOP.
V_TOT = V_AMNT + V_AMT.
V_TOTAL = V_TOT.
READ TABLE OUT_BSIK INDEX 1.
OUT_BSIK-VALUE = V_TOTAL.
MODIFY OUT_BSIK INDEX 1.
ENDFORM. "ZVEND
************************************************************************
**This is form to get the total in Customer Bal.Conformation Form*****
************************************************************************
FORM ZCUST TABLES IN_BSID STRUCTURE ITCSY
OUT_BSID STRUCTURE ITCSY.
data : year(4),
month(2),
day(2),
date(8).
DATA : V_AMNT TYPE P DECIMALS 2,
V_AMT TYPE P DECIMALS 2,
V_TOT TYPE P DECIMALS 2,
V_TOTAL(20),
V_KUNNR(10) type n,
V_BUDAT(10),
V_WRBTR LIKE BSID-WRBTR.
READ TABLE IN_BSID INDEX 1.
V_KUNNR = IN_BSID-VALUE.
READ TABLE IN_BSID INDEX 2.
V_BUDAT = IN_BSID-VALUE.
year = V_BUDAT+6(4).
month = V_BUDAT+3(2).
day = V_BUDAT+0(2).
CONCATENATE year month day into date.
SELECT KUNNR WRBTR BUDAT SHKZG BSTAT FROM BSID
INTO table I_BSID
WHERE KUNNR = V_KUNNR.
SELECT KUNNR WRBTR BUDAT SHKZG BSTAT FROM BSAD
INTO table I_BSAD
WHERE KUNNR = V_KUNNR.
LOOP AT I_BSID WHERE KUNNR = V_KUNNR.
if i_bsid-BUDAT <= date and i_bsid-bstat ne 'S'.
if i_bsid-shkzg = 'S' .
V_AMNT = V_AMNT + I_BSID-WRBTR .
else.
V_AMNT = V_AMNT - I_BSID-WRBTR.
endif.
endif.
ENDLOOP.
LOOP AT I_BSAD WHERE KUNNR = V_KUNNR.
if i_bsad-BUDAT <= date and i_bsad-bstat ne 'S'.
if i_bsad-shkzg = 'S'.
V_AMT = V_AMT + I_BSAD-WRBTR .
else.
V_AMT = V_AMT - I_BSAD-WRBTR.
endif.
endif.
ENDLOOP.
V_TOT = V_AMNT + V_AMT.
V_TOTAL = V_TOT.
READ TABLE OUT_BSID INDEX 1.
OUT_BSID-VALUE = V_TOTAL.
MODIFY OUT_BSID INDEX 1.
ENDFORM. "ZCUST
Hi,
You need to created subroutine in the program ZRFI_CONF_SUB and the Subroutine name is ZVEND.
http://help.sap.com/saphelp_47x200/helpdata/en/d1/803279454211d189710000e8322d00/content.htm
Regards
Sudheer
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
24 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.