‎2007 Sep 18 8:32 AM
I NEED A FIELD IN INTERNAL TABLE WITH STRING AND DATA OBJECT.
MY INTERNAL TABLE IS ITAB WITH C AS ITS FIELD.
I HAVE A DATA OBJECT B OF TYPE I.
I NEED TO ADD DATA INTO FIELD C OF INTERNAL TABLE WITH SOME TEXT AND THE VALUE IN THE DATA OBJECT B.
SOMETHIN LIKE THIS
C SHOULD CONTAIN : "CUSTOMER NO 10 DOES NOT EXIST".
HERE 10 IS THE NO STORED IN DATAOBJECT B WHICH CHANGES DYNAMICALLY.
‎2007 Sep 18 8:46 AM
data: begin of itab occurs 0,
B type i,
C type string,
end of itab.
data: v_num(20) type c.
itab-b = 123.
clear v_num.
v_num = itab-b.
concatenate 'CUSTOMER NO' v_num 'DOES NOT EXIST' into itab-c separated by space.
append itab.
clear itab.
itab-b = 456.
clear v_num.
v_num = itab-b.
concatenate 'CUSTOMER NO' v_num 'DOES NOT EXIST' into itab-c separated by space.
append itab.
clear itab.
Message was edited by:
Velangini Showry Maria Kumar Bandanadham
‎2007 Sep 18 8:46 AM
data: begin of itab occurs 0,
B type i,
C type string,
end of itab.
data: v_num(20) type c.
itab-b = 123.
clear v_num.
v_num = itab-b.
concatenate 'CUSTOMER NO' v_num 'DOES NOT EXIST' into itab-c separated by space.
append itab.
clear itab.
itab-b = 456.
clear v_num.
v_num = itab-b.
concatenate 'CUSTOMER NO' v_num 'DOES NOT EXIST' into itab-c separated by space.
append itab.
clear itab.
Message was edited by:
Velangini Showry Maria Kumar Bandanadham
‎2007 Sep 18 8:49 AM
Hi,
Since you have to concatenate the data object 'B' and some text into the string field 'C' of the internal table, it's possible only if the integer value 'B' is moved to any string variable (Concatebation is performed only on string or character type fields).
For eg:
-
data: l_cust type string.
B =10.
l_cust = B.
Concatenate 'CUSTOMER NO' l_cust ' DOES NOT EXIST' into itab-c separated by space.
append itab.
Concatenate statement will return the text as 'CUSTOMER NO 10 DOES NOT EXIST'' into the field 'C' of the internal table.
Hope this helps..
Regards,
Dilli
‎2007 Sep 18 8:51 AM
try something like this - here i am trying to use a FM for building the message text out of message number and message ID.
REPORT ZSKC_TEST3.
DATA : BEGIN OF ITAB OCCURS 0,
KUNNR TYPE KUNNR,
MSG TYPE CHAR255,
END OF ITAB.
START-OF-SELECTION.
* Test data
SELECT KUNNR UP TO 5 ROWS
FROM KNA1
INTO TABLE ITAB
WHERE KUNNR NE SPACE.
CHECK SY-SUBRC EQ 0.
* Processing text for Customers USING message 132(B0).
LOOP AT ITAB.
CALL FUNCTION 'MESSAGE_TEXT_BUILD'
EXPORTING
MSGID = 'B0'
MSGNR = '132'
MSGV1 = ITAB-KUNNR
IMPORTING
MESSAGE_TEXT_OUTPUT = ITAB-MSG.
MODIFY ITAB TRANSPORTING MSG.
ENDLOOP.
BREAK-POINT.
The output is -
0000000001|Customer 0000000001 does not exist <
0000000006|Customer 0000000006 does not exist <
0000001179|Customer 0000001179 does not exist <
0000001700|Customer 0000001700 does not exist <
0000002200|Customer 0000002200 does not exist <
hope it solves ur problem.
Message was edited by:
SKC