ā2013 Jul 12 11:08 AM
Hi to all,
Can any one explain, is there any ABAP code or Functional module to read from table /SAPTRX/EH_INFO. (This is Database table in SAP EM).
Example: i have database table /SAPTRX/EH_INFO in SAP EM.
It have a field PARAM_NAME type C 32. and it contain 3 data
PARAM_NAME (field name)
rocky (field value)
john (field value)
mike (field value)
i want to concate rocky john mike and put in saome result field.
Can any one provide some light on it.
Regads
Pavneet Rana
Moderator Message - Unmarked as question.
Message was edited by: Suhas Saha
ā2013 Jul 12 12:08 PM
Hi,
I really don't understand why you would like to find a fm ...
select param_nam into w_param_name from ... where ...
concatenate w_sum w_param_name into w_sum separated by space.
endselect.
remove the first space ..
regards
Fred
ā2013 Jul 12 12:15 PM
Dear,
Just read field value into variable and concatenate it to 1 final variable.
ā2013 Jul 12 12:17 PM
Hi Rana,
You can use FM - RFC_READ_TABLE.
give parameters: QUERY_TABLE - your table name
DELIMITER - like , / ;
OPTIONS = your selection where condition (like VBELN = '1000' )
and you will get concatenated data in DATA table.
.
Thanks,
Chandra.
Message was edited by: Venkat Gowrishankar
ā2013 Jul 12 12:19 PM
Hi Pavaneet Rana,
You can write below abap code to concatenate table fields.
data: itab type table of /SAPTRX/EH_INFO,
wa type /SAPTRX/EH_INFO,
result_field type string.
select * from /SAPTRX/EH_INFO
into table itab where......
loop at itab into wa.
concatenate wa-param_name result_field into result_field seperated by space.
endloop.
Srikanth.
ā2013 Jul 12 12:21 PM
Hi Pavneet,
You can refer this simple code,and code ur requirement accordingly.No need of any FM.
REPORT ZTEST line-size 1000.
data : it_tab like table of /SAPTRX/EH_INFO with header line.
data:name type string.
select PARAM_NAME
from /SAPTRX/EH_INFO
into corresponding fields of table it_tab.
loop at it_tab.
concatenate name it_tab-PARAM_NAME into name.
write:/ name.
endloop.
ā2013 Jul 15 5:06 AM
Hi Pavneet,
Functional Module's to concatenate table values
STRING_CONCATENATE
STRING_CONCATENATE_3
DATA: STRING(100) TYPE C.
PARAMETERS: A(20) TYPE C,
B(20) TYPE C.
CALL FUNCTION 'STRING_CONCATENATE'
EXPORTING
STRING1 = A
STRING2 = B
IMPORTING
STRING = STRING
EXCEPTIONS
TOO_SMALL = 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.
WRITEš STRING.
clear : string.
CONCATENATE A B into string SEPARATED BY ' '. " better use this method instead of FM
WRITEš STRING.
Regards,
Ramesh.T
ā2013 Jul 15 8:05 AM
Hi Rana,
As you have said in single field PARAM_NAME you are already getting 3 values . so how your getting them and how you want to change.
Example:-
if ur getting 3 values as comma seperated.
PARAM_FIELD = ROCKEY,JOHN,MIKE
and your anticipating output as
PARAM_FIELD = ROCKEY JOHN MIKE
then u can use REPLACE keyword..
if your still not clear about what it is give some more details to help you..
Hope it helps,
Andrew