Application Development and Automation 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: 
Read only

how to concate

Former Member
0 Likes
768

I have to combine two different fields in single column and result should be displayed IN ONE COLUMN in alv. These two fields are from same tables. How can i do that? ...

1 ACCEPTED SOLUTION
Read only

former_member386202
Active Contributor
0 Likes
710

Hi,

Refer this code

LOOP AT it_pa2010 INTO wa_pa2010.

CALL FUNCTION 'HR_PAYROLL_PERIODS_GET'

EXPORTING

get_begda = wa_pa2010-begda

get_endda = wa_pa2010-endda

get_permo = '03'

IMPORTING

get_pabrj = lv_pabrj

get_pabrp = lv_pabrp

EXCEPTIONS

no_period_found = 1

no_valid_permo = 2

OTHERS = 3.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

CONCATENATE lv_pabrp lv_pabrj INTO wa_final2-wekly SEPARATED BY '/'.

wa_final2-pernr = wa_pa2010-pernr.

wa_final2-workdate = wa_pa2010-workdate.

wa_final2-lgart = wa_pa2010-lgart.

wa_final2-stdaz = wa_pa2010-stdaz.

wa_final2-raufnr = wa_pa2010-raufnr.

IF NOT wa_pa2010-raufnr IS INITIAL.

IF ( wa_pa2010-workdate GE p_begda ) AND

( wa_pa2010-workdate LE p_endda ).

APPEND wa_final2 TO it_final2.

ENDIF.

ENDIF.

*--Clear

CLEAR : wa_pa2010.

ENDLOOP.

ENDIF.

Regards,

Prashant

I have to combine two different fields in single column and result should be displayed IN ONE COLUMN in alv. These two fields are from same tables. How can i do that? ...

5 REPLIES 5
Read only

former_member386202
Active Contributor
0 Likes
711

Hi,

Refer this code

LOOP AT it_pa2010 INTO wa_pa2010.

CALL FUNCTION 'HR_PAYROLL_PERIODS_GET'

EXPORTING

get_begda = wa_pa2010-begda

get_endda = wa_pa2010-endda

get_permo = '03'

IMPORTING

get_pabrj = lv_pabrj

get_pabrp = lv_pabrp

EXCEPTIONS

no_period_found = 1

no_valid_permo = 2

OTHERS = 3.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

CONCATENATE lv_pabrp lv_pabrj INTO wa_final2-wekly SEPARATED BY '/'.

wa_final2-pernr = wa_pa2010-pernr.

wa_final2-workdate = wa_pa2010-workdate.

wa_final2-lgart = wa_pa2010-lgart.

wa_final2-stdaz = wa_pa2010-stdaz.

wa_final2-raufnr = wa_pa2010-raufnr.

IF NOT wa_pa2010-raufnr IS INITIAL.

IF ( wa_pa2010-workdate GE p_begda ) AND

( wa_pa2010-workdate LE p_endda ).

APPEND wa_final2 TO it_final2.

ENDIF.

ENDIF.

*--Clear

CLEAR : wa_pa2010.

ENDLOOP.

ENDIF.

Regards,

Prashant

Read only

Former Member
0 Likes
710

Hi,

loop at itab.

Concatenate itab-field1 itab-field2 into itab-field3 .

Modify itab.clear itab.

Endloop.

If you want you can add "separated by '/' " also as addition to the above stmt.

Thanks

Sivaparvathi

Please reward points if helpful.

Read only

former_member402443
Contributor
0 Likes
710

Hi Supriya,

Loop at itab into wa_itab.

concatenate wa_fname wa_lname into wa_name separated by space.

modify wa_itab.

endloop.

Rewards points if useful.

Regards

Manoj Kumar

Read only

Former Member
0 Likes
710

loop at table.

concatenate field1 field2 into field3.

modify table.

endloop.

Pass dis table to REUSE_ALV_GRID_DISPLAY

while building the field catalog..pass dis new column for display

instead of other 2 which u want 2 b seen concatenated.

Hope dis helps..

Reward all helpful ans

Read only

Former Member
0 Likes
710

For example itab-name1 & itab-name2 you suppose to concatenate. if these fields are type char then you can concatenate with out any extra fields.

If not define 2 temporary fields like

Name1 type char40.

Name2 type char40.

Define one extra field ( itab-name3 type char80) in your itab. Add this field to field catalogue.

And remove name1 & name2 from field cat.

LOOP AT ITAB.

Name1 = itab-name1.

Name2 = itab-name2.

CONCATENATE name1 name2 INTO itab-name3

MODIFY itab INDEX sy-tabix.

ENDLOOP.

Then pass this table to ALV list display FM..