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

BAPI_INSPOPER_RECORDRESULTS Function Module troubles

Former Member
0 Likes
1,363

Hi Guys,

I have problems with using the BAPI_INSPOPER_RECORDRESULTS function module.

I'm trying to use it in order to update the DB with new results for an inspection lot (Table QASR). But the problem I tried to execute the function in several manners, but without update the DB.

Is there someone, who used this function module and succeeded with the DB update??? And if it's possible to have a sample code of the right manner to use it.

Thanks.

Best Regards.

Mohamed.

8 REPLIES 8
Read only

Former Member
0 Likes
1,112

up

Read only

Former Member
0 Likes
1,112

UP

Read only

Former Member
0 Likes
1,112

up

Read only

Former Member
0 Likes
1,112

up

Read only

Former Member
0 Likes
1,112

up

Very Urgent please!!!

Read only

Former Member
0 Likes
1,112

up

Read only

Former Member
0 Likes
1,112

up

Read only

Former Member
1,112

Hi,

I finally solved the problem like this :

DATA: i_data TYPE bapi2045l4 OCCURS 0,

wa_data LIKE LINE OF i_data,

i_char_results TYPE bapi2045d2 OCCURS 0,

wa_char_results LIKE LINE OF i_char_results,

i_single_results TYPE bapi2045d4 OCCURS 0,

wa_single_results LIKE LINE OF i_single_results,

i_bapireturn2 TYPE bapiret2 OCCURS 0,

wa_bapireturn2 LIKE LINE OF i_bapireturn2,

i_returntable TYPE bapiret2 OCCURS 0,

wa_returntable LIKE LINE OF i_returntable,

i_sample_results TYPE bapi2045d3 OCCURS 0,

wa_sample_results LIKE LINE OF i_sample_results.

CLEAR: wa_results,

wa_sample_results,

wa_data,

wa_char_results,

wa_plmk,

wa_insp_point_ump.

REFRESH: i_data,

i_char_results,

i_single_results,

i_bapireturn2,

i_returntable,

i_sample_results.

LOOP AT t_results INTO wa_results.

*Update of umpire analysis

READ TABLE t_plmk INTO wa_plmk

WITH KEY plnkn = c_analysis_vumpire

verwmerkm = wa_results-metal.

READ TABLE i_insp_point_ump INTO wa_insp_point_ump

WITH KEY inspoper = c_analysis_umpire

phys_smpl = wa_results-phynr.

wa_char_results-insplot = w_insp_lot.

wa_char_results-inspoper = c_analysis_umpire.

wa_char_results-inspchar = wa_plmk-merknr.

wa_char_results-mean_value = wa_results-ump_an.

APPEND wa_char_results TO i_char_results.

wa_data-insplot = w_insp_lot.

wa_data-inspoper = c_analysis_umpire.

wa_data-insppoint = wa_insp_point_ump-insppoint.

wa_data-phys_smpl = wa_insp_point_ump-phys_smpl.

wa_data-unit = wa_insp_point_ump-unit.

wa_sample_results-insplot = w_insp_lot.

wa_sample_results-inspoper = c_analysis_umpire.

wa_sample_results-inspchar = wa_plmk-merknr.

wa_sample_results-inspsample = wa_insp_point_ump-insppoint.

wa_sample_results-mean_value = wa_results-ump_an.

APPEND wa_sample_results TO i_sample_results.

CALL FUNCTION 'BAPI_INSPOPER_RECORDRESULTS'

EXPORTING

insplot = w_insp_lot

inspoper = c_analysis_umpire

insppointdata = wa_data

IMPORTING

return = wa_bapireturn2

TABLES

char_results = i_char_results

sample_results = i_sample_results

returntable = i_returntable.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = 'X'

IMPORTING

return = wa_bapireturn2.

CLEAR: wa_sample_results,

wa_data,

wa_char_results,

wa_insp_point_ump,

wa_plmk.

REFRESH: i_data,

i_char_results,

i_single_results,

i_bapireturn2,

i_returntable,

i_sample_results.

*Update of final analysis

READ TABLE t_plmk INTO wa_plmk

WITH KEY plnkn = c_analysis_vfinal

verwmerkm = wa_results-metal.

READ TABLE i_insp_point_fin INTO wa_insp_point_fin

WITH KEY inspoper = c_analysis_final

phys_smpl = wa_results-phynr.

wa_char_results-insplot = w_insp_lot.

wa_char_results-inspoper = c_analysis_final.

wa_char_results-inspchar = wa_plmk-merknr.

wa_char_results-mean_value = wa_results-fin_an.

APPEND wa_char_results TO i_char_results.

wa_data-insplot = w_insp_lot.

wa_data-inspoper = c_analysis_final.

wa_data-insppoint = wa_insp_point_fin-insppoint.

wa_data-phys_smpl = wa_results-phynr.

wa_data-unit = wa_insp_point_ump-unit.

wa_sample_results-insplot = w_insp_lot.

wa_sample_results-inspoper = c_analysis_final.

wa_sample_results-inspchar = wa_plmk-merknr.

wa_sample_results-inspsample = wa_insp_point_fin-insppoint.

wa_sample_results-mean_value = wa_results-fin_an.

APPEND wa_sample_results TO i_sample_results.

CALL FUNCTION 'BAPI_INSPOPER_RECORDRESULTS'

EXPORTING

insplot = w_insp_lot

inspoper = c_analysis_final

insppointdata = wa_data

IMPORTING

return = wa_bapireturn2

TABLES

char_results = i_char_results

sample_results = i_sample_results

returntable = i_returntable.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = 'X'

IMPORTING

return = wa_bapireturn2.

CLEAR: wa_sample_results,

wa_data,

wa_char_results,

wa_insp_point_fin,

wa_plmk.

REFRESH: i_data,

i_char_results,

i_single_results,

i_bapireturn2,

i_returntable,

i_sample_results.

*Update of commercial analysis

READ TABLE t_plmk INTO wa_plmk

WITH KEY plnkn = c_analysis_vcommercial

verwmerkm = wa_results-metal.

READ TABLE i_insp_point_com INTO wa_insp_point_com

WITH KEY inspoper = c_analysis_commercial

phys_smpl = wa_results-phynr.

wa_char_results-insplot = w_insp_lot.

wa_char_results-inspoper = c_analysis_commercial.

wa_char_results-inspchar = wa_plmk-merknr.

wa_char_results-mean_value = wa_results-com_an.

APPEND wa_char_results TO i_char_results.

wa_data-insplot = w_insp_lot.

wa_data-inspoper = c_analysis_commercial.

wa_data-insppoint = wa_insp_point_com-insppoint.

wa_data-phys_smpl = wa_results-phynr.

wa_data-unit = wa_insp_point_com-unit.

wa_sample_results-insplot = w_insp_lot.

wa_sample_results-inspoper = c_analysis_commercial.

wa_sample_results-inspchar = wa_plmk-merknr.

wa_sample_results-inspsample = wa_insp_point_com-insppoint.

wa_sample_results-mean_value = wa_results-com_an.

APPEND wa_sample_results TO i_sample_results.

CALL FUNCTION 'BAPI_INSPOPER_RECORDRESULTS'

EXPORTING

insplot = w_insp_lot

inspoper = c_analysis_commercial

insppointdata = wa_data

IMPORTING

return = wa_bapireturn2

TABLES

char_results = i_char_results

sample_results = i_sample_results

returntable = i_returntable.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = 'X'

IMPORTING

return = wa_bapireturn2.

CLEAR: wa_sample_results,

wa_data,

wa_char_results,

wa_insp_point_com,

wa_plmk.

REFRESH: i_data,

i_char_results,

i_single_results,

i_bapireturn2,

i_returntable,

i_sample_results.

*Update of vendor analysis

READ TABLE t_plmk INTO wa_plmk

WITH KEY plnkn = c_analysis_vvendor

verwmerkm = wa_results-metal.

READ TABLE i_insp_point_ven INTO wa_insp_point_ven

WITH KEY inspoper = c_analysis_vendor

phys_smpl = wa_results-phynr.

wa_char_results-insplot = w_insp_lot.

wa_char_results-inspoper = c_analysis_vendor.

wa_char_results-inspchar = wa_plmk-merknr.

wa_char_results-mean_value = wa_results-ven_an.

APPEND wa_char_results TO i_char_results.

wa_data-insplot = w_insp_lot.

wa_data-inspoper = c_analysis_vendor.

wa_data-insppoint = wa_insp_point_ven-insppoint.

wa_data-phys_smpl = wa_results-phynr.

wa_data-unit = wa_insp_point_ven-unit.

wa_sample_results-insplot = w_insp_lot.

wa_sample_results-inspoper = c_analysis_vendor.

wa_sample_results-inspchar = wa_plmk-merknr.

wa_sample_results-inspsample = wa_insp_point_ven-insppoint.

wa_sample_results-mean_value = wa_results-ven_an.

APPEND wa_sample_results TO i_sample_results.

CALL FUNCTION 'BAPI_INSPOPER_RECORDRESULTS'

EXPORTING

insplot = w_insp_lot

inspoper = c_analysis_vendor

insppointdata = wa_data

IMPORTING

return = wa_bapireturn2

TABLES

char_results = i_char_results

sample_results = i_sample_results

returntable = i_returntable.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = 'X'

IMPORTING

return = wa_bapireturn2.

CLEAR: wa_sample_results,

wa_data,

wa_char_results,

wa_insp_point_ven,

wa_plmk.

REFRESH: i_data,

i_char_results,

i_single_results,

i_bapireturn2,

i_returntable,

i_sample_results.

ENDLOOP.