on 06-28-2010 10:55 AM
Hi,
I am writing a piece of code to modify the existing cost centre value using a FM BAPI_EQUI_CHANGE
I am getting a dump although i maintained a correct lenth.Below is my piece of code.I am getting dump when calling FM CALL FUNCTION 'BAPI_EQUI_CHANGE'.Can somebody help me????
Error analysis
An exception occurred that is explained in detail below.
The exception, which is assigned to class 'CX_SY_DYN_CALL_ILLEGAL_TYPE', was
not caught and
therefore caused a runtime error.
The reason for the exception is:
The call to the function module "BAPI_EQUI_CHANGE" is incorrect:
In the function module interface, you can specify only
fields of a specific type and length under "DATA_GENERAL".
Although the currently specified field
"LV_BAPI_ITOB_EQ_ONLY-COSTCENTER" is the correct type, its length is incorrect.
Program::::::::::::::::::::::
TABLES:itob.
TYPES: BEGIN OF ty_itob,
eqtyp(1) TYPE c,
equnr(18) TYPE c,
objnr(22) TYPE c,
iwerk(4) TYPE c,
swerk(4) TYPE c,
kostl(10) TYPE c,
END OF ty_itob.
TYPES:BEGIN OF ty_jest,
objnr TYPE j_objnr,
stat TYPE j_status,
inact TYPE j_inact,
END OF ty_jest.
DATA:gt_jest TYPE TABLE OF ty_jest,
gs_jest LIKE LINE OF gt_jest.
DATA:gt_itob TYPE TABLE OF ty_itob,
gs_itob LIKE LINE OF gt_itob.
DATA:bapi_stat LIKE bapi_itob_status OCCURS 0 WITH HEADER LINE.
DATA:user_stat LIKE bapi_itob_status OCCURS 0 WITH HEADER LINE.
DATA:lv_return like bapiret2.
data:lv_BAPI_ITOB_EQ_ONLY type BAPI_ITOB.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-b01.
PARAMETERS:
po_iwerk LIKE itob-iwerk,
po_swerk LIKE itob-swerk,
po_eqtyp LIKE itob-eqtyp,
po_kostl LIKE itob-kostl,
po_equnr LIKE itob-equnr.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-b02.
PARAMETERS:
po_cost(10) type c.
SELECTION-SCREEN END OF BLOCK b2.
DATA:po_cust LIKE bapi_itob OCCURS 0 WITH HEADER LINE.
start-of-selection.
SELECT equnr objnr kostl FROM itob
INTO CORRESPONDING FIELDS OF TABLE gt_itob
where iwerk = po_iwerk
and swerk = po_swerk
and eqtyp = po_eqtyp
WHERE kostl = po_kostl
AND equnr = po_equnr.
IF sy-subrc = 0.
SORT gt_itob BY equnr.
DELETE ADJACENT DUPLICATES FROM gt_itob COMPARING equnr.
ENDIF.
LOOP AT gt_itob INTO gs_itob.
CALL FUNCTION 'BAPI_EQUI_GETSTATUS'
EXPORTING
equipment = gs_itob-equnr
language = sy-langu
LANGUAGE_ISO =
IMPORTING
RETURN =
TABLES
system_status = bapi_stat
user_status = user_stat.
DELETE bapi_stat[] WHERE text = 'DLFL'.
MOVE po_cost TO lv_BAPI_ITOB_EQ_ONLY-costcenter.
CALL FUNCTION 'BAPI_EQUI_CHANGE'
EXPORTING
equipment = gs_itob-equnr
data_general = lv_BAPI_ITOB_EQ_ONLY-costcenter
data_generalx = 'X'
data_specific =
data_specificx =
DATA_FLEET =
DATA_FLEETX =
VALID_DATE = SY-DATUM
VALID_TIME = SY-UZEIT
IMPORTING
DATA_GENERAL_EXP =
DATA_SPECIFIC_EXP =
DATA_FLEET_EXP =
RETURN = lv_return.
IF sy-subrc = 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
IMPORTING
RETURN =
ENDIF. .
ENDLOOP.
*endselect.
Hi Subhasis,
try this instead:
(...)
data:lv_BAPI_ITOB_EQ_ONLYX type BAPI_ITOBX.
(...)
lv_BAPI_ITOB_EQ_ONLYX-costcenter = 'X'.
MOVE po_cost TO lv_BAPI_ITOB_EQ_ONLY-costcenter.
CALL FUNCTION 'BAPI_EQUI_CHANGE'
EXPORTING
equipment = gs_itob-equnr
data_general = lv_BAPI_ITOB_EQ_ONLY
data_generalx = lv_BAPI_ITOB_EQ_ONLYX
(...)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
H,
TABLES:itob.
TYPES: BEGIN OF ty_itob,
eqtyp(1) TYPE c,
equnr(18) TYPE c,
objnr(22) TYPE c,
iwerk(4) TYPE c,
swerk(4) TYPE c,
kostl(10) TYPE c,
END OF ty_itob.
TYPES:BEGIN OF ty_jest,
objnr TYPE j_objnr,
stat TYPE j_status,
inact TYPE j_inact,
END OF ty_jest.
DATA:gt_jest TYPE TABLE OF ty_jest,
gs_jest LIKE LINE OF gt_jest.
DATA:gt_itob TYPE TABLE OF ty_itob,
gs_itob LIKE LINE OF gt_itob.
DATA:bapi_stat LIKE bapi_itob_status OCCURS 0 WITH HEADER LINE.
DATA:user_stat LIKE bapi_itob_status OCCURS 0 WITH HEADER LINE.
DATA:lv_return like bapiret2.
data:lv_BAPI_ITOB_EQ_ONLY type BAPI_ITOB.
data:lv_BAPI_ITOB_EQ_ONLYX type BAPI_ITOBX.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-b01.
PARAMETERS:
po_iwerk LIKE itob-iwerk,
po_swerk LIKE itob-swerk,
po_eqtyp LIKE itob-eqtyp,
po_kostl LIKE itob-kostl,
po_equnr LIKE itob-equnr.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-b02.
PARAMETERS:
po_cost(10) type c.
SELECTION-SCREEN END OF BLOCK b2.
DATA:po_cust LIKE bapi_itob OCCURS 0 WITH HEADER LINE.
start-of-selection.
SELECT equnr objnr kostl FROM itob
INTO CORRESPONDING FIELDS OF TABLE gt_itob
where iwerk = po_iwerk
and swerk = po_swerk
and eqtyp = po_eqtyp
WHERE kostl = po_kostl
AND equnr = po_equnr.
IF sy-subrc = 0.
SORT gt_itob BY equnr.
DELETE ADJACENT DUPLICATES FROM gt_itob COMPARING equnr.
ENDIF.
LOOP AT gt_itob INTO gs_itob.
CALL FUNCTION 'BAPI_EQUI_GETSTATUS'
EXPORTING
equipment = gs_itob-equnr
language = sy-langu
LANGUAGE_ISO =
IMPORTING
RETURN =
TABLES
system_status = bapi_stat
user_status = user_stat.
DELETE bapi_stat[] WHERE text = 'DLFL'.
lv_BAPI_ITOB_EQ_ONLYX-costcenter = 'X'.
MOVE po_cost TO lv_BAPI_ITOB_EQ_ONLY-costcenter.
CALL FUNCTION 'BAPI_EQUI_CHANGE'
EXPORTING
equipment = gs_itob-equnr
data_general = lv_BAPI_ITOB_EQ_ONLY-costcenter
data_generalx = lv_BAPI_ITOB_EQ_ONLYX
data_specific =
data_specificx =
DATA_FLEET =
DATA_FLEETX =
VALID_DATE = SY-DATUM
VALID_TIME = SY-UZEIT
IMPORTING
DATA_GENERAL_EXP =
DATA_SPECIFIC_EXP =
DATA_FLEET_EXP =
RETURN = lv_return.
IF sy-subrc = 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
IMPORTING
RETURN =
ENDIF. .
ENDLOOP.
*endselect.
Don't use
CALL FUNCTION 'BAPI_EQUI_CHANGE'
EXPORTING
equipment = gs_itob-equnr
data_general = lv_BAPI_ITOB_EQ_ONLY-costcenter
data_generalx = lv_BAPI_ITOB_EQ_ONLYX
...
Instead use
CALL FUNCTION 'BAPI_EQUI_CHANGE'
EXPORTING
equipment = gs_itob-equnr
data_general = lv_BAPI_ITOB_EQ_ONLY
data_generalx = lv_BAPI_ITOB_EQ_ONLYX
...
Also you could call the code inspector(SCI or SLIN for old version of R3) which can detect such errors.
Regards,
Raymond
PS: As [RobbdB|http://forums.sdn.sap.com/profile.jspa?userID=4046452] wrote it in his first answer
Edited by: Raymond Giuseppi on Jun 28, 2010 1:07 PM
CALL FUNCTION 'BAPI_EQUI_CHANGE'
EXPORTING
equipment = gs_itob-equnr
data_general = lv_BAPI_ITOB_EQ_ONLY-costcenter
data_generalx = lv_BAPI_ITOB_EQ_ONLYX
should be
CALL FUNCTION 'BAPI_EQUI_CHANGE'
EXPORTING
equipment = gs_itob-equnr
data_general = lv_BAPI_ITOB_EQ_ONLY
data_generalx = lv_BAPI_ITOB_EQ_ONLYX
Hi,
Thanks very much for ur answer , i changed accordingly but same dump resulted.
I am not sure what exactly the FM doing .The probleam is i am unable to go insight the FM , after calling only giving dump.
Thanks once again all of u..If u feel still u can sove my probleam then welcome the valuable answers.
Thanks
Thanks ...
My probleam solved...Actually i have to ipmopt two parameters also in the above FM.
i.e
CALL FUNCTION 'BAPI_EQUI_CHANGE'
EXPORTING
equipment = gs_itob-equnr
data_general = lv_BAPI_ITOB_EQ_ONLY " -costcenter
data_generalx = lv_BAPI_ITOB_EQ_ONLYX
data_specific = lv_BAPI_ITOB_EQ_ONLY1 '''''''''''''''' This One
data_specificx = lv_BAPI_ITOB_EQ_ONLYX1 """""""""second 1* DATA_FLEET =
DATA_FLEETX =
VALID_DATE = SY-DATUM
VALID_TIME = SY-UZEIT
IMPORTING
DATA_GENERAL_EXP =
DATA_SPECIFIC_EXP =
DATA_FLEET_EXP =
RETURN = lv_return.
Subhasis, please be more rigourous, as the dump states very clearly the issue (error in length). CHECK TWICE. Moreover, RobbdB gave you the right answer and you couldn't even see it!!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
98 | |
11 | |
11 | |
10 | |
10 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.