Question:
I´m trying to do a unit conversion using an exit function. I´m not able to change the records, it says 1300 records read but 0 modified.
This is the code that I have, does someone know what I´m missing?
FUNCTION Z_BPS_UNIT_CONVERSION_I.
*"----------------------------------------------------------------------
*"*"Interfase local
*" IMPORTING
*" REFERENCE(I_AREA) TYPE UPC_Y_AREA OPTIONAL
*" REFERENCE(ITO_CHASEL) TYPE UPC_YTO_CHASEL OPTIONAL
*" REFERENCE(ITO_CHA) TYPE UPC_YTO_CHA OPTIONAL
*" EXPORTING
*" REFERENCE(ETH_CHAS) TYPE HASHED TABLE
*" CHANGING
*" REFERENCE(XS_CHAS) TYPE ANY OPTIONAL
*"----------------------------------------------------------------------
* TABLES: ...
TABLES: /BI0/PMAT_UNIT.
* DATA: ...
DATA: lineref type ref to data,
tab type ref to data,
ls_chasel type UPC_YS_CHASEL,
lt_charng type UPC_YT_CHARNG,
ls_charng type UPC_Ys_CHARNG,
ls_area type UPC_Y_AREA.
* FIELD-SYMBOLS: ...
field-symbols: <fs> type any.
* TYPES: ...
TYPES:
begin of l_add,
0MATERIAL(1 type c,
0COPASLQTY type p,
ZINVCDQTE type p,
end of l_add.
DATA:
g_s_data TYPE l_add.
* Create a line that looks like the output table
create data lineref like line of eth_chas.
assign lineref->* to <fs>.
LOOP AT ETH_CHAS ASSIGNING <fs>.
move-corresponding <fs> to g_s_data.
* Create output lines
SELECT SINGLE *
FROM /BI0/PMAT_UNIT
WHERE MATERIAL = g_s_data-0MATERIAL AND
MAT_UNIT = 'EMB'.
g_s_data-ZINVCDQTE = g_s_data-0copaslqty *
/bi0/pmat_unit-DENOMINTR
/ /bi0/pmat_unit-numerator.
move-corresponding g_s_data to <fs>.
insert <fs> into table eth_chas.
ENDLOOP.
Thanks a lot!!!
Theresa.
Answer:
I've not tested it but just a hint...
Usually,
changing parameters are supplied back to planning objects.
in your program, changing parameter is XS_CHAS which is not assigned with any value in the program.
did you try assigning ETH_CHAS to XS_CHAS at the end of the program?
also, did u make sure that ZINVCDQTE field is included in the "fields to be changed" of exit funciton?
all fields that you are changing in the exit funciton needs to be included in the "fields to be changed" of exit funciton.
hope it helps.