07-23-2009 1:53 PM
Hi,
I have a requirement to retrieve two fields from different tables of same type and pass them to a single field in alv grid.
Kindly help me in this issue.
Thanks ,
silpa.
07-23-2009 2:06 PM
use like this-->
CONCATENATE ITAB1-FIELD1 ITAB2-FIELD2 INTO <REQUIRED FIELD>
But be sure that field type should be character.
otherwise you have to move other value into some character type field.
Regds,
Anil
07-23-2009 1:54 PM
07-23-2009 1:59 PM
Suppose there are two fields of length 5 retrieved from different tables. Declare a new field in internal table with length 10, then concatenate field1 field2 into internal table-field. Then pass the internal table to FM REUSE_ALV_GRID_DISPLAY.
07-23-2009 2:05 PM
Hi Arjun,
I have tried this and iam getting the two field values in the same row.
But my requirement is to show them in different rows.
eg:1st field: goods recieipt.
2nd field : invoice receipt.
LOOP AT IT_FINAL INTO WA_FINAL.
concatenate WA_FINAL-btext WA_FINAL-beWtl into WA_FINAL-bte separated by space.
MODIFY IT_FINAL FROM WA_FINAL TRANSPORTING BTE.
ENDLOOP.
I have tried this
and o/p is : goods recieipt invoice receipt.
and my requirement is :
goods recieipt.
invoice receipt.
Thanks,
Silpa.
07-23-2009 2:14 PM
Hi,
If you want the 2nd field to be concatenated in a new line, try the following
CONSTANTS: c_new_line(1) TYPE c VALUE cl_abap_char_utilities=>newline
LOOP AT IT_FINAL INTO WA_FINAL.
CONCATENATE WA_FINAL-btext WA_FINAL-beWtl into WA_FINAL-bte separated by c_new_line.
MODIFY IT_FINAL FROM WA_FINAL TRANSPORTING BTE.
ENDLOOP.
Regards,
Vik
Edited by: vikred on Jul 23, 2009 3:15 PM
Edited by: vikred on Jul 23, 2009 3:16 PM
07-23-2009 2:30 PM
Hi Silpa -
U can try the below code, which is suggested by Vikred. This will separate the concatenated text by a line.
CONSTANTS: c_new_line(1) TYPE c VALUE cl_abap_char_utilities=>newline
LOOP AT IT_FINAL INTO WA_FINAL.
CONCATENATE WA_FINAL-btext WA_FINAL-beWtl into WA_FINAL-bte separated by c_new_line.
MODIFY IT_FINAL FROM WA_FINAL TRANSPORTING BTE.
ENDLOOP.
07-23-2009 2:39 PM
Hi Arjun & Vikred,
Thanks for your suggestion
But it is not working fine there is just a rectangle box coming between this two fields.
Thanks,
Silpa.
07-23-2009 2:50 PM
Hi Silpa,
Try this one.
LOOP AT IT_FINAL INTO WA_FINAL.
concatenate WA_FINAL-btext ',' WA_FINAL-beWtl into WA_FINAL-bte separated by space.
split wa_final-bte at , into wa_final-btext wa_final-bewti.
MODIFY IT_FINAL FROM WA_FINAL TRANSPORTING BTE.
ENDLOOP
Thanks & Regards,
John Victor
07-23-2009 2:56 PM
Hi Jhon,
Thanks a lot.
Am getting just a comma between the fields.
But not in the next line.
Thanks,
Silpa.
07-23-2009 2:57 PM
You mean you are getting a blank field inbetween the 2 values in the ALV grid?
07-23-2009 3:03 PM
Hi,
Its not blank field but one small box between goods receipt & invoice receipt.
my requirement is: goods receipt
invoice receipt.
Thanks,
Silpa.
07-23-2009 2:06 PM
use like this-->
CONCATENATE ITAB1-FIELD1 ITAB2-FIELD2 INTO <REQUIRED FIELD>
But be sure that field type should be character.
otherwise you have to move other value into some character type field.
Regds,
Anil
07-23-2009 2:14 PM
Hi,
Try following
Loop at it_final into wa_final.
1) read value from table1 into var1.
2) read value from table2 into var2.
3) Concatenate var1 var2 into wa_final-field.
4) Append wa_final to it_final.
Endloop.
Regards
Milan Shah
Edited by: Milan Shah on Jul 23, 2009 6:45 PM