‎2009 May 20 7:44 AM
hi all,
i made a program for updatin some entry in MARA table and its updating successfully but problem is that after updating it is not showing the message whatever i gave. so can anyone please help me?
Codes :
REPORT zupdate_mara.
TABLES mara.
DATA : BEGIN OF itab3 OCCURS 0,
matnr LIKE mara-matnr,
mstae LIKE mara-mstae,
mstav LIKE mara-mstav,
mstdv LIKE mara-mstdv,
END OF itab3.
SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS : matnr FOR mara-matnr NO INTERVALS. " no-extension.
SELECTION-SCREEN : SKIP 2.
SELECTION-SCREEN : PUSHBUTTON 2(10) a1 USER-COMMAND unblock,
PUSHBUTTON 35(10) a2 USER-COMMAND block.
SELECTION-SCREEN : END OF BLOCK b1.
AT SELECTION-SCREEN.
CASE sy-ucomm.
WHEN 'UNBLOCK'.
LOOP AT matnr.
SELECT SINGLE matnr mstae mstav mstdv FROM mara INTO itab3 WHERE matnr = matnr-low.
IF itab3-mstae NE '' OR itab3-mstav NE '' OR itab3-mstdv NE ''.
UPDATE mara SET mstae = '' mstav = '' mstdv = ''
WHERE matnr = itab3-matnr.
WRITE : / itab3-matnr , 'UPDATED IN MATERIAL NO.' COLOR 7 .
ELSE.
WRITE : / itab3-matnr , 'ALREADY UPDATED IN MATERIAL NO.' COLOR 5.
ENDIF.
ENDLOOP.
WHEN 'BLOCK'.
LOOP AT matnr.
itab3-matnr = matnr-low.
itab3-mstae = '04'.
itab3-mstav = '03'.
itab3-mstdv = sy-datum.
UPDATE mara SET mstae = itab3-mstae mstav = itab3-mstav mstdv = itab3-mstdv
WHERE matnr = itab3-matnr.
WRITE : / itab3-matnr , 'UPDATED IN MATERIAL NO.' COLOR 7 .
CLEAR : itab3.
ENDLOOP.
ENDCASE.
INITIALIZATION.
a1 = 'UNBLOCK'.
a2 = 'BLOCK'.
Regards saurabh.
‎2009 May 20 7:56 AM
Hi Saurabh
I would suggest you to rather use MESSAGE statement in place of WRITE.
As far as i know, for displaying messages we prefer MESSAGE rather than WRITE as they are much more meaningfull.
Regards
Gaurav
‎2009 May 20 7:56 AM
Hi Saurabh
I would suggest you to rather use MESSAGE statement in place of WRITE.
As far as i know, for displaying messages we prefer MESSAGE rather than WRITE as they are much more meaningfull.
Regards
Gaurav
‎2009 May 20 8:42 AM
hi all thanx for reply,
actually when im writing message statement then for multiple records its repeating while i need only one time after final updation.
regards...
‎2009 May 20 8:04 AM
Hi,
If you want push button only please use message statement instead of write statement. But for the multiple records it ill gets this message multiple times.
or
In At Selection screen you are updating the table that is not correct, what your performing there that ill not come as the output of the report.
Instead of these i suggest that Please added two radio buttons one for block and another unblock and write the update logic in start-of selection by catching the radio button which checked . Once after program exe you will get the updated details,
‎2009 May 20 8:06 AM
Check whether the UPDATE is happening successfully or not.
After UPDATE check sy-subrc.
‎2009 May 20 8:14 AM
Hello,
I would too suggest to use message instead of write statement.
But if your requirement is to use write strictly then try this. Give the event end-of-selection in the report.
Hope this helps you.
Regards,
Sachinkumar Mehta.
Edited by: Sachinkumar Mehta on May 20, 2009 9:15 AM
‎2009 May 20 8:21 AM
U can use msg class and enter the message to be displayed.
create message class using tcode : SE91.
or using wirte statement if you want tto dispaly message means after updating please check for sy-subrc and if its eq 0. then write message.
u have written the code in at selection screen please write the ,
select statement , loop at statment, update statement and write statement which u want to display in start fo selection event.
Regards,
Sathish
Edited by: Sathishkumarpanner on May 20, 2009 9:22 AM
‎2009 May 20 9:27 AM
Hi Saurabh,
SAP has given some standard user friendly messages which makes the user easy to understand whats going on in that program
http://help.sap.com/saphelp_nw70/helpdata/en/cd/5892c9b06311d2957b00a0c94260a5/content.htm
Instead of the WRITE statement , use Information type message when the updation in MARA is a success or not , use Error message if the user does a mistake while entering,.
Thats all,
Revert for any other clarification.
Thanks and Regards
Srikanth.P
‎2009 May 20 9:35 AM
Hi Saurabh,
After the update statement, check value of sy-subrc. If its 0 (zero) show the information message with message statement.
message statement will have the syntsax like, MESSAGE i000(zv) WITH 'Record Successfully Updated!'(i03)
where ZV is message class.
Hope this will help you.
Best Regards,
Deepa Kulkarni