CLASS lcl_mass_change_view_mm IMPLEMENTATION.
METHOD transport_to_model.
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""$"$:(1) Klasse LCL_MASS_CHANGE_VIEW_MM, Methode TRANSPORT_TO_MODEL, Anfang A
*$*$-Start: (1)---------------------------------------------------------------------------------$*$*
ENHANCEMENT 1 <your enhancement name>. "active version
* M.Hapke; 02-11-2018 ; process customer field :
DATA: zl_item TYPE REF TO cl_po_item_handle_mm,
zl_header TYPE REF TO cl_po_header_handle_mm,
zl_item_data TYPEmepoitem,
zl_item_datax TYPEmepoitemx,
zl_item_data_temp TYPE mepoitem.
DATA: zls_modelLIKE LINE OF my_value_models,
za_value_model TYPE REF TO cl_value_model_mm,
za_clear_model TYPE REF TO cl_value_model_mm,
zl_datatype TYPEstring40,
zl_feld TYPE string40.
DATA: zl_dynpro_fieldLIKE LINE OF my_dynpro_fields,
zl_fieldselection LIKE LINE OF my_fieldselection,
zl_field_status TYPE char1,
zl_clear_items TYPEmegui_range-clear_items.
DATA ld_go_on value ' ' .
* Test if customer field is selected:
LOOP AT my_value_models INTOzls_model.
mmpur_dynamic_cast za_value_model zls_model-model.
CHECK NOT za_value_model IS INITIAL.
CALL METHOD za_value_model->get_datatype
IMPORTING
ex_datatype = zl_datatype.
if zl_datatype eq 'MEGUI_MASSCH_ALLOWED_FIELDS-<put your fieldname here>'. "
ld_go_on = 'X' .
exit.
endif.
ENDLOOP.
* prerequesite retrieved
clear: zls_model, za_value_model, zl_datatype.
if ld_go_on eq 'X' .
FIELD-SYMBOLS: <zsrc> TYPE ANY,
<zdst> TYPE ANY,
<zdstx> TYPE ANY.
CHECK NOT im_model IS INITIAL.
zl_item ?= im_model.
zl_header ?= zl_item->my_parent.
CALL METHOD fs_get( im_model= im_model ).
CALL METHOD zl_item->get_data
IMPORTING
ex_data = zl_item_data.
CALL METHOD zl_item->get_datax
IMPORTING
ex_data = zl_item_datax.
LOOP AT my_value_models INTOzls_model.
mmpur_dynamic_cast za_value_model zls_model-model.
CHECK NOT za_value_model IS INITIAL.
CALL METHOD za_value_model->get_datatype
IMPORTING
ex_datatype = zl_datatype.
SHIFT zl_datatype UP TO'-'.
SHIFT zl_datatype LEFT BY 1 PLACES.
READ TABLE my_dynpro_fields INTO zl_dynpro_field
WITH KEY fieldname = zl_datatype.
CHECK sy-subrc IS INITIAL.
READ TABLE my_fieldselection INTO zl_fieldselection
WITH KEY metafield = zl_dynpro_field-metafield.
IF sy-subrc IS INITIAL.
zl_field_status = zl_fieldselection-fieldstatus.
ELSE.
zl_field_status = default_field_status.
ENDIF.
* BEGIN deviation towards standard ; if your customer field is mass-changed:
FIELD-SYMBOLS <z_modify> type bapiupdate.
if zl_datatype eq '<put your fieldname here>'.
zl_field_status = '.' .
ASSIGN COMPONENT '<put your fieldname here>' of STRUCTURE zl_item_datax to <z_modify> .
if <z_modify> is ASSIGNED.
<z_modify> = 'X'.
endif.
endif.
* End of deviation towards standard
IF zl_field_status EQ '.' OR
zl_field_status EQ '+'.
ASSIGN COMPONENT zl_datatype OF STRUCTURE zl_item_data TO <zdst>.
CHECK sy-subrc EQ 0.
ASSIGN COMPONENT zl_datatype OF STRUCTURE zl_item_datax
TO <zdstx>.
CHECK sy-subrcEQ 0.
ASSIGN COMPONENT zl_datatype OF STRUCTURE zl_item_data_temp
TO <zsrc>.
CHECK sy-subrcEQ 0.
CALL METHOD za_value_model->get_value
IMPORTING
ex_value = <zsrc>.
mmpur_dynamic_cast za_clear_model zls_model-clear.
CHECK NOT za_clear_model IS INITIAL.
CALL METHOD za_clear_model->get_value
IMPORTING
ex_value = zl_clear_items.
IF zl_clear_items EQ mmpur_yes OR
NOT <zsrc> IS INITIAL.
<zdst> = <zsrc>.
<zdstx> = mmpur_yes.
ENDIF.
ENDIF.
ENDLOOP.
zl_item_data-ebeln = zl_header->po_number.
zl_item_data-id = zl_item->id.
CALL METHOD zl_item->set_data
EXPORTING
im_data = zl_item_data.
CALL METHOD zl_item->set_datax
EXPORTING
im_data = zl_item_datax.
Exit. " next block isn't processed
ELSE.
ENDIF.
** from here standard again:
ENDENHANCEMENT.
*$*$-End: (1)---------------------------------------------------------------------------------$*$*
DATA: l_item TYPE REF TO cl_po_item_handle_mm,
l_header TYPE REF TO cl_po_header_handle_mm,
l_item_data TYPE mepoitem,
l_item_datax TYPE mepoitemx,
l_item_data_temp TYPE mepoitem.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
5 | |
5 | |
3 | |
2 | |
2 | |
2 | |
2 | |
2 | |
2 | |
2 |