笔记整理-QM

2021-03-11 11:36:46 浏览数 (1)

QP01,QP02,QP03

QA13,反冲

CA01/CA02/CA03

FM ROUTING_MAINTAIN AND QPCP_CHARACTERISTICS_CREATE

ROUTING_MAINTAIN

Function module: ROUTING_MAINTAIN

Importing Parameter:

KEY_DATE = <Current date>

TASK_LIST_GROUP = <Group>

GROUP_COUNTER = <Counter>

MATERIAL = <Material>

PLANT = <Plant>

Table parameter:

COMPONENT_ALLOCATIONS

MAINTAIN_MODE = 'C'. <M-for modify or D-for delete or C-for create>

FLAG_BAR_POINTER = '0000000001'. (Increase the value for multiple item 1)

SEQUENCE_NO = '000000'.

ACTIVITY = <Operation number>.

BOM_TYPE = <bom type>

BOM_NO = <bom no>

ALTERNATIVE_BOM = <alt.bom>

ITEM_ID = <item id>

ITEM_NO = <item no>

BACKFLUSH = 'X'.

COMPONENT_ALLOCATIONS_X

ACTIVITY = 'X'.

BACKFLUSH = 'X'.

After, calling the FM 'BAPI_TRANSACTION_COMMIT' for commit.

EWB (multilevel BOM)

report .

type-pools: cpsc,cmcl, slis.

tables: mapl.

types: begin of ty_assignment,

matnr like mapl-matnr,

werks type werks_d,

plnnr type plnnr,

plnfl type plnfolge,

plnal type plnal,

plnty type plnty,

vornr type vornr,

stlnr type stko-stlnr,

stlal type stlal,

stlan type stlan,

posnr type sposn,

idnrk type stpo-idnrk,

stlst type plmz-stlst,

end of ty_assignment.

types: begin of ty_plan,

matnr like marc-matnr,

werks like marc-werks,

stlal like mast-stlal,

stlan like mast-stlan,

plnty like plko-plnty,

plnnr like plko-plnnr,

plnal like plko-plnal,

plnfl type plnfolge,

end of ty_plan.

constants: begin of c_log,

read type balognr value 'READ',

delete type balognr value 'DELETE',

create type balognr value 'CREATE',

end of c_log.

data: gt_plan type standard table of ty_plan.

data: gt_assignment type standard table of ty_assignment.

data: gt_return type bapiret2_t.

data: gs_return type bapiret2.

data: g_error type c.

field-symbols: <assign> like line of gt_assignment.

field-symbols: <plan> like line of gt_plan.

selection-screen begin of block exc with frame title text-exc.

parameters: p_path type localfile lower case modif id exc.

parameters: p_rows type i modif id exc.

selection-screen end of block exc.

selection-screen begin of block oth with frame title text-oth.

** parameters: p_delexi as checkbox. "delete exisiting assigment

parameters: p_test as checkbox.

select-options: s_matnr for mapl-matnr.

select-options: s_werks for mapl-werks.

select-options: s_plnnr for mapl-plnnr.

selection-screen end of block oth.

at selection-screen on value-request for p_path.

perform open_file_dialog changing p_path.

initialization.

start-of-selection.

refresh: gt_plan[], gt_assignment[], gt_return[].

perform check_entries.

check g_error is initial.

perform load_excel.

end-of-selection.

check g_error is initial.

perform display_log.

*&---------------------------------------------------------------------*

*& Form open_file_dialog

*&---------------------------------------------------------------------*

* text

*----------------------------------------------------------------------*

* -->P_PATH text

*----------------------------------------------------------------------*

form open_file_dialog changing p_path.

data: ft_filetable type filetable with header line.

data: f_rc type sy-subrc.

cl_gui_frontend_services=>file_open_dialog(

exporting

* window_title = window_title

default_extension = 'XLS'

* default_filename = default_filename

* file_filter = file_filter

* with_encoding = with_encoding

* initial_directory = initial_directory

multiselection = space

changing

file_table = ft_filetable[]

rc = f_rc

* user_action = user_action

* file_encoding = file_encoding

exceptions

file_open_dialog_failed = 1

cntl_error = 2

error_no_gui = 3

not_supported_by_gui = 4

others = 5

).

if sy-subrc eq 0.

read table ft_filetable index 1.

if sy-subrc eq 0.

p_path = ft_filetable.

endif.

endif.

endform. "open_file_dialog

*&---------------------------------------------------------------------*

*& Form check_entries

*&---------------------------------------------------------------------*

* text

*----------------------------------------------------------------------*

form check_entries.

clear g_error.

if p_path is initial .

message s001(00) with 'Fill path!' display like 'E'.

g_error = 'X'.

elseif p_rows lt 2.

message s001(00) with 'Last row number must be greater than 1!' display like 'E'.

g_error = 'X'.

endif.

endform. "check_entries

0 人点赞