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: 

Problem with ALV Grid Control

abdul_hakim
Active Contributor
0 Kudos

Hi Friends,

I want to suppress the sign of particular fields on my ALV Grid but i am not getting it.Below is my source code.Kindly advice..

CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'

EXPORTING

I_STRUCTURE_NAME = 'ZMAT_DETAILS'

CHANGING

CT_FIELDCAT = gt_fcat[]

.

LOOP AT gt_fcat.

IF gt_fcat-fieldname = 'VARI1' OR

gt_fcat-fieldname = 'VARI2'.

gt_fcat-no_sign = 'X'.

MODIFY gt_fcat.

ENDIF.

ENDLOOP.

CREATE OBJECT doc EXPORTING extension = 3000.

CREATE OBJECT alv EXPORTING i_parent = doc.

CALL METHOD alv->SET_TABLE_FOR_FIRST_DISPLAY

EXPORTING

IS_VARIANT = gs_variant

I_SAVE = x_save

  • I_STRUCTURE_NAME = 'ZMAT_DETAILS'

CHANGING

IT_FIELDCATALOG = gt_fcat[]

IT_OUTTAB = int_final.

REgards,

Abdul

1 ACCEPTED SOLUTION

former_member188685
Active Contributor
0 Kudos

did you checked the fieldcatalog in debug mode.

regards

vijay

19 REPLIES 19

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

What is the type of the fields, are the QUAN?

Regards,

Rich Heilman

0 Kudos

Hi Rich,

It is CURR..

Please help..

Regards,

Abdul

former_member188685
Active Contributor
0 Kudos

Can you Give the FIELDNAME.

and what is the type.

regards

vijay

0 Kudos

Hi Vijay,

I am checking based on the FIELDNAME only..

LOOP AT gt_fcat.

IF gt_fcat-fieldname = 'VARI1' OR

gt_fcat-fieldname = 'VARI2'.

gt_fcat-no_sign = 'X'.

MODIFY gt_fcat.

ENDIF.

ENDLOOP.

Regards,

Abdul

former_member188685
Active Contributor
0 Kudos

did you checked the fieldcatalog in debug mode.

regards

vijay

0 Kudos

Hi Vijay,

I have checked everything is fine...

Thanks,

Abdul

0 Kudos

can you give the code relevant , is it ZFIELD or STANDARD field plese let me know.;

regards

vijay

0 Kudos

It is a ZFIELD belonging to the structure ZMAT_DETAILS..

Regards,

Abdul

0 Kudos

please check the Domain of it, I don't think it is currency field, might be char field.

regards

vijay

0 Kudos

If it is Non Numeric field then It will Not come.

then Try to assign the domain to currency related.

regards

vijay

0 Kudos

in field catalog try passing CFIELDNAME also.

regards

vijay

0 Kudos

Yep, that works for me....

Add these two lines...




  loop at gt_fcat.
    if gt_fcat-fieldname = 'VARI1' or
    gt_fcat-fieldname = 'VARI2'.
<b>      gt_fcat-CURRENCY = 'USD'.
      gt_fcat-cfieldname = gt_fcat-fieldname.</b>
      gt_fcat-no_sign = 'X'.
      gt_fcat-JUST    = 'R'.
      modify gt_fcat.
    endif.
  endloop.

Regards,

Rich Heilman

0 Kudos

<b> gt_fcat-no_sign = 'X'.</b> along with the no_sign use one of the below according to your requirement check...

this will work......

<b> gt_fcat-inttype = 'I' or

gt_fcat-inttype = 'P' or

gt_fcat-inttype = 'F'.</b>

0 Kudos

Hi Abdul,

What Happened to your Program...

Is it working ....

Regards

vijay

0 Kudos

Hi Rich,

Thanks a lot.

I have solved this problem through your idea...

Thanks again,

Abdul

0 Kudos

Hi Abdul,

WIth out Currency fieldname it is not possible,

I mentioned that if you see my post.

regards

vijay

0 Kudos

Hi Vijay..

Jus checked..

Many Thanks...

Regards,

Abdul

Former Member
0 Kudos

Hi,

If it is "CURR" type obviously you will get the signs, commas, decimal points. If you don’t want them change the type to “CHAR” and try.

Thanks,

Suman

0 Kudos

One solution would be to check if the values are less than 0, then multply by - 1.

Loop at int_final.
If int_final-vari1 < 0.
int_final-vari1  = int_final-vari1  * -1.
endif.

If int_final-vari2 < 0.
int_final-vari2 = int_final-vari1  * -2.
endif.

Modify int_final.

endloop.

I know that you really want to handle this thru the catalog, I'm having trouble with it as well.

Regards,

Rich Heilman