2016 Aug 04 1:13 PM
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
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!
2016 Aug 04 1:44 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 the particular line causing the Error.
2016 Aug 04 1: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 component called "KOART".
i think i did something wrong from " lwa_faede-koart = 'K' . "Acct type" to the End
2016 Aug 04 2: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_zoxers0119-zterm..
lwa_faede-l_s_zoxers0119 = ''.
CALL FUNCTION 'DETERMINE_DUE_DATE'
EXPORTING
i_faede = lwa_faede
* I_GL_FAEDE =
* IMPORTING
* E_FAEDE =
EXCEPTIONS
ACCOUNT_TYPE_NOT_SUPPORTED = 1
OTHERS = 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.
2016 Aug 04 1:58 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 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
2016 Aug 04 2: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
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.
2016 Aug 04 2:07 PM
moved from above thread for better continuity (in case you missed it)
DATA lwa_faede type FAEDT_FPOSthe 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 tcode SE37 and look at the import paramater 'i_faede' TYPE ....
2016 Aug 04 2: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_ZOXERS0119-bldat."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 = 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 = 1
OTHERS = 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.
2016 Aug 04 2:53 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 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.
2016 Aug 04 3: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_ZOXERS0119-ZBD1T."Cash Discount Days 1
lwa_faede-ZBD2T = l_s_ZOXERS0119-ZBD2T. "Cash Discount Days 2
lwa_faede-rebzt = 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"
2016 Aug 04 3:25 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)
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.
2016 Aug 04 3:41 PM