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: 

combine two different fields in single column

Former Member
0 Kudos

I have to combine two different fields in single column and result should be displayed in alv.

These two fields are from different tables.

How can i do that?

4 REPLIES 4

Former Member
0 Kudos

Hi,

If the two fields are character fields then use Concatenate statment to combine the two fields into one field.

regards,

Santosh Thorat

0 Kudos

No one is CHAR and another one is NUMC

0 Kudos

Hi,

Then declare a char field of same length of the Numc field. Copy the numc field into the Char field and then use concatenate statment.

regards,

Santosh Thorat

former_member386202
Active Contributor
0 Kudos

Hi,

Declare one character field in your final internal table, loop on that internal table

concatenate that 2 fields into that character field and modify internal table.

Refer this code.

IF NOT it_pa2010[] IS INITIAL.

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