08-29-2008 8:52 AM
Hi,
can anybody explain me, how to fill the fuba BAPI_MATERIAL_SAVEDATA, if I wan to delete the existing longtext.
Is MATERIALLONGTEXT-DEL_FLAG the right way?
I tried it with
MATERIALLONGTEXT-APPLOBJECT = MATERIAL
MATERIALLONGTEXT-TEXT_NAME = 96312103
MATERIALLONGTEXT-TEXT_ID = GRUN
MATERIALLONGTEXT-LANGU = DE
MATERIALLONGTEXT-FORMAT_COL = /
MATERIALLONGTEXT-TEXT_LINE
MATERIALLONGTEXT-DEL_FLAG = 'X'
If I insert a text inside MATERIALLONGTEXT-TEXT_LINE without the del_flag the system works correct and change the datas.
Regards
Nicole
08-29-2008 9:01 AM
MATERIALLONGTEXT-TEXT_NAME = 96312103
Text name = 'Material number with 18chars'
check that once.
If you still having the problem Post your code once.
08-29-2008 8:59 AM
hii
yes for deleting long text it is needed to set MATERIALLONGTEXT-DEL_FLAG = 'X'.
regards
twinkal
08-29-2008 9:01 AM
MATERIALLONGTEXT-TEXT_NAME = 96312103
Text name = 'Material number with 18chars'
check that once.
If you still having the problem Post your code once.
08-29-2008 9:16 AM
Hi,
the relevant coding is
&----
*& Form change text
&----
FORM text_aendern.
data: ltext LIKE bapi_mltx OCCURS 0 WITH HEADER LINE,
lhead like BAPIMATHEAD,
dreturn like BAPIRET2.
clear ltext[].
loop at xtxt.
move: xtxt-tdformat to ltext-FORMAT_COL, "xtxt-tdformat = /
xtxt-tdline to ltext-TEXT_LINE. "xtxt-tdline = INITIAL
ltext-APPLOBJECT = pa_objec. "Pa_objec = MATERIAL
ltext-TEXT_NAME = dmatnr. "dmatnr = 96312103
ltext-TEXT_ID = pa_id. "pa_id = GRUN
ltext-LANGU = xeing-spras. "ltext-langu = DE
ltext-del_flag = 'X'.
append ltext.
endloop.
lhead-material = dmatnr. "dmatnr = 96312103
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
EXPORTING
HEADDATA = lhead
IMPORTING
RETURN = dreturn
TABLES
MATERIALLONGTEXT = ltext.
clear xtxt_read.
if dreturn ne space.
if dreturn-type eq 'E' or dreturn-type eq 'W'.
move: ltext-TEXT_NAME to imail-matnr,
ltext-LANGU to imail-spras,
dreturn-message to imail-text.
append imail.
endif.
endif.
eNDFORM. " text_aendern
08-29-2008 9:35 AM
Fine tuned and Corrected code ....
REPORT ztest_material_text.
DATA: head TYPE bapimathead.
DATA: return TYPE bapiret2.
DATA: text TYPE TABLE OF bapi_mltx WITH HEADER LINE.
head-material = '000000000000000084'.
head-basic_view = 'X'. "<----This is missing
text-text_id = 'GRUN'.
text-applobject = 'MATERIAL'.
text-langu = sy-langu.
text-text_name = head-material.
text-del_flag = 'X'.
APPEND text.
"when you are deleting the text no need to pass the text
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
EXPORTING
headdata = head
IMPORTING
return = return
TABLES
materiallongtext = text.
IF return-type NE 'E'.
"This is also must. Explicit commit required.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
ENDIF.
08-29-2008 9:02 AM