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

Data Uploading

sreeramkumar_madisetty
Active Contributor
0 Likes
336

Hi

I am uploading data from Falt file to Infotype (0759)- Compensation Data .

My requirement is upload amounts should always be entered per the Employee's Payroll country currency.

Do achieve this I am following the below code.

DATA: L_PERSA TYPE PERSA,

L_PERNR TYPE pspar-personid_ext,

L_WAERS TYPE WAERS.

DATA: L_LAND1 TYPE LAND1.

L_PERNR = P_WA_COMPAWARDS_PERNR.

TYPES: BEGIN OF TY_CURRENCY,

MOLGA TYPE MOLGA,

LAND1 TYPE LAND1,

END OF TY_CURRENCY.

DATA: IT_CURRENCY TYPE STANDARD TABLE OF TY_CURRENCY,

WA_CURRENCY TYPE TY_CURRENCY.

SELECT WERKS

FROM PA0001

INTO L_PERSA

UP TO 1 ROWS

WHERE PERNR EQ L_PERNR.

ENDSELECT.

IF SY-SUBRC EQ 0.

SELECT MOLGA LAND1

FROM T500P

INTO TABLE IT_CURRENCY

WHERE PERSA EQ L_PERSA.

IF SY-SUBRC EQ 0.

DELETE ADJACENT DUPLICATES FROM IT_CURRENCY.

LOOP AT IT_CURRENCY INTO WA_CURRENCY.

L_LAND1 = WA_CURRENCY-LAND1.

ENDLOOP.

SELECT WAERS

FROM T500W

INTO L_WAERS

UP TO 1 ROWS

WHERE LAND1 EQ L_LAND1. "WA_CURRENCY-LAND1.

ENDSELECT.

IF SY-SUBRC EQ 0.

CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'

EXPORTING

  • CLIENT = SY-MANDT

DATE = SY-DATUM

FOREIGN_AMOUNT = wa_compawards-amount

FOREIGN_CURRENCY = wa_compawards-currency

LOCAL_CURRENCY = L_WAERS

  • RATE = 0

  • TYPE_OF_RATE = 'M'

  • READ_TCURR = 'X'

IMPORTING

  • EXCHANGE_RATE =

  • FOREIGN_FACTOR =

LOCAL_AMOUNT = wa_compawards-amount

  • LOCAL_FACTOR =

  • EXCHANGE_RATEX =

  • FIXED_RATE =

  • DERIVED_RATE_TYPE =

EXCEPTIONS

NO_RATE_FOUND = 1

OVERFLOW = 2

NO_FACTORS_FOUND = 3

NO_SPREAD_FOUND = 4

DERIVED_2_TIMES = 5

OTHERS = 6

.

IF SY-SUBRC <> 0.

MESSAGE E001(ZHRECM) WITH TEXT-026.

ENDIF.

ENDIF."WAERS

ENDIF. "LAND1

Here my Flat file contains the PERNR.

As per my knowledge there is some defect in the above code.

Can you please correct me and guide me.

Regards,

Sree

1 REPLY 1
Read only

Former Member
0 Likes
317

SELECT MOLGA LAND1

FROM T500P

INTO TABLE IT_CURRENCY

WHERE PERSA EQ L_PERSA.

IF SY-SUBRC EQ 0.

Sort IT_CURRENCY by MOLGA LAND1. <-- add this

statement

DELETE ADJACENT DUPLICATES FROM IT_CURRENCY.