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

regarding BAPI_ROUTING_CREATE

Former Member
0 Likes
1,244

hi,

i am trying to upload data using bapi BAPI_ROUTING_CREATE the bapi is running successfully wit return code 'S' and also generating number.but the data is not saving in table.i used even 'BAPI_TRANSACTION_COMMIT'.

thank's in advance.

10 REPLIES 10
Read only

Former Member
0 Likes
1,079

Hello

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = 'X'.

Read only

0 Likes
1,079

i had done that even than it is not updating tables

Read only

0 Likes
1,079

Hello

Check parameter TESTRUN. It must be space.

Read only

0 Likes
1,079

thanks for reply....it is space...

Read only

Former Member
0 Likes
1,079

Hi,

I hope the below link will help you.

Thanks,

Khushboo.

Read only

0 Likes
1,079

the link is not useful ,thanks for reply

Read only

Former Member
0 Likes
1,079

hii

just write commit work after BAPI FM and see if updation is done or not..actually if success message is there then you can use BAPI_TRANSACTION_COMMIT and it will commit all updation.also refer code in given link.i hope it helps you.

[BAPI_ROUTING_CREATE|]

regards

twinkal

Read only

Former Member
0 Likes
1,079

Any one .....please suggest me regarding this

Read only

Former Member
0 Likes
1,079

Dear NAveen,

Can u send me the sample code for the bapi that u had use.iam working past 2 weeks but i could not solve it.i do want to send, sequence,operation,suboperation.iam not getting success message

Read only

0 Likes
1,079

*---->define table->bapi

DATA: group TYPE bapi1012_tsk_c-task_list_group,

group_counter TYPE bapi1012_tsk_c-group_counter,

sequence_no TYPE bapi1012_opr_c-sequence_no,

task_list_usage TYPE bapi1012_tsk_c-task_list_usage,

task_list_status TYPE bapi1012_tsk_c-task_list_status,

lot_size_from TYPE bapi1012_tsk_c-lot_size_from,

lot_size_to TYPE bapi1012_tsk_c-lot_size_to,

task_measure_unit TYPE bapi1012_tsk_c-task_measure_unit,

application TYPE bapi1012_control_data-application,

testrun TYPE bapiflag,

profile TYPE bapi1012_control_data-profile,

bomusage TYPE bapi1012_control_data-bom_usage,

task TYPE bapi1012_tsk_c OCCURS 0 WITH HEADER LINE,

materialtaskallocation TYPE bapi1012_mtk_c OCCURS 0 WITH HEADER LINE,

sequence TYPE bapi1012_seq_c OCCURS 0 WITH HEADER LINE,

operation TYPE bapi1012_opr_c OCCURS 0 WITH HEADER LINE,

suboperation TYPE bapi1012_sub_opr_c OCCURS 0 WITH HEADER LINE,

referenceoperation TYPE bapi1012_ref_opr_c OCCURS 0 WITH HEADER LINE,

workcenterreference TYPE bapi1012_wc_ref_opr_c OCCURS 0 WITH HEADER LINE,

componentallocation TYPE bapi1012_com_c OCCURS 0 WITH HEADER LINE,

productionresource TYPE bapi1012_prt_c OCCURS 0 WITH HEADER LINE,

inspcharacteristic TYPE bapi1012_cha_c OCCURS 0 WITH HEADER LINE,

textallocation TYPE bapi1012_txt_hdr_c OCCURS 0 WITH HEADER LINE,

text TYPE bapi1012_txt_c OCCURS 0 WITH HEADER LINE,

return TYPE bapiret2 OCCURS 0 WITH HEADER LINE,

bapi_retn_info LIKE bapiret2 OCCURS 0 WITH HEADER LINE.

*---->message table

DATA: BEGIN OF t_error OCCURS 0.

DATA material LIKE bapi1012_mtk_c-material.

INCLUDE STRUCTURE bapiret2.

DATA: END OF t_error.

*---->inner table

DATA: BEGIN OF itab1 OCCURS 0 ,

material LIKE bapi1012_mtk_c-material,

plant LIKE bapi1012_mtk_c-plant,

description1 LIKE bapi1012_tsk_c-description,

activity LIKE bapi1012_opr_c-activity,

work_cntr LIKE bapi1012_opr_c-work_cntr,

control_key LIKE bapi1012_opr_c-control_key,

description LIKE bapi1012_opr_c-description,

base_quantity LIKE bapi1012_opr_c-base_quantity,

std_value_01 LIKE bapi1012_opr_c-std_value_01,

std_value_02 LIKE bapi1012_opr_c-std_value_02,

max_no_of_splits LIKE bapi1012_opr_c-max_no_of_splits,

FJS(2) TYPE C,

ind_splitting_reqrd LIKE bapi1012_opr_c-ind_splitting_reqrd,

required_overlapping LIKE bapi1012_opr_c-required_overlapping,

min_send_ahead_qty LIKE bapi1012_opr_c-min_send_ahead_qty,

ext_proc_with_subcontract_ind LIKE bapi1012_opr_c-ext_proc_with_subcontract_ind,

info_rec LIKE bapi1012_opr_c-info_rec,

purch_org LIKE bapi1012_opr_c-purch_org,

cost_elem LIKE bapi1012_opr_c-cost_elem,

COST_RELEVANT like bapi1012_opr_c-COST_RELEVANT,

END OF itab1.

DATA: BEGIN OF itab OCCURS 0 ,

material LIKE bapi1012_mtk_c-material,

plant LIKE bapi1012_mtk_c-plant,

description1 LIKE bapi1012_tsk_c-description,

activity LIKE bapi1012_opr_c-activity,

work_cntr LIKE bapi1012_opr_c-work_cntr,

control_key LIKE bapi1012_opr_c-control_key,

description LIKE bapi1012_opr_c-description,

base_quantity LIKE bapi1012_opr_c-base_quantity,

std_value_01 LIKE bapi1012_opr_c-std_value_01,

std_value_02 LIKE bapi1012_opr_c-std_value_02,

max_no_of_splits LIKE bapi1012_opr_c-max_no_of_splits,

ind_splitting_reqrd LIKE bapi1012_opr_c-ind_splitting_reqrd,

required_overlapping LIKE bapi1012_opr_c-required_overlapping,

min_send_ahead_qty LIKE bapi1012_opr_c-min_send_ahead_qty,

ext_proc_with_subcontract_ind LIKE bapi1012_opr_c-ext_proc_with_subcontract_ind,

info_rec LIKE bapi1012_opr_c-info_rec,

purch_org LIKE bapi1012_opr_c-purch_org,

cost_elem LIKE bapi1012_opr_c-cost_elem,

END OF itab.

DATA : gt_itab LIKE itab OCCURS 0 WITH HEADER LINE.

DATA : lv_cancel(1) TYPE c.

*---->upload

CALL FUNCTION 'UPLOAD'

EXPORTING

filename = 'C:\Documents and Settings\Administrator\Desktop\工艺路线.txt'

filetype = 'DAT'

IMPORTING

cancel = lv_cancel

TABLES

data_tab = itab1

EXCEPTIONS

conversion_error = 1

invalid_table_width = 2

invalid_type = 3

no_batch = 4

unknown_error = 5

gui_refuse_filetransfer = 6

OTHERS = 7.

IF lv_cancel EQ 'X'.

LEAVE PROGRAM.

ENDIF.

IF sy-subrc 0 .

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ELSEIF sy-subrc = 0.

SORT itab1 BY material plant activity.

LOOP AT ITAB1.

MOVE-CORRESPONDING ITAB1 TO ITAB.

CONDENSE ITAB1-FJS NO-GAPS.

ITAB-max_no_of_splits = ITAB1-FJS.

APPEND ITAB.

ENDLOOP.

SORT ITAB BY MATERIAL PLANT.

LOOP AT itab.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = itab-material

IMPORTING

output = itab-material.

MOVE itab TO gt_itab.

APPEND gt_itab.

*-----〉item-sequence

*operation-group_counter = '1'.

operation-activity = itab-activity.

operation-control_key = itab-control_key.

operation-work_cntr = itab-work_cntr.

operation-description = itab-description.

operation-plant = itab-plant.

operation-operation_measure_unit = 'EA'.

operation-denominator = 1.

operation-nominator = 1.

operation-base_quantity = itab-base_quantity.

operation-std_value_01 = itab-std_value_01.

operation-std_value_02 = itab-std_value_02.

operation-ind_splitting_reqrd = itab-ind_splitting_reqrd.

operation-max_no_of_splits = itab-max_no_of_splits."'1'.

operation-required_overlapping = itab-required_overlapping.

operation-min_send_ahead_qty = itab-min_send_ahead_qty.

operation-ext_proc_with_subcontract_ind = itab-ext_proc_with_subcontract_ind."'X'.

operation-info_rec = itab-info_rec.

operation-purch_org = itab-purch_org.

operation-cost_elem = itab-cost_elem.

operation-COST_RELEVANT = 'X'.

APPEND operation.

AT END OF material.

*-----〉header

task-task_list_usage = '1'.

task-task_list_status = '4'.

**---->unit

select single MEINS into task-task_measure_unit

from mara

where matnr = gt_itab-material.

task-task_measure_unit = 'EA'.

task-description = gt_itab-description1."'TEST ROUTING'.

task-plant = gt_itab-plant.

task-valid_from = sy-datum.

task-valid_to_date = '99991231'.

APPEND task.

materialtaskallocation-material = gt_itab-material.

materialtaskallocation-plant = gt_itab-plant.

task-valid_from = sy-datum.

task-valid_to_date = '99991231'.

APPEND materialtaskallocation.

CALL FUNCTION 'BAPI_ROUTING_CREATE'

EXPORTING

testrun = testrun

profile = profile

bomusage = bomusage

application = application

IMPORTING

group = group

groupcounter = group_counter

TABLES

task = task

materialtaskallocation = materialtaskallocation

sequence = sequence

operation = operation

suboperation = suboperation

referenceoperation = referenceoperation

workcenterreference = workcenterreference

componentallocation = componentallocation

productionresource = productionresource

inspcharacteristic = inspcharacteristic

textallocation = textallocation

text = text

return = return.

REFRESH task.

REFRESH GT_ITAB.

REFRESH materialtaskallocation.

REFRESH operation.

LOOP AT return.

IF return-type EQ 'E' OR return-type EQ 'A'.

t_error-material = materialtaskallocation-material.

t_error-message = return-message.

APPEND t_error.

ELSE.

COMMIT WORK.

ENDIF.

ENDLOOP.

LOOP AT t_error.

WRITE:/ t_error-material,t_error-message.

ENDLOOP.

ENDAT.

ENDLOOP.

ENDIF.