‎2006 Jun 19 5:25 AM
I try using FM MATERIAL_MAINTAIN_DARK to modify the material description. see the code follow.
SY-SUBRC = 0, but it does not work. also some message in itab TAMERRDATL: E |161 |ABCDFGLPQS
I debug the program, and found there are something wrong when call the FM: MATERIAL_UPDATE_ALL.
Need help, and Thank you.
========
code:
REPORT Z_TEST .
data: tmara_ueb like mara_ueb occurs 100 with header line.
data: tmakt_ueb like makt_ueb occurs 100 with header line.
data: tamerrdat like merrdat occurs 100 with header line.
DATA: h_anzfehler LIKE tbist-numerror.
DATA: h_tranc TYPE transcount.
start-of-selection.
h_tranc = 1.
tmara_ueb-mandt = '350'.
tmara_ueb-matnr = '000000000001003380'.
tmara_ueb-tcode = 'MM02'.
tmara_ueb-tranc = h_tranc.
append tmara_ueb.
tmakt_ueb-mandt = '350'.
tmakt_ueb-matnr = '000000000001003380'.
tmakt_ueb-spras = '1'.
tmakt_ueb-maktx = 'test MATERIAL_MAINTAIN_DARK'.
tmakt_ueb-tranc = h_tranc.
append tmakt_ueb.
clear: tmara_ueb, tmakt_ueb, h_anzfehler.
DATA flag_bapi_call LIKE t130f-kzref.
FLAG_BAPI_CALL = 'X'.
CALL FUNCTION 'MATERIAL_MAINTAIN_DARK'
EXPORTING
FLAG_MUSS_PRUEFEN = 'X'
SPERRMODUS = 'E'
MAX_ERRORS = 0
P_KZ_NO_WARN = 'N'
KZ_PRF = 'E'
KZ_VERW = 'X'
KZ_AEND = 'X'
KZ_DISPO = 'N'
KZ_TEST = ' '
NO_DATABASE_UPDATE = ' '
CALL_MODE = ' '
CALL_MODE2 = ' '
USER = SY-UNAME
SUPPRESS_ARRAY_READ = ' '
FLG_MASS = ' '
IMPORTING
MATNR_LAST =
NUMBER_ERRORS_TRANSACTION = h_anzfehler
TABLES
AMARA_UEB = TMARA_UEB
AMAKT_UEB = TMAKT_UEB
AMARC_UEB =
AMARD_UEB =
AMFHM_UEB =
AMARM_UEB =
AMEA1_UEB =
AMBEW_UEB =
ASTEU_UEB =
ASTMM_UEB =
AMLGN_UEB =
AMLGT_UEB =
AMPGD_UEB =
AMPOP_UEB =
AMVEG_UEB =
AMVEU_UEB =
AMVKE_UEB =
ALTX1_UEB =
AMPRW_UEB =
AE1CUCFG_UEB =
AE1CUINS_UEB =
AE1CUVAL_UEB =
AE1CUCOM_UEB =
AMFIELDRES =
AMERRDAT = TAMERRDAT
EXCEPTIONS
KSTATUS_EMPTY = 1
TKSTATUS_EMPTY = 2
T130M_ERROR = 3
INTERNAL_ERROR = 4
TOO_MANY_ERRORS = 5
UPDATE_ERROR = 6
OTHERS = 7
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
IF SY-SUBRC NE 0.
ROLLBACK WORK.
ELSE.
COMMIT WORK.
CALL FUNCTION 'DEQUEUE_ALL'.
ENDIF.
‎2006 Jun 19 5:52 AM
Hi Jerry,
I think FM - MATERIAL_MAINTAIN_DARK is not released, so should not be used. (It is used inside std Material master program.)
Use function module :BAPI_MATERIAL_SAVEDATA.
Pass parameters: Material, Industry sector, Matl_type, BASIC_VIEW of structue <b>HEADDATA</b> of this function module.
Pass values: Langu , Matl_desc in structure <b>MATERIALSDESCRIPTION</b> of this FM.
It will change the material description as you required.
Hope this helps.
Regards,
Akshay Bhagwat
Note: Some points would be nice if it helps:)
Message was edited by: Akshay Bhagwat
‎2006 Jun 19 5:52 AM
Hi Jerry,
I think FM - MATERIAL_MAINTAIN_DARK is not released, so should not be used. (It is used inside std Material master program.)
Use function module :BAPI_MATERIAL_SAVEDATA.
Pass parameters: Material, Industry sector, Matl_type, BASIC_VIEW of structue <b>HEADDATA</b> of this function module.
Pass values: Langu , Matl_desc in structure <b>MATERIALSDESCRIPTION</b> of this FM.
It will change the material description as you required.
Hope this helps.
Regards,
Akshay Bhagwat
Note: Some points would be nice if it helps:)
Message was edited by: Akshay Bhagwat
‎2006 Jun 19 5:59 AM
Hi,
tmakt_ueb-mandt = sy-mandt.
tmakt_ueb-matnr = '000000000001003380'.
tmakt_ueb-spras = sy-langu.
tmakt_ueb-maktx = 'test MATERIAL_MAINTAIN_DARK'.
tmakt_ueb-tranc = h_tranc.
This will work.
Regards
Elini.P
‎2006 Jun 19 7:56 AM
It's intersting.
when change material description
it seems that tmara_ueb-VPSTA must maintain.
can somebody explain?
ps. Actually, BAPI_MATERIAL_SAVEDATA also use MATERIAL_MAINTAIN_DARK. When maintain structue HEADDATA, VPSTA is to be maintained indirectly.
Message was edited by: Jerry Chan