06-17-2011 9:38 PM
Hi Friends,
If I go to MFBF transaction:
Key in the required fields like Backflush qty, Unit of measure, posting date, document date, material, plant and production version and click on "save" button, I get a message in my status bar as "GR and GI with document 123456789 and activities posted".
I copied the BAPI_REPMANCONF1_CREATE_MTS to Z FM.
How can I capture this messages in Z FM of my return parameter of bapiret2.
I have done this in my source code of Z FM:
IF RETURN-ID = 'RM' AND RETURN-NUMBER = '191'.
CONCATENATE 'GR and GI with document ' MAT_DOC ' and activities posted' INTO GV_MESSAGE.
RETURN-MESSAGE = GV_MESSAGE.
ENDIF.
When I debug - I don't see any values in my BAPIRET2. So, it is not going thru my if condition.
Am I doing anything wrong in my code? Please suggest.
Thanks.
06-17-2011 11:21 PM
Hi Nani,
use ABAP MESSAGE statement with addition INTO, i.e.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 INTO lv_dummy.
Then call a form to append it to Return table
*&---------------------------------------------------------------------*
*& Form log_symsg
*&---------------------------------------------------------------------*
* append message from system fields to aplication log
*----------------------------------------------------------------------*
form log_symsg.
data:
ls_balmsg type bal_s_msg.
ls_balmsg-msgid = sy-msgid.
ls_balmsg-msgno = sy-msgno.
ls_balmsg-msgty = sy-msgty.
ls_balmsg-msgv1 = sy-msgv1.
ls_balmsg-msgv2 = sy-msgv2.
ls_balmsg-msgv3 = sy-msgv3.
ls_balmsg-msgv4 = sy-msgv4.
endform.
This is similar but fits structure bal_s_msg used for application logs.
Please change according to BAPIRETURN needs.
Regards,
Clemens
06-18-2011 7:23 PM
Hi Clemens,
Thank you for your valuable answer. I have understood what you said.
But, In what way I need to differentiate the message dispaly. Because in MFBF transaction, there will be two SAVE buttons.
One SAVE is "Post" button and the other SAVE is "Post with correction".
If I press SAVE button for posting the finished goods it gives me "GR and GI with document 123456789 posted with activities".
If I press SAVE button for posting with correction it gives me different message "GR and partial GI with document 345678921 posted with activities".
Based on what, I need to differentiate this messages. And how should I populate this into my RETURN parameter.
If I go to the system --> status and program of MFBF transaction, there is no function key associated for the first SAVE i.e., "POST" button.This is where I got confused.
Please suggest me good ideas.
Thanks in Advance.
06-18-2011 8:16 PM
Hi Nani,
I do not fully understand what you are doing.
Now you talk about MFBF transaction, before you said you copied BAPI_REPMANCONF1_CREATE_MTS to a z function module.
If you copied correctly and fully, the Z function should behave the same way as the BAPi did.
A BAPI is usually not triggered by a transaction.
If you want to differentiate depending on the success message, you can do so according to message tyoe and message number as seen in SY-MSGID and SY-MSGNO.
Please explain what you did and what you want, show relevant part of your code.
The documentation says that BAPI_REPMANCONF1_CREATE_MTS does Execute Backflush in Stock Scenario and that paramete rRETURN will return of an error code when the backflush could not be carried out successfully. If the backflush was carried out successfully, the exporting parameter RETURN is filled with initial values.
Make sure that a COMMIT WORK is created directly after accessing this BAPI. This means that it is not possible to use several BAPIs which record data on the database in sequence and then to create only one COMMIT WORK after the last BAPI. Should this happen, however, the second BAPI will be terminated as such a chain of accesses is not supported by the program.
Regards,
Clemens
Regards,
Clemens
06-18-2011 9:15 PM
Hi Clemens,
Here is what I am doing.
I have created a custom remote-enabled function module which simulates the MFBF transaction.
MFBF testing:
There will be two SAVE buttons. One SAVE is "Post" button and the other SAVE is "Post with correction".
Make to stock scenario - Assembly backflush
If I give the required fields such as backflush quantity, unit of measure, posting date, document date, document header text, material number(which has inventory), plant and production version and when I press SAVE button for posting the finished goods it gives me "GR and GI with document 123456789 posted with activities".
If I key in the same fields with different material number (which do not have inventory) and when I press SAVE button for posting with correction it gives me different message "GR and partial GI with document 345678921 posted with activities".
Z FM testing:
When I test my FM,
As you said, parameter RETURN will return of an error code when the backflush could not be carried out successfully. If the backflush was carried out successfully, the exporting parameter RETURN is filled with initial values.
When I key in the import parameters of the FM for the material which has inventory, the back flush is carried out sucessfully and my return parameter is set to initial values giving me the confirmation number.
Now my requirement is - My return parameters should explain to the user saying that "GR and GI with document 123456789 posted with activities". That means my FM should understand whether the document is posted or posted with correction? How can I make my FM do this?
I would appreciate if you could help me in achieving this.
Thanks.
06-20-2011 6:50 AM
Hi Nani;
I have been using your bapi's since 2 months. Sometimes I am checking "Did BAPI really created material docs?" via my cross-check program. It's running very healthy.
It has two cases for your question.
1. It fill export-RETURN only if It has some problem. export->CONFIRMATION is blank for this case.
2. It fill export->CONFIRMATION only if It hasn't problem, process finished success. export-RETURN is blank for this case.
Best regards.
06-20-2011 7:16 AM
Hi Melih,
Thanks for the response. I totally agree with you.
But, is there any way that I can capture the sucess messages as I specified in my thread above?
I mean the "GR and GI document 123456789 posted with activities" or "GR and partial GI with activities posted" into my return parameter. If yes, how can I do that?
Thanks.
06-20-2011 7:36 AM
Hi Nani;
We got/removed authority for "partial" scenario from all user. We use only "full correct" scenario. So I dont know How is It giving message at "partial" scenario.
Best regards.
06-20-2011 3:35 PM
Can somebody suggest me any other ideas in achieving this?
Thanks.
06-21-2011 9:32 PM
H nani,
BAPI_REPMANCONF1_CREATE_MTS has tables parameter goodsmovements. Check what is in there or if itz is initial.
Regards,
Clemens
06-21-2011 10:14 PM
Hi Clemens,
I checked the tables parameter goodsmovements in debug mode. It is filled with initial values.
12-24-2014 10:17 AM
Hi Nani ,
Did you find any solution for Success messages !!!
for above mentioned BAPI , if yes can you help me with your solution....
Thanks