Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Application server to SAP

Former Member
0 Likes
816

Hi,

I need to read a file from application server and then use BAPI_EXCHRATE_CREATEMULTIPLE to upload the currency exchange tables in SAP...

Can any one guide me how i should proceed.

A code to run a BAPI will be helpful as i am quite new to using a BAPI..

Itz urgent..

Useful answers will be rewarded..

Thanks,

Arun

Hi,

I need to read a file from application server and then use BAPI_EXCHRATE_CREATEMULTIPLE to upload the currency exchange tables in SAP...

Can any one guide me how i should proceed.

A code to run a BAPI will be helpful as i am quite new to using a BAPI..

Itz urgent..

Useful answers will be rewarded..

Thanks,

Arun

5 REPLIES 5
Read only

Former Member
0 Likes
786

hi

for reading data from app server use

open dataset <filename> for input in text mode.

if sy-subrc <>0.

exit.

else.

do.

read dataset <filename.> into <itab-fields>

append itab..

enddo.

now u r ready with internal table with data...from app server

example :

open dataset 'matdet.txt' in text mode encoding default for input.

if sy-subrc <> 0.

exit.

endif.

do.

read dataset 'matdet.txt' into v_rec.

if sy-subrc <> 0.

exit.

endif.

split v_rec at TAB into it_mara-matnr it_mara-mtart it_mara-ernam.

append it_mara.

clear it_mara.

enddo.

close dataset 'matdet.txt'.

Message was edited by:

Premalatha G

Read only

0 Likes
786

Hi,

Thanks for the urgent reply..I am clear till now and have done the same..

But now how to use the BAPI to upload the tables..

Plz reeply with a sample code if u can..

Thanks

Arun

Read only

Former Member
0 Likes
786

Hi,

consider the bapi as a function module.

All you have to do is check the parameters to pass and whether the passed values are in correct format.

Reward points if helpful,

Regards,

jinesh.

Read only

Former Member
0 Likes
786

Hi Arun,

First read file from application server using read dataset and then call FM

'BAPI_EXCHRATE_CREATEMULTIPLE'.

Refer this code :

if p_afile1 is not initial.

open dataset p_afile1 for input in text mode encoding default.

IF sy-subrc EQ 0.

do.

READ DATASET p_afile1 INTO w_line.

IF sy-subrc EQ 0.

APPEND w_line TO t_input.

clear w_line.

else.

exit.

endif.

enddo.

close dataset p_afile1.

endif.

endif.

data : it_tcurr type table of BAPI1093_0 with header line,

it_bapiret type table of Bapiret2.

it_tcurr-RATE_TYPE = '1004'.

it_tcurr-FROM_CURR = 'DEM'.

it_tcurr-TO_CURRNCY = 'USD'.

it_tcurr-VALID_FROM = '20060101'.

it_tcurr-EXCH_RATE = 6.

it_tcurr-FROM_FACTOR = 1.

it_tcurr-TO_FACTOR = 10.

APPEND IT_TCURR.

CALL FUNCTION 'BAPI_EXCHRATE_CREATEMULTIPLE'

EXPORTING

UPD_ALLOW = 'X'

  • CHG_FIXED = ' '

  • DEV_ALLOW = '000'

TABLES

exchrate_list = IT_TCURR[]

return = IT_BAPIRET.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

  • EXPORTING

  • WAIT =

  • IMPORTING

  • RETURN =

Regards,

Hemant

Read only

Former Member
0 Likes
786

THANKS