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: 

Alv OO program error Message no. 0K534

0 Kudos

Hi expert,

        Everytime i hit enter or any command button the program prompt me an error message

even though i already declare all my variables globally still the error is the same.

my global variable Declaration


DATA: gr_data     Type Ref To DATA.
          DATA: la_data     Type Ref To data.
          FIELD-SYMBOLS: <gt_data> TYPE STANDARD TABLE.

my Full source code.

me->get_data( CHANGING c_data = <f_tab> ).


METHOD get_data.

       GET REFERENCE OF c_data INTO la_data.
       move la_data TO gr_data. " pass to global variable


        assign gr_data->* to <gt_data>.
         IF gc_custom_container is initial.
           CREATE OBJECT gc_custom_container
               EXPORTING
                  container_name  = gv_mycontainer.
         ENDIF.

         if table is not bound.
            try.
                "// Create ALV Instance
                cl_salv_table=>factory(
                  exporting
                    r_container    = gc_custom_container
                    container_name = 'TC_MIXING'
                  importing
                    r_salv_table   table
                  changing
                    t_table        = <gt_data>
                 ).
              catch cx_salv_msg.                              "#EC NO_HANDLER
            endtry.

           "// Setup ALV Attributes
           functions = table->get_functions( ).
           functions->set_all( abap_true ).

           columns = table->get_columns( ).
           columns->set_optimize( abap_true ).

           try.
               column = columns->get_column( 'MANDT' ).
               column->set_technical( if_salv_c_bool_sap=>true ).
             catch cx_salv_not_found.                        "#EC NO_HANDLER
           endtry.
           "// Dispalay ALV Model
           table->display( ).

         else.
           table->refresh( ).
         endif.

ENDMETHOD

Any suggestions?

Thanks.


11 REPLIES 11

former_member946717
Contributor
0 Kudos

Hi,

What I understand from your code is that, when you perform any action such as Enter or any other Command, you get this error. This is because although you have defined Method, you have not used it as an Event. Also the above code looks incomplete. Can you please elaborate on what exactly you are trying to do?

Is this error triggering after the Report Output and when you perform an action on the Report Output?

0 Kudos

Hi A N

I'm trying to make a dynamic alv report. 1 to 3 column are static and 3 column beyond are dynamic base on per user chemical Consumption.  when i fill in a key and hit once the report automatically fetch data but when i hit enter twice the error Triggered or i change key it also triggered error.

another question: how to create structure dynamically base on field-symbol. is this possible?

ls_testvar like line of <f_tab>.


0 Kudos

Hi,

I don't know whether you require the custom container. Try the below code(I have removed the custom container section) and see if the error persists:

DATA: gr_data     Type Ref To DATA.
          DATA: la_data     Type Ref To data.
          FIELD-SYMBOLS: <gt_data> TYPE STANDARD TABLE.

my Full source code.

me->get_data( CHANGING c_data = <f_tab> ).


METHOD get_data.

       GET REFERENCE OF c_data INTO la_data.
       move la_data TO gr_data. " pass to global variable


        assign gr_data->* to <gt_data>.

         if table is not bound.
            try.
                "// Create ALV Instance
                cl_salv_table=>factory(
                  importing
                    r_salv_table   table
                  changing
                    t_table        = <gt_data>
                 ).
              catch cx_salv_msg.                              "#EC NO_HANDLER
            endtry.

           "// Setup ALV Attributes
           functions = table->get_functions( ).
           functions->set_all( abap_true ).

           columns = table->get_columns( ).
           columns->set_optimize( abap_true ).

           try.
               column = columns->get_column( 'MANDT' ).
               column->set_technical( if_salv_c_bool_sap=>true ).
             catch cx_salv_not_found.                        "#EC NO_HANDLER
           endtry.
           "// Dispalay ALV Model
           table->display( ).

         else.
           table->refresh( ).
         endif.

ENDMETHOD

If you want to use a custom container, u need to create a screen(say 9000 in SE51) for your program and create the custom container in it. U need to call this screen in your program for the ALV output. You can use PBO and PAI of the created screen for ALV display and coding user command section.

0 Kudos

Hi maju,

     i need the custom container because i use  subscreen.

thanks,

Ryl

0 Kudos

data: lo_tabdescr    type ref to cl_abap_tabledescr,

         lo_structdescr type ref to cl_abap_structdescr,

         lr_data            type data.

field-symbols:

        <fs_data>        type any.

lo_tabdescr = cl_abap_typedescr=>describe_by_data( f_tab ).

lo_structdescr = lo_tabdescr->get_table_line_type( ).

create data lr_data type handle lo_structdescr.

assign lr_data->* to <fs_data>.

Just copy, should work...

0 Kudos

Hi jan,

i paste you code but i got an syntax error The result Type of the function method cannot be converted into type of lo_tabdescr. because my c_data = <f_tab>. is a TYPE STANDARD TABLE not data type.

0 Kudos

Hi Ryl,

Maybe you can debug when you hit enter the second time. Something may not be getting cleared or you might have to increase the line count or so as +1 each time a new entry is created.

0 Kudos

Hi Ryl,

as soon as your field-symbol is assigned, the describe by data should work - imho. Right now im not connected to a sap System. Maybe you want to take look at the class and get some examples via "Used in"-Functionality of the method and/or class.

regards

Jan Martin

Former Member
0 Kudos

Did you try to debug?

/h into the Input field before pushing any Buttons or Enter. Then you create a Breakpoint at "message" and look, why this is Happening.

regards

Jan Martin

0 Kudos

Hi jan,

     there error occur on table->refresh( ). class IF_SALV_ADAPTER~SET_METADATA. it seem the program error trigger everytime i refresh the alv.

Any suggestions?

Thanks.

ryl

0 Kudos

Hi Ryl,

my suggestion would be:

Don't declare a global data and use them inside a method. If you want to use "Global Data" declare it as (private) Attribute of class. Don't use Object-oriented code, if you are only doing some procedural stuff...

I mean, in your example you don't use modulisation, encapsulation, you don't instantiate your class (at least not in the posted code). also i guess youre not doing anything with inheritance or polymorphism.

To your ->refresh( ). issue:

Where are you doing it? In PBO/PAI, in a Event-Handler. This Information is missing.

regards

Jan Martin