Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

concatenate 3 fields

Former Member
0 Kudos

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.

1 ACCEPTED SOLUTION

former_member222860
Active Contributor
0 Kudos

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.

5 REPLIES 5

former_member585060
Active Contributor
0 Kudos

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

Former Member
0 Kudos

try to use concatenate statment

CONCATENATE '''' '123' '''' INTO W_FIELD

former_member222860
Active Contributor
0 Kudos

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.

former_member387317
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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.