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: 

case statment for changeid

Former Member
0 Kudos
120

Hi Experts

I want to modify a code by displaying CDPOS-CHNGIND = 'EDIT' if

CDPOS-CHNGIND ='E' . U as Update, I as Insert , D as delete.

It is displying in my ALV grid as U,I,E,D in the type

clear st_fieldcat.

add 1 to lva_col_pos.

st_fieldcat-tabname = 'PA_IT_MERGED'.

st_fieldcat-fieldname = 'CHNGIND'.

st_fieldcat-ref_tabname = 'CDPOS'.

st_fieldcat-ref_fieldname = 'CHNGIND'.

st_fieldcat-row_pos = '6'.

st_fieldcat-col_pos = lva_col_pos.

append st_fieldcat to pa_it_fieldcat.

regards

1 ACCEPTED SOLUTION

Former Member
0 Kudos
79

Hi,

Check this code:

CASE CDPOS-CHANGIND.

WHEN 'E'.

CDPOS-CHANGIND = 'EDIT'

WHEN 'U'.

CDPOS-CHANGIND = 'Update'

WHEN 'I'.

CDPOS-CHANGIND = 'Insert'

WHEN 'D'.

CDPOS-CHANGIND = 'Delete'

ENDCASE.

Here i am changing the CDPOS-CHANGIND value. Make sure that CDPOS-CHANGIND length is sufficient to hold above strings.

Hope this helps.

ashish

Message was edited by:

Ashish Gundawar

6 REPLIES 6

Former Member
0 Kudos
80

Hi,

Check this code:

CASE CDPOS-CHANGIND.

WHEN 'E'.

CDPOS-CHANGIND = 'EDIT'

WHEN 'U'.

CDPOS-CHANGIND = 'Update'

WHEN 'I'.

CDPOS-CHANGIND = 'Insert'

WHEN 'D'.

CDPOS-CHANGIND = 'Delete'

ENDCASE.

Here i am changing the CDPOS-CHANGIND value. Make sure that CDPOS-CHANGIND length is sufficient to hold above strings.

Hope this helps.

ashish

Message was edited by:

Ashish Gundawar

0 Kudos
79

Hi Ashish

When I enter your case statement it is displaying as

Field When is unknown it is neither in one of the speicified tables nor defined by DATA statement, where to declare this statement

regards

Piroz

0 Kudos
79

You need to use internal table field reference in CASE statement

I think your internal table is PA_IT_MERGED and field is CHANGEIND.

So it will be CASE pa_it_merged-changeind.

ashish

0 Kudos
79


CASE CDPOS-CHANGIND.
WHEN 'E'.
CDPOS-CHANGIND = 'EDIT'  .
WHEN 'U'.
CDPOS-CHANGIND = 'Update'   .
WHEN 'I'.
CDPOS-CHANGIND = 'Insert'    .
WHEN 'D'.
CDPOS-CHANGIND = 'Delete'    .
ENDCASE.




Hi It was missing dots after each line

regards

Nishant

0 Kudos
79

Thanks All who supported

regards

0 Kudos
79

Thanks All who supported, closing thread

regards