‎2006 Sep 20 4:18 PM
Hi,
i try to use the above FM like this:
REPORT ZGRO_TEST.
*
DATA: HEADDATA LIKE BAPIMATHEAD.
*
DATA: RETURN LIKE BAPIRET2.
*
DATA: BEGIN OF RETURNM OCCURS 0.
INCLUDE STRUCTURE BAPIRET2.
DATA: END OF RETURNM.
*
DATA: BEGIN OF LTEXT OCCURS 0.
INCLUDE STRUCTURE BAPI_MLTX.
DATA: END OF LTEXT.
*
DATA: MATNR LIKE MARA-MATNR VALUE '000000000000000592'.
*
START-OF-SELECTION.
*
HEADDATA-MATERIAL = MATNR.
*
LTEXT-APPLOBJECT = 'MATERIAL'.
LTEXT-TEXT_NAME = MATNR.
LTEXT-TEXT_ID = 'PRUE'.
LTEXT-LANGU = SY-LANGU.
LTEXT-FORMAT_COL = '*'.
LTEXT-TEXT_LINE = 'first Inspection Text'.
APPEND LTEXT.
LTEXT-TEXT_LINE = 'second Inspection Text'.
APPEND LTEXT.
LTEXT-TEXT_LINE = 'third Inspection Text'.
APPEND LTEXT.
*
CALL FUNCTION 'BAPI_MATERIAL_SAVEDATA'
EXPORTING
HEADDATA = HEADDATA
IMPORTING
RETURN = RETURN
TABLES
MATERIALLONGTEXT = LTEXT
RETURNMESSAGES = RETURNM.
*
BREAK-POINT.
*
END-OF-SELECTION.
It works (i hope) OK.
But i get some return like this:
<b>RETURN</b>
The material 592 has been created or extended
<b>RETURNM with 4 entries</b>
Trying to create: 592 ____ ____ ____ __________ ____ __ ___ ___
The material cannot be maintained since no maintainable data transferred
Trying to change: 592 ____ ____ ____ __________ ____ __ ___ ___
Material 592 changed
Question:
Can i give the FM any Information for using it
in UPDATE-Mode or is my using in this case correct??
thanks for help
Regards, Dieter
‎2006 Sep 20 4:30 PM
Hi
If you need to create a new text you can use fm SAVE_TEXT.
I believe that BAPI can't insert only a text but at least one field should be changed: it seems the BAPI has tried to open the material for new (no) plant.
Max
‎2006 Sep 24 4:08 PM
Hello Dieter
The documentation of the parameter MATERIALLONGTEXT says:
Note
Different long texts (basic data texts, purchase order texts, internal
comments, sales texts, material memos) can be created for a material.
This requires the fields APPLOBJECT, TEXT_NAME, TEXT_ID, and LANGU or
LANGU_ISO in table parameter MATERIALLONGTEXT to contain entries.
Depending on the content of field TEXT_ID, the field TEXT_NAME must have
the following structure:
The material number is transferred first. If it has fewer than 18
characters, the remaining characters must be filled with blanks. If it
is a material memo (LTXT), the plant key must also be transferred from
character 19 onwards; in the case of a sales text (0001), this must be
the sales organization and distribution channel. The combinations
allowed for the four different fields are indicated in the following table:
Thus, I guess the problem might be the leading '0'. You should try to write the material number just as '592'.
Regards
Uwe