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: 

Can i able to update Material Document After post.

former_member196331
Active Contributor
0 Kudos

HI,

I have one question.

I am posting Material document with movement type  201 . using Mb1a against to cost center.

In migo i have two custom fields, Now i would like to update that fields.

Can i able to update using any bapi or Function module Can any body faced this type of problem.

I have one doubt. After post the material document, there is no possibility to Open the same document and do the changes.

So, that's why i am thinking , If it possible please Update me.

19 REPLIES 19

former_member184569
Active Contributor
0 Kudos

Not all data of material document can be updated.

If its a field that can be changed via MB02, then you can try the FM MB_CHANGE_DOCUMENT.

0 Kudos

HI, thanks for your reply. In Mb02 ,  No custom fields are appearing.

michael_kozlowski
Active Contributor
0 Kudos

Check BAdI 'MB_MIGO_BADI' for this usecase.

0 Kudos

Dear Michael Kozlowski


How badi useful to me i am not able to understood.

I dont want to implement new screen. already we did.

But my task is now, I need to update two custom fields in material Document.


0 Kudos

Sorry - misunderstanding from my side.

I think there are two options:

1) reverse and re-post documents (the recommended approach)

2) direct update of customer fields with a small program (if you be able to keep  document relations consistent)

0 Kudos

hi,

Through the program means.Are u saying bapi.

0 Kudos

If you need to update custom fields in historical data only once you can do this with an UPDATE Statement for involved table in a loop like this:

SELECT SINGLE FOR UPDATE * FROM mkpf

  WHERE mblnr EQ '4711'

  AND   mjahr EQ '2015'.

IF sy-subrc EQ 0.

  mkpf-zzfield1 = 'XYZ'.

  mkpf-zzfield2 = '123'.

  UPDATE mkpf.

ENDIF.

0 Kudos

Ok..

Above method or directly se16n  GD-EDIT and GD-SAPEDIT .

0 Kudos

If not too many entries SE16N will work as well. Good luck!

karthikeyan_p3
Contributor
0 Kudos

Hi,

If your custom field is available either in MKPF or MSEG, you could use the Function Module MB_CHANGE_DOCUMENT. This FM is a update function Module, so validate your data before calling this FM.

Thanks,

Karthikeyan

0 Kudos

Ok, Thanks for your reply. I will check it.

0 Kudos

I Hope this is too risky, I need to pass all the fields to mkpf and mseg, If i miss any fields that fields are not updating previous values.

0 Kudos

As a rule, I won't suggest any update task function, as not only you have to code the full logic of SAP standard tools : checks but also update of other data (from logistics statistics to some sum tables)

Regards,

Raymond

0 Kudos

Only custom fields i need to update , i will not touch any things.

Any other options.

0 Kudos

Did you try to identify any implicit available enhancement to update (perform a where-used search on FM MB_POST_DOCUMENT)

Regards,

Raymond

0 Kudos

MB_post documnet means it will post the document.

raymond_giuseppi
Active Contributor
0 Kudos

If you developped fields on MIGO, why do you use MB1A, as the available BAdI (MB_DOCUMENT_BADI, MB_CHANGE_DOCUMENT and similar ones) provided much less options than for MIGO (e.g. MB_MIGO_BADI which allows change of data before posting) so you may be required to use some wild tools/tricks?

Regards,

Raymond

0 Kudos

First i would like to tell u  What is in my system. May be my explanation is  wrong.

We have screen exit at Mb1a with movement type 201 .At the time of posting Mb1a wtih movement type 201 . Then it will ask two fields names these values are coming from ztable.

this was created  exactly 01.05.2015  on words.  this is mandatory. so, after 01.05.2015  all the documents with  201  mvmt type is having the custom fields but 01.04.2015  to  01.05.2015   the document does not have the custom fields so, there is no data.

We develop a reports based  on custom fields . As per my company higher people desire.

Now i need to update that fields then only i can see the reports.

Now tell me how could i update that documents.

0 Kudos

Ok you aren't "posting Material document with movement type  201"  but have already "posted Material document with movement type  201", right ? remember that the basic rule for material movement is:


The Document Concept, you can no longer change a document once it has been posted. If you made a typing error when entering a goods movement (for example, when you entered the quantity), you must reverse the movement with a so-called reversal document (see section Cancelling a Material Document). 

Why Change a Material Document?

 

Although you cannot change a posted document, you can use the function "Change Material Document" to

  • enter additional information for the document.

But SAP only provided MB02, and AFAIK there is no extension there. If your fields are (SAP point of view) only external ZZ_information, you could use MB_CHANGE_DOCUMENT or even Open SQL statement in this case (look at source of MB_CHANGE_DOCUMENT...) But if you are using some tools as logistic statistics you should also consider calling MCB_STATISTICS_LIS or even trigger MB_DOCUMENT_BADI_SAP / MB_DOCUMENT_BADI too if your fields have any impact there. Try to execute MB02 to change some value executing an Abap trace (SAT/SE30) and analyze list of called FM.

Regards,

Raymond