SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Messages | Сообщения



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Function Modules | Функциональные модули
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1639

PostPosted: Fri Sep 14, 2007 4:51 pm    Post subject: Messages | Сообщения Reply with quote

MESSAGE_PREPARE - Read T100 message and format message with parameters
Import: Language; Message Id, # and variables;
Export: formatted message text.

MESSAGE_TEXT_BUILD - Set up a message with parameter
Import: Message Id, # and variables;
Export: formatted message text.
Since 4.x can be replaced by: MESSAGE ... INTO f.
Code:

DATA: w_textout LIKE t100-text.
DATA: BEGIN OF it_error OCCURS 10,      " Protokoll
           EBELN LIKE EKKO-EBELN,
           TEXT LIKE w_textout,
           MSGTY LIKE SY-MSGTY,
           MSGID LIKE SY-MSGID,
           MSGNO LIKE SY-MSGNO.
DATA: END   OF it_error.
DATA: wa_error LIKE it_error.

* Call transaction to update customer instalment text
  CALL TRANSACTION 'ME22' USING bdc_tab MODE 'N' UPDATE 'S'
         MESSAGES INTO messtab.
* Check if update was succesful
  IF sy-subrc EQ 0.
    ADD 1 TO gd_update.
    APPEND wa_ekko TO it_success.
  ELSE.
*   Retrieve error messages displayed during BDC update
    LOOP AT messtab WHERE msgtyp = 'E'.
*     Builds actual message based on info returned from Call transaction
      CALL FUNCTION 'MESSAGE_TEXT_BUILD'
           EXPORTING
                msgid               = messtab-msgid
                msgnr               = messtab-msgnr
                msgv1               = messtab-msgv1
                msgv2               = messtab-msgv2
                msgv3               = messtab-msgv3
                msgv4               = messtab-msgv4
           IMPORTING
                message_text_output = w_textout.
    ENDLOOP.

*   Build error table ready for output
    wa_error = wa_ekko.
    wa_error-err_msg = w_textout.
    APPEND wa_error TO it_error.
    CLEAR: wa_error.
  ENDIF.


BAPI_MESSAGE_GETDETAIL - Read long text of error message
New in 4.5a.
Import: Message Id, #, variables and formats;
Export: formatted message text and long text.

MESSAGES_INITIALIZE - Delete messages collected up to now, collect future messages.

MESSAGES_ACTIVE - Information, whether the collection of messages is activated

MESSAGES_GIVE - Transfer collected messages into table

MESSAGES_STOP - End collection of messages, report importance of occured errors

Code:
 ...selektierte Lieferungen
DATA: BEGIN OF xlikpukwa OCCURS 1000.
INCLUDE STRUCTURE likpukwa.
DATA: END OF xlikpukwa.

DATA: BEGIN OF xmesg OCCURS 0.
INCLUDE STRUCTURE mesg.
DATA: END OF xmesg.

DATA: ident LIKE sy-uzeit, "Kennung MESSAGES_INITIAL,
count LIKE sy-msgno,
counter LIKE sy-tabix.

SELECT * FROM likpuk
WHERE vbeln = ivbeln AND
fkstk IN ('A', ' ') AND
wbstk EQ 'C'. "WA-Status = C
MOVE-CORRESPONDING likpuk TO xlikpukwa.
xlikpukwa-stdat = ibudat.
APPEND xlikpukwa.
ENDSELECT.

DESCRIBE TABLE xlikpukwa LINES counter.
IF ( counter IS INITIAL ).
_add_error 'S' 'VB' '610' '' '' '' ''.
EXIT.
ENDIF.

SET UPDATE TASK LOCAL.

*... Einsammeln der Nachrichten initialisieren und aktivieren
CALL FUNCTION 'MESSAGES_INITIALIZE'
EXPORTING
i_identification = ident
IMPORTING
e_identification = ident
EXCEPTIONS
OTHERS = 0.
IF ( sy-subrc NE 0 ).
_add_error sy-msgty sy-msgid sy-msgno
sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
EXIT.
ENDIF.

CALL FUNCTION 'MESSAGES_ACTIVE'
EXCEPTIONS
OTHERS = 1.
IF ( sy-subrc NE 0 ).
_add_error sy-msgty sy-msgid sy-msgno
sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
EXIT.
ENDIF.

READ TABLE xlikpukwa INDEX 1.
IF ( sy-subrc EQ 0 ).
count = count + 1.

*... Aufruf des FB 'WS_REVERSE_GOODS_ISSUE'
CALL FUNCTION 'WS_REVERSE_GOODS_ISSUE'
EXPORTING
i_vbeln = xlikpukwa-vbeln
i_budat = xlikpukwa-stdat
i_count = count
i_mblnr = xlikpukwa-mblnr
i_tcode = 'VL09'
i_vbtyp = xlikpukwa-vbtyp
TABLES
t_mesg = xmesg
EXCEPTIONS
error_reverse_goods_issue = 1
OTHERS = 2.
IF ( sy-subrc IS INITIAL ).
*--lфuft hier extern
COMMIT WORK AND WAIT.

GET PARAMETER ID 'MBN' FIELD emkpf-mat_doc.
GET PARAMETER ID 'MJA' FIELD emkpf-doc_year.
ELSE.
CALL FUNCTION 'MESSAGES_GIVE'
TABLES
t_mesg = xmesg.

*... Nachrichten sammeln stoppen
CALL FUNCTION 'MESSAGES_STOP'.

LOOP AT xmesg.
_add_error xmesg-msgty xmesg-arbgb xmesg-txtnr
xmesg-msgv1 xmesg-msgv2 xmesg-msgv3 xmesg-msgv4.
ENDLOOP.
ENDIF.

ENDIF.

CALL FUNCTION 'DEQUEUE_ALL'.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Function Modules | Функциональные модули All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.