2014 Mar 10 12:23 AM
Hi Experts,
I have a concern regarding updating the field in EQUI.
I need to update table IHPA parnr and table EQUI-kunde. I used PM_PARTNER_UPDATE for updating table ihpa, but how can i update the kunde in table EQUI?
2014 Mar 10 1:35 PM
irst, don't use PM_PARTNER_UPDATE, look at its attributes, this is an update FM so using this FM or using a plain opens-sql statement are similar and not suitable for database integrity.
Do as much as possible with BAPI_EQUI_CHANGE or even BDC. (Or try to cheat using in sequence PM_PARTNER_UPDATE, ITOB_EQUIPMENT_READ_SINGLE and ITOB_EQUIPMENT_MODIFY_SINGLE, but you are leaving best practices...)
Regards,
Raymond
Hi Experts,
I have a concern regarding updating the field in EQUI.
I need to update table IHPA parnr and table EQUI-kunde. I used PM_PARTNER_UPDATE for updating table ihpa, but how can i update the kunde in table EQUI?
2014 Mar 10 1:35 PM
irst, don't use PM_PARTNER_UPDATE, look at its attributes, this is an update FM so using this FM or using a plain opens-sql statement are similar and not suitable for database integrity.
Do as much as possible with BAPI_EQUI_CHANGE or even BDC. (Or try to cheat using in sequence PM_PARTNER_UPDATE, ITOB_EQUIPMENT_READ_SINGLE and ITOB_EQUIPMENT_MODIFY_SINGLE, but you are leaving best practices...)
Regards,
Raymond
2014 Mar 11 12:03 AM
Hi Raymond,
Thank you for the response.
BAPI_EQUI_CHANGE does not have a field named kunde for CurCustomer that is why i didn't used it, then i search in the net and saw a code and tried it. But in my program it returns me a "Not Successful" output.
SELECT objnr
INTO gt_fxihpa-objnr
FROM equi
WHERE equnr EQ p_equnr.
ENDSELECT.
SELECT parvw
INTO gt_fxihpa-parvw
FROM ihpa
WHERE objnr EQ gt_fxihpa-objnr.
ENDSELECT.
IF r_emp EQ 'X'.
gt_fxihpa-parvw_ext = 'VW'. "'Assigned to Employee'.
ELSEIF r_third EQ 'X'.
gt_fxihpa-parvw_ext = 'VN'. " 'Assigned to Vendor'.
ENDIF.
gt_fxihpa-mandt = sy-mandt.
gt_fxihpa-erdat = sy-datum.
gt_fxihpa-erzeit = sy-uzeit.
gt_fxihpa-ernam = sy-uname.
gt_fxihpa-aedat = sy-datum.
gt_fxihpa-aezeit = sy-uzeit.
gt_fxihpa-aenam = sy-uname.
gt_fxihpa-obtyp = 'IEQ'.
gt_fxihpa-parnr = p_kunnr.
gt_fxihpa-updkz = 'U'.
APPEND gt_fxihpa.
IF NOT gt_fxihpa IS INITIAL.
CALL FUNCTION 'PM_PARTNER_UPDATE'
TABLES
fxihpa = gt_fxihpa.
IF sy-subrc = 0.
COMMIT WORK.
ENDIF.
ENDIF.
DATA: l_valid_equi LIKE itob,
l_itob_old LIKE itob,
l_itob_new LIKE itob,
l_valid_equi_new LIKE itob,
l_itob_rec LIKE itob,
gt_equipment LIKE bapi_itob_parms-equipment.
gt_equipment = p_equnr.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = p_equnr
IMPORTING
output = gt_equipment.
CALL FUNCTION 'ITOB_EQUIPMENT_READ_SINGLE'
exporting
i_lock = 'X'
i_objnr = gt_equipment
importing
e_object_rec = l_valid_equi
exceptions
not_successful = 1
others = 2.
IF sy-subrc = 0.
l_valid_equi_new = l_valid_equi.
l_valid_equi_new-kunde = p_kunnr.
move: l_valid_equi to l_itob_old,
l_valid_equi_new to l_itob_new.
CLEAR l_itob_rec.
* Function module to udate equipment data
call function 'ITOB_EQUIPMENT_MODIFY_SINGLE'
exporting
* i_auth_tcode = 'IE02'
i_filter_data = space
i_write_buffer = 'X'
i_post_buffer = 'X'
i_commit_work = 'X'
i_object_rec = l_itob_new
i_object_rec_old = l_itob_old
importing
e_object_rec = l_itob_rec
exceptions
not_successful = 1
others = 2.
IF sy-subrc = 0.
ENDIF.
ENDIF.
2014 Mar 11 4:25 AM
Hi Calix,
have you debugged the code and find out where the issue is?
are you saying the outcome of this fm ITOB_EQUIPMENT_MODIFY_SINGLE' is not successful.
regards
2014 Mar 11 5:10 AM
When i debug the program l_itob_new and l_itob_old has a value inside,
but
importing
e_object_rec = l_itob_rec
has no value.
2014 Mar 11 9:15 AM
did you check the customer number or the data in the field kunde exists in the table kna1 or not?
2014 Mar 11 9:59 AM
Thank you for the response. Ive ched it already and i dont know what is wrong in the bapi. But I made it run using BDC. Thank you Satish Chandra and Raymond Giuseppi.
2014 Mar 11 11:04 AM
Wow ! you completed the task... good.
i don't see any issues in bapi/Fm it worked fine here with me.. i copied the code u gave and tried yes i got subrc = 1 at the beginning when i debugged it inthe code yes for me i found if customer no exists in the table KNA1 it was successful.
Congrats once again...
Regards
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |