03-18-2009 7:18 AM
Hi,
I have one work area lwa_messtab whose fild values are as below.
Field name Field value
Tcode CJ02
DYNAME SAPLKACB
DYNUMB 0002
MSGTYP E
MSGSPRA E
MSGID KM
MSGNR 183
MSGV1 31730100
MSGV2 8001
MSGV3
MSGV4
ENV CTU
FLDNAME COBL-PRCTR
Catch Error Message in Record
SELECT SINGLE text FROM t100 INTO lwa_report-message
WHERE sprsl = sy-langu
AND arbgb = lwa_messtab-msgid
AND msgnr = lwa_messtab-msgnr.
Now, lwa_report-message = "No postings can be made to profit center &1 in company code &2"
I want to put &1 place MSGV1 = 31730100 and &2 place MSGV2 = 8001.
The output should be as below
No postings can be made to profit center 31730100 in company code 8001
Regards,
Deepthi.
03-18-2009 7:24 AM
Use
lwa_report-message = 'No postings can be made to profit center &1 in company code &2'
replace '&1' with lwa_messtab-msgv1 into lwa_report-message.
replace '&2' with lwa_messtab-msgv2 into lwa_report-message.
03-18-2009 7:21 AM
Hi,
Try with REPLACE or FIND statement.
REPLACE '1&' IN lwa_report-message WITH lwa_messtab-msgv1.
REPLACE '2&' IN lwa_report-message WITH lwa_messtab-msgv2.
Regards
Bala Krishna
Edited by: Bala Krishna on Mar 18, 2009 12:55 PM
03-18-2009 7:24 AM
try to use concatenate statment
CONCATENATE '''' '123' '''' INTO W_FIELD
03-18-2009 7:24 AM
Use
lwa_report-message = 'No postings can be made to profit center &1 in company code &2'
replace '&1' with lwa_messtab-msgv1 into lwa_report-message.
replace '&2' with lwa_messtab-msgv2 into lwa_report-message.
03-18-2009 7:38 AM
Hi,
U can do something like this
DATA : temp TYPE string.
concatenate 'No postings can be made to profit center' lwa_messtab-MSGV1 'in company code ' lwa_messtab-MSGV2 INTO temp.
lwa_report-message = temp.
message lwa_report-message type 'E'.
Hope it will solve your problem..
Thanks & Regards
ilesh 24x7
ilesh Nandaniya
03-18-2009 7:41 AM
Hi Deepthi,
Just try with the FM given below if it help's to met your requirement:
loop at t_messtab into fs_messtab.
call function 'FORMAT_MESSAGE'
exporting
id = fs_messtab-msgid
lang = sy-langu
no = fs_messtab-msgnr
v1 = fs_messtab-msgv1
v2 = fs_messtab-msgv2
v3 = fs_messtab-msgv3
v4 = fs_messtab-msgv4
importing
msg = lw_string
exceptions
not_found = 1
others = 2.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
With luck,
Pritam.