‎2006 Nov 18 4:12 AM
Hi,
How to make changes to the Po text of a Material which we can see in the MM02 transaction in the Purchase order text view.
Does the BAPI_MATERIAL_SAVEDATA work??
If so, Any clues to start with??
Shekar.
‎2006 Nov 18 5:06 AM
Hi,
Check this code...THis works fine for me..
DATA: text LIKE bapi_mltx OCCURS 0 WITH HEADER LINE.
DATA: header LIKE bapimathead.
DATA: t_return LIKE bapi_matreturn2 OCCURS 0 WITH HEADER LINE.
PARAMETERS: p_matnr TYPE matnr.
Header.
header-material = p_matnr.
header-purchase_view = 'X'.
Text
text-applobject = 'MATERIAL'.
text-text_name = p_matnr.
text-text_id = 'BEST'.
text-langu = sy-langu.
text-text_line = 'PO TEXT FROM BAPI'.
APPEND text.
Call BAPI.
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
EXPORTING
headdata = header
TABLES
materiallongtext = text
returnmessages = t_return.
COMMIT WORK.
Thanks,
Naren
‎2006 Nov 18 5:06 AM
Hi,
Check this code...THis works fine for me..
DATA: text LIKE bapi_mltx OCCURS 0 WITH HEADER LINE.
DATA: header LIKE bapimathead.
DATA: t_return LIKE bapi_matreturn2 OCCURS 0 WITH HEADER LINE.
PARAMETERS: p_matnr TYPE matnr.
Header.
header-material = p_matnr.
header-purchase_view = 'X'.
Text
text-applobject = 'MATERIAL'.
text-text_name = p_matnr.
text-text_id = 'BEST'.
text-langu = sy-langu.
text-text_line = 'PO TEXT FROM BAPI'.
APPEND text.
Call BAPI.
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
EXPORTING
headdata = header
TABLES
materiallongtext = text
returnmessages = t_return.
COMMIT WORK.
Thanks,
Naren
‎2006 Nov 18 7:29 PM
Hi Naren!
This code seams to be working.
But the problem is when I am trying to execute the code in a loop for more than one material, it is updating juss one starting record of ITAB.
COuld you please help me like what could be the problem.
Actually Iam changing the Material description also for the same material along with the PO text.
When I try to update juss the Material description, it does work for all fields.
The problem is only when I try to do the change of PO text along with the Material description.
ANyways here is the code for your reference.
Data: ls_headdata like bapimathead ,
lt_makt like bapi_makt occurs 0 with header line ,
ls_return like bapiret2.
DATA: ls_text LIKE bapi_mltx OCCURS 0 WITH HEADER LINE.
DATA: ls_t_return LIKE bapi_matreturn2 OCCURS 0 WITH HEADER LINE.
Loop at I_Itab.
ls_headdata-purchase_view = 'X'.
Text
ls_text-applobject = 'MATERIAL'.
ls_text-text_name = I_ITab-matnr.
ls_text-text_id = 'BEST'.
ls_text-langu = 'EN'.
ls_text-text_line = 'FROM BAPImmmmm'.
append ls_text.
ls_headdata-material = I_Itab-matnr .
lt_makt-langu = 'EN'.
lt_makt-matl_desc = 'vvvvvv'.
append lt_makt.
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
EXPORTING
HEADDATA = ls_headdata
IMPORTING
RETURN = ls_return
TABLES
MATERIALDESCRIPTION = lt_makt
MATERIALLONGTEXT = ls_text
RETURNMESSAGES = ls_t_return
.
COMMIT WORK.
:::::::::OUTPUT:::::::
1. SMM-- success message the material 300000 has been created or extended.
2.EMM-- error message the field MATNR has been transfered inconsistently or is blank.
But I am sure it is not blank.
I think the loop is terminating for one record.
Please help me out!!!!!!!!!
Thank you,
Shekar.
‎2006 Nov 18 8:18 PM
‎2006 Nov 18 5:36 AM
Hi,
use edit_text function module
save_text
see tables stxh,stxl.
Regards
amole
‎2006 Nov 21 5:31 PM