You are on page 1of 13

Error with datasource enhancement

1 of 13

https://archive.sap.com/discussions/thread/3940859

(http://go.sap.com/index.html)

Get Started (http://go.sap.com/community/getting-started.html)

(https://onedx.find.sap.com)

(htt
ps:/
/sh
are
dui.
ser
vice
s.sa
p.c
om
/pro
tect
ed.
htm
l?re
f=ht
tps:
//ar
chiv
e.s
ap.
co
m/)

(https://www.facebook.com/sapcommunitynetwork?ref=ts)
(https://www.youtube.com/user/SAPCommunities)
(https://plus.google.com/u/0/+SAPCommunities/posts)

(https://twitter.com/sapcommnet)

(https://www.linkedin.com/company/sap)
(https://instagram.com/sap/)

(http://www.slideshare.net/SAP)
Privacy (http://go.sap.com/about/legal/privacy.html)
Terms of Use (http://go.sap.com/corporate/en/legal/terms-of-use.html)
Legal Disclosure (http://go.sap.com/about/legal/impressum.html)
Copyright (http://go.sap.com/about/legal/copyright.html)
Trademark (http://go.sap.com/about/legal/trademark.html)
Sitemap (http://www.sap.com/sitemap/index.html)
Newsletter
(https://go.sap.com/registration/newsletter.html)

10/26/2016 11:54 PM

Error with datasource enhancement

2 of 13

https://archive.sap.com/discussions/thread/3940859

/
(/discussions) /

ABAP Development (/discussions/space/abap)

Archives (/) /

Discussions Archive

Error with datasource enhancement

Hi everyone,
i enhancing generic datasource D_VBSEGK by calculating net due date using FM:
"DETERMIN_DUE_DATE". Here is my Code:
DATA: l_s_ZOXERS0119 LIKE ZOXERS0119,
lwa_faede type faede.
CASE i_datasource.
WHEN 'D_VBSEGK'.
LOOP AT i_t_data INTO l_s_ZOXERS0119.
l_tabix = sy-tabix.
lwa_faede-koart = 'K' or 'D'. "Acct type
lwa_faede-ZFBDT = SOURCE_FIELDS-ZFBDT.
lwa_faede-SHKZG = 'H' or 'S' ."Credit or Debit
lwa_faede-ZBD3T = SOURCE_FIELDS-ZTERM.
CALL FUNCTION 'DETERMINE_DUE_DATE'
EXPORTING
i_faede = lwa_faede
IMPORTING
e_faede = lwa_faede
EXCEPTIONS
OTHERS = 1.
l_s_ZOXERS0119-ZZFAEDT = lwa_faede-netdt.
MODIFY i_t_data FROM l_s_ZOXERS0119 INDEX l_tabix.
ENDLOOP.
ENDCASE

10/26/2016 11:54 PM

Error with datasource enhancement

3 of 13

https://archive.sap.com/discussions/thread/3940859

then when i check the code, there is Error:

The field "I_T_DATA" ist unknown, but there is a field with the similar
name "C_T_DATA". "C_T_DATA".
i am really new with ABAP, to write this Code, i have read alots on SCn and ABAP Forum. But its still not
correct

Can you please help me how to correct this?


Thankyou very much!

(https://people.sap.com/chrom.men)
Pha London (https://people.sap.com/chrom.men)
August 04, 2016 at 14:13 PM
0 Likes

Helpful Answer by
D. Chia (/discussions/message/16878671#16878671) , D. Chia (/discussions/message/16878910#16878910)

NewB To Abap (https://people.sap.com/newb)replied

(https://people.sap.com/newb)

August 04, 2016 at 14:45 PM

May i know where did you


used this field I_T_DATA.It
is saying this field name is
does not exists.
and saying that one more
field is available like
C_T_DATA.
Double click on the Error
message it will take you to

10/26/2016 11:54 PM

Error with datasource enhancement

4 of 13

https://archive.sap.com/discussions/thread/3940859

the particular line causing the Error.


0

(https://people.sap.com/chrom.men)
Pha London (https://people.sap.com/chrom.men)replied

August 04, 2016 at 14:55 PM

Hi i think i am enhance transaction data therefore I_T_DATA is for


transaction data and C_T_DATA is for master data. is it rights?
anyways, i have changed the Code, but there still Error:
DATA: l_s_ZOXERS0119 LIKE ZOXERS0119,
lwa_faede type FAEDT_FPOS,
l_tabix type sy-tabix.
CASE i_datasource.
WHEN 'D_VBSEGK'.
LOOP AT c_t_data INTO l_s_ZOXERS0119.
l_tabix = sy-tabix.
lwa_faede-koart = 'K' . "Acct type
lwa_faede-ZFBDT = l_s_ZOXERS0119-ZFBDT.
lwa_faede-SHKZG = 'H' ."Credit or Debit
lwa_faede-ZBD3T = l_s_ZOXERS0119-ZTERM.
CALL FUNCTION 'DETERMINE_DUE_DATE'
EXPORTING
i_faede = lwa_faede
IMPORTING
e_faede = lwa_faede
EXCEPTIONS
OTHERS = 1.
l_s_ZOXERS0119-ZZFAEDT = lwa_faede-netdt.
MODIFY c_t_data FROM l_s_ZOXERS0119 INDEX l_tabix.
ENDLOOP.
ENDCASE

Error: the data object ""LWA_FAEDE" has no structure and therefore no

10/26/2016 11:54 PM

Error with datasource enhancement

5 of 13

https://archive.sap.com/discussions/thread/3940859

component called "KOART".

i think i did something wrong from " lwa_faede-koart = 'K' . "Acct type" to
the End

(https://people.sap.com/newb)
NewB To Abap (https://people.sap.com/newb)replied
August 04, 2016 at 15:10 PM

TYPES:BEGIN OF st_faede,
l_s_zoxers0119 LIKE mara-matnr,
lwa_faede TYPE faedt_fpos,
l_tabix TYPE sy-tabix.
TYPES:END OF st_faede.
DATA: lwa_faede TYPE st_faede.
*"lwa_faede-koart = 'K' . "Acct type
*lwa_faede-zfbdt = ."'H' ."Credit or Debit
*lwa_faede-zbd3t = ."l_s_zoxers0119zterm..
lwa_faede-l_s_zoxers0119 = ''.
CALL FUNCTION
'DETERMINE_DUE_DATE'
EXPORTING
i_faede

= lwa_faede

* I_GL_FAEDE

* IMPORTING
* E_FAEDE

EXCEPTIONS

10/26/2016 11:54 PM

Error with datasource enhancement

6 of 13

https://archive.sap.com/discussions/thread/3940859

ACCOUNT_TYPE_NOT_SUPPORTED
OTHERS

=1

=2

.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.

Need some changes in the above.

1) your are passing koart into the structure lwa_fade , But where is
the field koart first declare the
feild in the above.
lwa_faede-koart = 'K' . "Acct type

Then erros will be reduced, Hope you understood.

D. Chia (https://people.sap.com/duncan.scn)replied

(https://people.sap.com/duncan.scn)

August 04, 2016 at 14:59 PM

i am assuming you
are coding this in the
customer exit FM for
enhancement
RSAP0001?
as per the syntax
error msg ... the
internal table

10/26/2016 11:54 PM

Error with datasource enhancement

7 of 13

https://archive.sap.com/discussions/thread/3940859

containing the extracted source data defined in the FM is called 'C_T_DATA'. to


verify you can take a look at the FM interface before going into the ZX.... include
where you are coding now.
btw, these 2 lines of your code doesn't seem logical. i'm not sure if it's even
syntatically correct. which value will you expect to be assigned to the 2 variables
at runtime?
lwa_faede-koart = 'K' or 'D'. "Acct type
lwa_faede-SHKZG = 'H' or 'S' ."Credit or Debit

(https://people.sap.com/chrom.men)
Pha London (https://people.sap.com/chrom.men)replied

August 04, 2016 at 15:05 PM

Hi Chia,
You are correct. i'm using the FM for Enhancement RSAP0001. im not
famaliar with the FM module, so i try to test it with ZX Include. Unfornately
it doesn't work.
i have replaced I_T_DATA with C_T_DATA and select only one value for
lwa_faede-koart.

the Code looks like this:


DATA: l_s_ZOXERS0119 LIKE ZOXERS0119,
lwa_faede type FAEDT_FPOS,
l_tabix type sy-tabix.
CASE i_datasource.
WHEN 'D_VBSEGK'.
LOOP AT c_t_data INTO l_s_ZOXERS0119.
l_tabix = sy-tabix.
lwa_faede-koart = 'K' . "Acct type
lwa_faede-ZFBDT = l_s_ZOXERS0119-ZFBDT.
lwa_faede-SHKZG = 'H' ."Credit or Debit
lwa_faede-ZBD3T = l_s_ZOXERS0119-ZTERM.
CALL FUNCTION 'DETERMINE_DUE_DATE'
EXPORTING

10/26/2016 11:54 PM

Error with datasource enhancement

8 of 13

https://archive.sap.com/discussions/thread/3940859

i_faede = lwa_faede
IMPORTING
e_faede = lwa_faede
EXCEPTIONS
OTHERS = 1.
l_s_ZOXERS0119-ZZFAEDT = lwa_faede-netdt.
MODIFY c_t_data FROM l_s_ZOXERS0119 INDEX l_tabix.
ENDLOOP.
ENDCASE.

But there still Error: the data object ""LWA_FAEDE" has no structure
and therefore no component called "KOART".

i dont know how to correct it.


0

Helpful Answer

(https://people.sap.com/duncan.scn)
D. Chia (https://people.sap.com/duncan.scn)replied
August 04, 2016 at 15:21 PM

moved from above thread for better


continuity (in case you missed it)

DATA lwa_faede type


FAEDT_FPOS
the type you reference is not a structure therefore
your subsequent statements attempting to assign
to component of structure syntax is invalid.

you should declare the variable above using same


type as what the FM 'DETERMINE_DUE_DATE'
takes in as input parameter. check the FM in

10/26/2016 11:54 PM

Error with datasource enhancement

9 of 13

https://archive.sap.com/discussions/thread/3940859

tcode SE37 and look at the import paramater 'i_faede' TYPE ....
0

(https://people.sap.com/chrom.men)
Pha London (https://people.sap.com/chrom.men)replied
August 04, 2016 at 15:45 PM

Thanks Chia,
i modify my Code, and it works. but i
don't know why it still working when i
haven't added:
lwa_faede-bldat. =
l_s_ZOXERS0119bldat."Document Date in
Document

Here is my Code:
DATA: l_s_ZOXERS0119 LIKE
ZOXERS0119,
lwa_faede type FAEDE,
l_tabix type sy-tabix.
CASE i_datasource.
WHEN 'D_VBSEGK'.
LOOP AT c_t_data INTO
l_s_ZOXERS0119.
l_tabix = sy-tabix.

lwa_faede-SHKZG = 'H' ."Credit or


Debit
lwa_faede-koart = 'K' . "Acct type
lwa_faede-ZFBDT =
l_s_ZOXERS0119-ZFBDT.
lwa_faede-ZBD1T =
l_s_ZOXERS0119-ZBD1T.
lwa_faede-ZBD2T =
l_s_ZOXERS0119-ZBD2T.
lwa_faede-rebzt =

10/26/2016 11:54 PM

Error with datasource enhancement

10 of 13

https://archive.sap.com/discussions/thread/3940859

l_s_ZOXERS0119-rebzt.
lwa_faede-rebzg = l_s_ZOXERS0119-rebzg.
CALL FUNCTION 'DETERMINE_DUE_DATE'
EXPORTING
i_faede = lwa_faede
IMPORTING
e_faede = lwa_faede
EXCEPTIONS
ACCOUNT_TYPE_NOT_SUPPORTED
OTHERS

=1

= 2.

IF sy-subrc = 0.
l_s_ZOXERS0119-ZZFAEDT = lwa_faede-netdt.
MODIFY c_t_data FROM l_s_ZOXERS0119 INDEX
l_tabix.
ENDIF.
ENDLOOP.
ENDCASE.
0

(https://people.sap.com/duncan.scn)
D. Chia (https://people.sap.com/duncan.scn)replied
August 04, 2016 at 16:05 PM

well, you can do two things


(separately) to verify if this is
indeed working correctly for
ALL cases even without the
Document Date passed in.
first, test the FM directly in
SE37 independently and pass
in those few values ... see if it
indeed return the due date
properly. you can test with ...
or without document date.
would be easier to test than

10/26/2016 11:54 PM

Error with datasource enhancement

11 of 13

https://archive.sap.com/discussions/thread/3940859

within the context of running Datasource test extraction

as a wild guess, if indeed the FM can return due dates


correctly even without that date field ... perhaps it can
determine the doc date based on some of the other
values u passed it ...
just curious, what are these 2 values REBZT and REBZG
? i think the other 3 are baseline date + payment terms...
right?
lwa_faede-rebzt = l_s_ZOXERS0119-rebzt.
lwa_faede-rebzg = l_s_ZOXERS0119-rebzg.

(https://people.sap.com/chrom.men)
Pha London (https://people.sap.com/chrom.men)replied
August 04, 2016 at 16:05 PM

Hi Chia,
i check the datasource in
RSA3 and it returns value. it
looks good but i need check it
again.
Hier is the Explaination:
lwa_faede-ZFBDT =
l_s_ZOXERS0119-ZFBDT.
"Baseline Date for Due Date
Calculation
lwa_faede-ZBD1T =
l_s_ZOXERS0119ZBD1T."Cash Discount Days
1
lwa_faede-ZBD2T =
l_s_ZOXERS0119-ZBD2T.
"Cash Discount Days 2
lwa_faede-rebzt =

10/26/2016 11:54 PM

Error with datasource enhancement

12 of 13

https://archive.sap.com/discussions/thread/3940859

l_s_ZOXERS0119-rebzt. "Follow-On Document Type


lwa_faede-rebzg = l_s_ZOXERS0119-rebzg."Number
of the Invoice the Transaction Belongs to

actually i need to include: bldat."Document Date in


Document, but in the Structure of datasource
D_VBSEGK, there is no Document Date in Document.

i have a question:
the fields: SHKZG in datasource has 2 value: 'H' and
'S' and koart has : 'K' and 'D' . i just include one value
of each paar to test the Code.
But when the field has 2 value, i need to include them
into the Code rights?
How to do that?
i have tried but it doesn't work with "OR"
0

Helpful Answer

(https://people.sap.com/duncan.scn)
D. Chia (https://people.sap.com/duncan.scn)replied
August 04, 2016 at 16:28 PM

i would have assumed by the


way you are looping at the
extracted source data..
that the SHKZG (Dr/Cr
Indicator) and KOART
(Account Type) would be
taken from the extracted
source record eg.
l_s_ZOXERS0119-SHKZG (i am
just assuming this indicator is the
one you really need)

10/26/2016 11:54 PM

Error with datasource enhancement

13 of 13

https://archive.sap.com/discussions/thread/3940859

for those values not readily available (eg. BLDAT and


KOART) .. you either use what you have access to in
the loop eg. document no/year/item no ... to retrieve it
separately into the program run
or enhance the DS first to add those field values to be
included in the extraction. after that you can just access
them in code.
sorry, i am not an apps expert .. and have no system to
check all these. hopefully it helps u get nearer to
completion.
0

(https://people.sap.com/chrom.men)
Pha London (https://people.sap.com/chrom.men)replied
August 04, 2016 at 16:41 PM

Thanks Chia.
You are so nice and ..
beautiful also
1

10/26/2016 11:54 PM

You might also like