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

Coding reqd for MIGO - BADI

Former Member
0 Likes
581

HI Friends,

Im working on MB_MIGO_BADI object for MType: 261.Here, im facing a problem to call a info msg with coding effect.i.e, I've to give a conditional message says that if the user tries to change the quantity (changing the existing/available in the field text of MIGO), then it'll give a window pop-up message or info msg like "Quantity should not be changed". Pls reply ur post how to fix this.

The fields are

1) cs_goitem-bwart " MType

2) cs_goitem-erfmg "Quantity

Note: A) It'll be applied only for MType:261.

B) Pls advise, Here, shall I declare the export and import memory id concept?

FYI

******Below is the coding part declared inside the method function.

method IF_EX_MB_MIGO_BADI~LINE_MODIFY.

if cs_goitem-bwart eq '261'.

*cs_goitem-erfmg is not initial and

*call function 'CUSTOMIZED_MESSAGE'

*exporting

Message i006(zmsg).

endif.

endmethod.

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

Above, it helps only showing the info msg while entering the mtype: 261.But i need to display it only if the cursor comes into Qty (ERFMG) field. Pls advise me how to fix with ur coding example.

mail me:sankar1781@gmail.com

3 REPLIES 3
Read only

Former Member
0 Likes
533

Hi,

You can get the change history from the tables CDHDR and CDPOS. Also you can use the function modules CHANGEDOCUMENT_READ_HEADERS and CHANGEDOCUMENT_READ_POSITIONS. Check if the last updated value in the quantity field is different from the new one (cs_goitem-erfmg). If any change is there, you can give the error message. Hope this helps.

Regards,

Renjith Michael.

Read only

0 Likes
533

Hi renjith,

thanks for ur prompt reply man,

Could u pls help me to post some sample code...if the field gets change,as ur criteria.

regards

sankar.

Read only

0 Likes
533

Hi,

One option is you may select Object class from table BDCP where field name = your quantity field and table name = your migo table.

then,

CALL FUNCTION 'CHANGEDOCUMENT_READ_HEADERS'

EXPORTING

  • ARCHIVE_HANDLE = 0

  • DATE_OF_CHANGE = '00000000'

objectclass = <the one which u got from the previous query>

  • OBJECTID = ' '

  • TIME_OF_CHANGE = '000000'

  • USERNAME = SY-UNAME

  • LOCAL_TIME = ' '

  • DATE_UNTIL = '99991231'

  • TIME_UNTIL = '235959'

  • NOPLUS_ASWILDCARD_INOBJID = ' '

TABLES

i_cdhdr = i_cdhdr[]

EXCEPTIONS

no_position_found = 1

wrong_access_to_archive = 2

time_zone_conversion_error = 3

OTHERS = 4

.

IF sy-subrc <> 0.

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

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

ENDIF.

*Read Change Positions for Credit Control

LOOP AT i_cdhdr.

CALL FUNCTION 'CHANGEDOCUMENT_READ_POSITIONS'

EXPORTING

  • ARCHIVE_HANDLE = 0

changenumber = i_cdhdr-changenr

  • TABLEKEY = ' '

  • TABLENAME = ' '

  • TABLEKEY254 = ' '

  • KEYGUID = ' '

  • IMPORTING

  • HEADER =

TABLES

editpos = it_editpos

  • EDITPOS_WITH_HEADER =

EXCEPTIONS

no_position_found = 1

wrong_access_to_archive = 2

OTHERS = 3

.

IF sy-subrc <> 0.

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

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

ENDIF.

APPEND LINES OF it_editpos TO it_editpos1.

ENDLOOP.

You can try the logic further. If no change history is found for the quantity field, then also you can assume that no change is made to it earlier and if it contains a new value then u can give the error message.

Pls reward if useful.

Regards,

Renjith Michael.