Application Development 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: 

New field in MIGO not updated

maria_merino
Active Participant
0 Kudos

Hi experts,

I have a problem with MIGO tx.

I was told to add a new custom field to ítems in tab additional data. My new field ZTALLA is in table MSEG and also in GOITEM. I added to dynpro SAPLZMM_MIGO 9001 as "GO_ITEM-ZTALLA".

There are 2 more custom fields in this tab created before, this fields are non-editable and calculated. This fields are included in structure ZMMMIGO so I added my new field also.

I have an implementation for badi MB_MIGO_BADI.

MEthod PBO_DETAIL:

METHOD if_ex_mb_migo_badi~pbo_detail .
DATA: gf_class_id TYPE migo_class_id,
gt_extdat TYPE ty_t_extdata,
g_no_input TYPE xfeld,
g_line_id TYPE goitem-global_counter.
* Show screen only if there is an itemCHECK i_line_id <> 0.gf_class_id = 'MIGO_BADI_IMPLEMENTATION_CIN'.
e_cprog = 'ZMIGO1_PRG'.

e_cprog = 'SAPLZMM_MIGO'.

e_dynnr = '9001'.
e_heading = 'Datos adicionales'(004).

DATA ls_extdata TYPE zmmmigo.
*Show screen only if there is an itemCHECK i_line_id <> 0.

g_line_id = i_line_id.

* Read data

READ TABLE gt_extdata INTO ls_extdata WITH TABLE KEY line_id = i_line_id.

* Export data to function group (for display on subscreen)

CALL FUNCTION 'Z_MM_MIGO_EXTDATA_OUTPUT'EXPORTING
is_migo_badi_screen_fields = ls_extdata.

ENDMETHOD.

****************************

Method PAI_DETAIL:

method IF_EX_MB_MIGO_BADI~PAI_DETAIL .
* Only if a line exists

CHECK i_line_id <> 0.

E_FORCE_CHANGE = 'X'.
endmethod.

****************************

Method LINE_MODIFY:

METHOD if_ex_mb_migo_badi~line_modify .
DATA: flag(1) TYPE c.
IF NOT cs_goitem-mblnr IS INITIAL.
flag = 'X'.

ENDIF.

DATA: ls_extdata_old TYPE zmmmigo,
ls_extdata_new TYPE zmmmigo,
l_subrc TYPE sy-subrc.

* Get external data from internal table:

READ TABLE gt_extdata INTO ls_extdata_old WITH TABLE KEY line_id = i_line_id.
l_subrc = sy-subrc.
IF l_subrc <> 0.
SELECT SINGLE zz_campo zz_recompra FROM ekpo

INTO (ls_extdata_new-zz_campo,ls_extdata_new-zz_recompra)

WHERE ebeln = cs_goitem-ebelnAND ebelp = cs_goitem-ebelp.
ls_extdata_new-line_id = i_line_id.

INSERT ls_extdata_new INTO TABLE gt_extdata.

ELSE.

CALL FUNCTION 'Z_MM_MIGO_PUT_DETAIL'IMPORTING
is_migo_badi_screen_fields = ls_extdata_new.

MODIFY TABLE gt_extdata FROM ls_extdata_new.

ENDIF.
ENDMETHOD.

****************************

But my new field is not saved to MSEG.

Is there anything I'm missing?

Thanks in advance !!!

María

6 REPLIES 6

raymond_giuseppi
Active Contributor

Where did you change CS_GOITEM ZZ-fields in the LINE_MODIFY method?

(Also you could/should have managed the internal table to store your additional input data in the PAI_DETAIL method, so forcing change only when data actually changed)

Did you either

  • Append your customer fields (ZZ, YY) to structure IMSEG3 (Look at method goods_movement_fill in function group MIGO of your system )
  • Execute the MSEG update in an update FM triggered by method POST_DOCUMENT

    0 Kudos

    raymond.giuseppi , thanks a lot, this helped me today. Appending IMSEG3 also made appending other MSEG-structures obsolete, since it's included in most of them.

    maria_merino
    Active Participant
    0 Kudos

    Hi Raymond,

    I tried to do cs_goitem-zztalla = ls_extdata_new-ztalla

    but I get error MIGO050

    "BAdI: Field GOITEM-ZTALLA not ready to accept input (Change will not be adopted)"

    0 Kudos
    Did you solve the related error?