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

Problem with ALV Grid Control

abdul_hakim
Active Contributor
0 Likes
1,915

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
Read only

Former Member
0 Likes
1,892

did you checked the fieldcatalog in debug mode.

regards

vijay

19 REPLIES 19
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,892

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

Regards,

Rich Heilman

Read only

0 Likes
1,892

Hi Rich,

It is CURR..

Please help..

Regards,

Abdul

Read only

Former Member
0 Likes
1,892

Can you Give the FIELDNAME.

and what is the type.

regards

vijay

Read only

0 Likes
1,892

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

Read only

Former Member
0 Likes
1,893

did you checked the fieldcatalog in debug mode.

regards

vijay

Read only

0 Likes
1,892

Hi Vijay,

I have checked everything is fine...

Thanks,

Abdul

Read only

0 Likes
1,892

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

regards

vijay

Read only

0 Likes
1,892

It is a ZFIELD belonging to the structure ZMAT_DETAILS..

Regards,

Abdul

Read only

0 Likes
1,892

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

regards

vijay

Read only

0 Likes
1,892

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

then Try to assign the domain to currency related.

regards

vijay

Read only

0 Likes
1,892

in field catalog try passing CFIELDNAME also.

regards

vijay

Read only

0 Likes
1,892

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

Read only

0 Likes
1,892

<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>

Read only

0 Likes
1,892

Hi Abdul,

What Happened to your Program...

Is it working ....

Regards

vijay

Read only

0 Likes
1,892

Hi Rich,

Thanks a lot.

I have solved this problem through your idea...

Thanks again,

Abdul

Read only

0 Likes
1,892

Hi Abdul,

WIth out Currency fieldname it is not possible,

I mentioned that if you see my post.

regards

vijay

Read only

0 Likes
1,892

Hi Vijay..

Jus checked..

Many Thanks...

Regards,

Abdul

Read only

Former Member
0 Likes
1,892

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

Read only

0 Likes
1,892

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