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

Function module RFC_READ_RABLE and currency fields

Former Member
0 Likes
816

I am using RFC_READ_TABLE to access table BSEG on a remote system. My problem is retrieving field PSWBT which is a currency field. The value is returned as 20202020203.43 and overwrites part of the next field too. The value should be 4,083.33

Does anyone have any experence with currency fields in this situation and can offer any advice?

Thanks & regards.

3 REPLIES 3
Read only

former_member156446
Active Contributor
0 Likes
669

Check if this helps: [Getting around RFC_READ_TABLE limitations|http://searchsap.techtarget.com/tip/0,289483,sid21_gci997032,00.html]

Read only

0 Likes
669

Hello,

Did you also use the internal table FIELDS from RFC_READ_TABLE ?

I did a small test with fields PSWBT and PSWSL with success.

I included the PSWSL currency field for proper formatting of the PSWBT value with a WRITE statement.

To calculate the off sets in table FIELDS I used SE11 for table BSEG.

Structure and fields can also be found in table DD03L.

FIELDNAME OFFSET LENGTH T

PSWBT 000000 000013 P

PSWSL 000014 000005 C

Success.

Wim

Read only

0 Likes
669

Hi everyone,

Thank you for your help. I have now resolved the issue.

Yes I was using table FIELDS. Wim was correct that I also needed to use field PSWSL but this alone did not solve the problem. I had to define the currency field PSWBT as char 13. When the field was retrieved using RFC_READ_TABLE, I condensed the field and then moved it back to a currency field. As follows:

TYPES : BEGIN OF ty_accdoc,

pswbt(13),

pswsl type pswsl,

END OF ty_accdoc.

DATA : wa_accdoc TYPE ty_accdoc,

i_accdoc TYPE TABLE OF ty_accdoc.

DATA : wa-pswbt TYPE pswbt.

wa_fields-fieldname = 'PSWBT'. APPEND wa_fields TO i_fields.

wa_fields-fieldname = 'PSWSL'. APPEND wa_fields TO i_fields.

u2026u2026u2026 Call function u2018RFC_READ_TABLEu2019u2026u2026u2026u2026

CONDENSE wa_accdoc-pswbt NO-GAPS.

wa-pswbt = wa_accdoc2-pswbt.

Kind regards,

Alison