cancel
Showing results for 
Search instead for 
Did you mean: 

Problem Currency field value

Former Member
0 Kudos

Hi,

I am trying to call a subroutine in ABAP program from SAPscript. i.e. passing PO number and getting price details for the line items.My problem is I am not able to assign a currency value to a character value in program, so that I am not able to get the currency value in script.

Here is my example code:

/: PERFORM GET_PRICE_DETAIL IN PROGRAM ZCAEUR_SAPSCRIPT_EXTERNAL_READ

/: USING &EKPO-EBELN&

/: USING &EKPO-EBELP&

/: CHANGING &Z_PRICE&

/: CHANGING &Z_CURR&

/: CHANGING &Z_PER&

/: CHANGING &Z_UOM&

/: ENDPERFORM

In program:

FORM get_price_detail tables p_in_tab like int_tab[]

p_out_tab like out_tab[].

read table p_in_tab with key name = 'EKPO-EBELN'.

if sy-subrc = 0.

call function 'CONVERSION_EXIT_ALPHA_INPUT'

exporting

input = w_ebeln

importing

output = w_ebeln.

endif.

*get delivery notes

select bprme netpr peinh prsdr

into corresponding fields of table tb_docs

from ekpo

where ebeln = w_ebeln

and ebelp = '00010'.

check sy-subrc = 0.

clear: p_out_tab.

loop at tb_docs into wa_docs.

p_out_tab-name = 'Z_PRICE'.

p_out_tab-value = wa_docs-netpr.

append p_out_tab.

p_out_tab-name = 'Z_CURR'.

p_out_tab-value = wa_docs-waers.

append p_out_tab.

p_out_tab-name = 'Z_PER'.

p_out_tab-value = wa_docs-peinh.

append p_out_tab.

p_out_tab-name = 'Z_UOM'.

p_out_tab-value = wa_docs-bprme.

append p_out_tab.

endloop.

Endform.

Could you please help me to pass a currency(amount) value to SAPscript.

Thanks and Regards,

Sankar

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Sankar,

Try using 'CONVERSION_EXIT_ALPHA_OUTPUT' on Currency field.

Regards,

Satish

Answers (2)

Answers (2)

Former Member
0 Kudos

Solved my self. using write stmt . i.e write currency value to character variable.

Ex.

wa_netpr(13).

write ekpo-netpr to wa_netpr.

Thanks for all.

Former Member
0 Kudos

Hi

see the sample code and do accordingly

*************************************************************************

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&

Regards

Anji