Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cfieldname fieldcat not working [Question] #56

Closed
hervianzhou opened this issue Mar 21, 2020 · 7 comments
Closed

Cfieldname fieldcat not working [Question] #56

hervianzhou opened this issue Mar 21, 2020 · 7 comments

Comments

@hervianzhou
Copy link

hervianzhou commented Mar 21, 2020

Hi @fidley ,

currently i'm using falv for creating some report
image

i'm using IDR currency... but the amount still not reflected like using currency already referenced.. it should be times by 100 like JPY

image

please kindly assist.. is there something i missed?
it's also not working for quantity field

@hervianzhou
Copy link
Author

i'm expecting result like this..

code using salv
image

image

@hervianzhou hervianzhou changed the title Tet cfieldname not working [Question] Cfieldname fieldcat not working [Question] Mar 22, 2020
@fidley
Copy link
Owner

fidley commented Mar 23, 2020

Hi @hervianzhou ,

I'll check it on my installation and I'll come back to you.

@fidley
Copy link
Owner

fidley commented Mar 23, 2020

I have just quickly checked and seems this setting is applied. Just wondering if you have REF_TABLE and REF_FIELD fields in your field-catalog. Sometimes they mess up things

@hervianzhou
Copy link
Author

hervianzhou commented Mar 24, 2020

Hi @fidley ..

i just check the fieldcat before using falv->display..
REF_TABLE and REF_FIELD is blank... both quantity and currency field...
image

this is all the type i'm declared

      kostl  TYPE coep-kostl,
      lstar  TYPE coep-lstar,
      wtgbtr TYPE coep-wtgbtr,
      twaer  TYPE coep-twaer,
      mbgbtr TYPE coep-mbgbtr,
      meinb  TYPE coep-meinb.

@fidley
Copy link
Owner

fidley commented Mar 26, 2020

I've played a little bit and I know how to make it work, but I don't know why it doesn't work from scratch....

image

I've compared the fieldcat of the demo program (which was giving me exactly the same results)


REPORT zdemo_falv24.

TYPES: BEGIN OF t_output,
         price    TYPE sflight-price,
         currency TYPE sflight-currency,
       END OF t_output.

DATA: output TYPE STANDARD TABLE OF t_output.

SELECT price, currency UP TO 10000 ROWS
      INTO CORRESPONDING FIELDS OF TABLE @output
      FROM sflight.


data(falv) = zcl_falv=>create(
               CHANGING
                 ct_table          = output
             ).

falv->column( 'PRICE'  )->set_cfieldname( 'CURRENCY' ).

falv->display( ).

With demo fcat of program from ALV grid in nutshell, where it is working correctly


report zdemo_ain_cl09.
include zdemo_ain_include_screen.

initialization.

select * up to 10000 rows from sflight into table @data(flights).

data(grid) = new cl_gui_alv_grid(
                  i_parent = new cl_gui_custom_container( container_name = 'CC' )
                                 ).
data(fcat) = value lvc_t_fcat(
                               ( fieldname = 'CARRID'  )
                               ( fieldname = 'CONNID' )
                               ( fieldname = 'PRICE' cfieldname = 'CURRENCY' )
                               ( fieldname = 'CURRENCY' )
                             ).

grid->set_table_for_first_display(
  changing
    it_fieldcatalog               = fcat
    it_outtab                     = flights
  exceptions
    invalid_parameter_combination = 1
    program_error                 = 2
    too_many_lines                = 3
    others                        = 4
).
if sy-subrc eq 0.
  call screen 0100.
endif.


And the difference was field TECH_FORM.... in case of correct program it was set to 2, in FALV it was 1.
I have no idea where this field is set, as where used list is not working for it, but using method SET_TECH_FORM on that column with value 2, helps. Quite strange.

@hervianzhou
Copy link
Author

Hi @fidley.. thanks for your time and solution...

@fidley
Copy link
Owner

fidley commented Mar 30, 2020

I will also add this in the next commit as automatic switch from 1 to 2 ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants