Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

updating table equi

Former Member
0 Likes
2,623

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?

1 ACCEPTED SOLUTION
Read only

RaymondGiuseppi
Active Contributor
2,109

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?

7 REPLIES 7
Read only

RaymondGiuseppi
Active Contributor
2,110

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

Read only

0 Likes
2,109

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.

Read only

0 Likes
2,109

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


Read only

0 Likes
2,109

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.

Read only

0 Likes
2,109

did you check the customer number or the data in the field kunde exists in the table kna1 or not?

Read only

0 Likes
2,109

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.

Read only

0 Likes
2,109

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