01-28-2011 8:25 AM
Dear Friends,
I am uploading PO long text in MM02 by using fm 'SAVE_TEXT in my program.
Its woking fine.
if i give invalid material no as input in HEADDATA also showing sy-subrc = 0.
pls suggest'
01-28-2011 3:03 PM
It writes the data to STXH and STXL if you dont validate this yourself first.
I assume you have already written data with to these tables.
If you someday create a material having this number, then the text appears like a phantom.
Find those records and delete them.
01-28-2011 8:44 AM
Hi,
SAVE_TEXT is not directly linked to a PO. The link is created via the header data that you pass. As such, no validations are done on the data since SAVE_TEXT can be used to save data for several different types of texts.
You options is to put an condition before calling SAVE_TEXT that checks for the material.
Select single *
from MAKT
where matnr = my_material_no.
if sy-subrc ne 0.
message e000(38) with 'Material does not exist'.
else.
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
header = v_header
tables
lines = it_lines
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
OBJECT = 4
OTHERS = 5
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endif.
01-28-2011 3:03 PM
It writes the data to STXH and STXL if you dont validate this yourself first.
I assume you have already written data with to these tables.
If you someday create a material having this number, then the text appears like a phantom.
Find those records and delete them.
01-29-2011 7:17 AM
Hi ,
As suggested by our friend dsouzajovito , we need to check first for material existence and then pass to the function module as it is no way related to material change.
Thanks,
Srikanth.A