cancel
Showing results for 
Search instead for 
Did you mean: 

error occurs during select-options

former_member740473
Participant
0 Kudos

hi friends,

i am developed a report for extracting data from vbap using select-options

i am using feilds,

vbeln erdat ernam vbtyp vkorg vtweg feilds

and vbeln vkorg vbtyp erdat as selection screen feilds.

i got selection screen screen with required feilds well .

but problem is with method onactiondisplay

the coding like this

method ONACTIONDISPLAY .

TYPES: lty_r_vbeln TYPE RANGE OF vbeln,

lty_r_erdat TYPE RANGE OF erdat,

lty_R_VKORG TYPE RANGE OF VKORG,

lty_r_vbtyp type range of vbtyp.

DATA: lo_customer TYPE REF TO if_wd_context_node.

  • Variables used to retrieve the values of select-options fields

DATA: lt_sel_item TYPE if_wd_select_options=>tt_selection_screen_item.

FIELD-SYMBOLS:

<fs_sel_item> LIKE LINE OF lt_sel_item,

<fs_vbeln> TYPE lty_r_vbeln,

<fs_vkorg> TYPE lty_r_vkorg,

<fs_vbtyp> TYPE lty_r_vbtyp,

<fs_erdat> TYPE lty_r_erdat.

  • Get the selection-screen items

wd_this->m_handler->get_selection_screen_items(

IMPORTING et_selection_screen_items = lt_sel_item ).

  • Retrieve the values from the select-options items

LOOP AT lt_sel_item ASSIGNING <fs_sel_item>.

CASE <fs_sel_item>-m_id.

WHEN `VBELN`.

ASSIGN <fs_sel_item>-m_value->* TO <fs_vbeln>.

WHEN `VKORG`.

ASSIGN <fs_sel_item>-mt_range_table->* TO <fs_vkorg>.

WHEN `VBTYP`.

ASSIGN <fs_sel_item>-mt_range_table->* TO <fs_vbtyp>.

WHEN `ERDAT`.

ASSIGN <fs_sel_item>-mt_range_table->* TO <fs_erdat>.

ENDCASE.

ENDLOOP.

  • Retrieve the data from the database, for simplicity, the

  • SELECT statement has been implemented here.

SELECT * FROM vbak

INTO TABLE wd_this->customer

WHERE vbeln = <fs_vbeln>

AND vkorg IN <fs_vkorg>

AND vbtyp IN <fs_vbtyp>

AND erdat IN <fs_erdat>.

  • Bind the data to the context

lo_customer = wd_context->get_child_node( name = `customer`).

lo_customer->bind_table( wd_this->vbak ).

ENDMETHOD.

here customer is the node

and i refer attributes

m_handler = IF_WD_SELECT_OPTIONS

M_SELECT_OPTIONS = IWCI_WDR_SELECT_OPTIONS

and i defined vbeln as parameter only.

and i got error as

the feild customer is unknown but there is a feild with similar name wdctx_customer

can any one explain clearly to extracts the data by using select options ..?

Accepted Solutions (1)

Accepted Solutions (1)

saravanan_narayanan
Active Contributor
0 Kudos

Hello karunakar ,

SELECT * FROM vbak INTO TABLE wd_this->customer

Should be changed to

Data: lt_customer type wd_this->elements_customer
SELECT * FROM vbak INTO TABLE lt_customer

lo_customer = wd_context->get_child_node( name = `customer`).
lo_customer->bind_table( wd_this->vbak ).

should be changed to

lo_customer = wd_context->get_child_node( name = `CUSTOMER`).
lo_customer->bind_table( lt_customer ).

and this will work only if the structure of Customer Context node is same as VBAK ddic table.

BR, Saravanan

former_member740473
Participant
0 Kudos

thanks saravanan,

i get the data into table.

but i want to extracts the data depends upon select-options.

my feilds are

vbeln for parameters and

vkorg vbtyp, erdat for select-options.

can youexplain clearly.

thanks,

karunakar

saravanan_narayanan
Active Contributor
0 Kudos

Hello Karunakar,

WHERE condition in SELECT statement would do. Isnt it working?

sorry in my previous comment I didnt copy the WHERE condition. Hope you have retained it

SELECT * FROM vbak
INTO TABLE lt_customer
WHERE vbeln = <fs_vbeln>
AND vkorg IN <fs_vkorg>
AND vbtyp IN <fs_vbtyp>
AND erdat IN <fs_erdat>.

BR, Saravanan

former_member740473
Participant
0 Kudos

hi saravanan,

after placing the code i am getting the error as

fs_vbeln cannot be a table,a reference,a string,or contain any of these objects.

how can i resolve this erron

can you explain.

thanks,

karunakar

saravanan_narayanan
Active Contributor
0 Kudos

again copy paste error replace '=' with 'IN'.

BR, Saravanan

former_member740473
Participant
0 Kudos

hi saravanan,

The following error text was processed in the system ECC : Field symbol has not yet been assigned.

this is the runtime error occurs after testing the application.

but when we are using = instead of IN it will be the syntax error only.

the error was

<fs_vbeln> cannot be a table,a reference,a string,or contain any of these objects.

this is syntax error

thanks,

karunakar

former_member740473
Participant
0 Kudos

hi saravanan,

this is the total shortdump occured after using IN instead of =

■The following error text was processed in the system ECC : Field symbol has not yet been assigned.

■The error occurred on the application server csslecc_ECC_01 and in the work process 0 .

■The termination type was: RABAX_STATE

■The ABAP call stack was:

Method: ONACTIONDISPLAY of program /1BCWDY/AWI3HCL1M0QOJ047UWZQ==CP

Method: IF_WDR_VIEW_DELEGATE~WD_INVOKE_EVENT_HANDLER of program /1BCWDY/AWI3HCL1M0QOJ047UWZQ==CP

Method: INVOKE_EVENTHANDLER of program CL_WDR_DELEGATING_VIEW========CP

Method: IF_WDR_ACTION~FIRE of program CL_WDR_ACTION=================CP

Method: DO_HANDLE_ACTION_EVENT of program CL_WDR_WINDOW_PHASE_MODEL=====CP

Method: PROCESS_REQUEST of program CL_WDR_WINDOW_PHASE_MODEL=====CP

Method: PROCESS_REQUEST of program CL_WDR_WINDOW=================CP

Method: EXECUTE of program CL_WDR_MAIN_TASK==============CP

Method: IF_WDR_RUNTIME~EXECUTE of program CL_WDR_MAIN_TASK==============CP

Method: HANDLE_REQUEST of program CL_WDR_CLIENT_ABSTRACT_HTTP===CP

thanks,

karunakar

Former Member
0 Kudos

Hi Karunakar,

Can you pelase paste your compelte code now.

Cheers,

Kris.

former_member740473
Participant
0 Kudos

hi kris,

TYPES: lty_r_vbeln TYPE RANGE OF vbeln,

lty_r_erdat TYPE RANGE OF erdat,

lty_R_VKORG TYPE RANGE OF VKORG,

lty_r_vbtyp type range of vbtyp.

DATA: lo_customer TYPE REF TO if_wd_context_node.

  • Variables used to retrieve the values of select-options fields

DATA: lt_sel_item TYPE if_wd_select_options=>tt_selection_screen_item.

FIELD-SYMBOLS:

<fs_sel_item> LIKE LINE OF lt_sel_item,

<fs_vbeln> TYPE lty_r_vbeln,

<fs_vkorg> TYPE lty_r_vkorg,

<fs_vbtyp> TYPE lty_r_vbtyp,

<fs_erdat> TYPE lty_r_erdat.

  • Get the selection-screen items

wd_this->m_handler->get_selection_screen_items(

IMPORTING et_selection_screen_items = lt_sel_item ).

  • Retrieve the values from the select-options items

LOOP AT lt_sel_item ASSIGNING <fs_sel_item>.

CASE <fs_sel_item>-m_id.

WHEN `VBELN`.

ASSIGN <fs_sel_item>-m_value->* TO <fs_vbeln>.

WHEN `VKORG`.

ASSIGN <fs_sel_item>-mt_range_table->* TO <fs_vkorg>.

WHEN `VBTYP`.

ASSIGN <fs_sel_item>-mt_range_table->* TO <fs_vbtyp>.

WHEN `ERDAT`.

ASSIGN <fs_sel_item>-mt_range_table->* TO <fs_erdat>.

ENDCASE.

ENDLOOP.

  • Retrieve the data from the database, for simplicity, the

  • SELECT statement has been implemented here.

Data: lt_customer type wd_this->elements_customer.

SELECT * FROM vbak

INTO TABLE lt_customer

WHERE vbeln in <fs_vbeln>

AND vkorg IN <fs_vkorg>

AND vbtyp IN <fs_vbtyp>

AND erdat IN <fs_erdat>.

lo_customer = wd_context->get_child_node( name = `CUSTOMER`).

lo_customer->bind_table( lt_customer ).

saravanan_narayanan
Active Contributor
0 Kudos

the select condition should be dynamically populated. because all the field symbols wont be assigned if values are not entered in all the select options fields.

do the following.

1. change


<fs_vbeln> TYPE lty_r_vbeln,
"to
<fs_vbeln> TYPE vbeln, "because its just a paramete in your case

2. declare the WHERE condition variable

DATA lv_condition type string.

3. change the loop as following

loop at lt_sel_item assigning <fs_sel_item>.
  case <fs_sel_item>-m_id.
    when `VBELN`.
      assign <fs_sel_item>-m_value->* to <fs_vbeln>.

      if lv_condition is not initial.
        concatenate lv_condition 'AND' into lv_condition separated by space.
      endif.
      concatenate lv_condition 'AND VBELN = <FS_VBELN>' into lv_condition separated by space.

    when `VKORG`.
      assign <fs_sel_item>-mt_range_table->* to <fs_vkorg>.

      if lv_condition is not initial.
        concatenate lv_condition 'AND' into lv_condition separated by space.
      endif.
      concatenate lv_condition 'AND VKORG IN <FS_VKORG>' into lv_condition separated by space.

    when `VBTYP`.
      assign <fs_sel_item>-mt_range_table->* to <fs_vbtyp>.

      if lv_condition is not initial.
        concatenate lv_condition 'AND' into lv_condition separated by space.
      endif.
      concatenate lv_condition 'AND VBTYP IN <FS_VBTYP>' into lv_condition separated by space.

    when `ERDAT`.
      assign <fs_sel_item>-mt_range_table->* to <fs_erdat>.
      
      if lv_condition is not initial.
        concatenate lv_condition 'AND' into lv_condition separated by space.
      endif.
      concatenate lv_condition 'AND ERDAT IN <FS_ERDAT>' into lv_condition separated by space.

  endcase.
endloop.

and also pls verify in the above code whether I have mentioned the DDIC table attribute name and field symbol variable name properly in the condition. I might have overlooked something. and everything should be in uppercase

4. change your select statement to

select * from vbak into table  lt_customer where (lv_condition). 

incase if you get a SQL dump in the debugging mode check whether the LV_condition is populated properly or not.

BR, Saravanan

former_member740473
Participant
0 Kudos

hi saravanan,

after modifing the code i found no errors after testing i got error like

■The following error text was processed in the system ECC : A dynamically specified column name is unknown.

can you plz explain .

regards,

karunakar

saravanan_narayanan
Active Contributor
0 Kudos

again typo error...i'm really sorry... 'AND' is reduntant.... changed code... incase if you get any error with respect to SQL, kindly post the value of LV_CONIDTION.

loop at lt_sel_item assigning <fs_sel_item>.
  case <fs_sel_item>-m_id.
    when `VBELN`.
      assign <fs_sel_item>-m_value->* to <fs_vbeln>.
 
      if lv_condition is not initial.
        concatenate lv_condition 'AND' into lv_condition separated by space.
      endif.
      concatenate lv_condition 'VBELN = <FS_VBELN>' into lv_condition separated by space.
 
    when `VKORG`.
      assign <fs_sel_item>-mt_range_table->* to <fs_vkorg>.
 
      if lv_condition is not initial.
        concatenate lv_condition 'AND' into lv_condition separated by space.
      endif.
      concatenate lv_condition 'VKORG IN <FS_VKORG>' into lv_condition separated by space.
 
    when `VBTYP`.
      assign <fs_sel_item>-mt_range_table->* to <fs_vbtyp>.
 
      if lv_condition is not initial.
        concatenate lv_condition 'AND' into lv_condition separated by space.
      endif.
      concatenate lv_condition 'VBTYP IN <FS_VBTYP>' into lv_condition separated by space.
 
    when `ERDAT`.
      assign <fs_sel_item>-mt_range_table->* to <fs_erdat>.
      
      if lv_condition is not initial.
        concatenate lv_condition 'AND' into lv_condition separated by space.
      endif.
      concatenate lv_condition 'ERDAT IN <FS_ERDAT>' into lv_condition separated by space.
 
  endcase.
endloop.

hope this solves your problem.

BR, Saravanan

former_member740473
Participant
0 Kudos

HI saravanan,

after changing the cod ewhat you hav mentioned i got this error.

Note

■The following error text was processed in the system ECC : Field symbol has not yet been assigned.

■The error occurred on the application server csslecc_ECC_01 and in the work process 0 .

■The termination type was: RABAX_STATE

■The ABAP call stack was:

Method: ONACTIONDISPLAY of program /1BCWDY/AWI3HCL1M0QOJ047UWZQ==CP

Method: IF_WDR_VIEW_DELEGATE~WD_INVOKE_EVENT_HANDLER of program /1BCWDY/AWI3HCL1M0QOJ047UWZQ==CP

Method: INVOKE_EVENTHANDLER of program CL_WDR_DELEGATING_VIEW========CP

Method: IF_WDR_ACTION~FIRE of program CL_WDR_ACTION=================CP

Method: DO_HANDLE_ACTION_EVENT of program CL_WDR_WINDOW_PHASE_MODEL=====CP

Method: PROCESS_REQUEST of program CL_WDR_WINDOW_PHASE_MODEL=====CP

Method: PROCESS_REQUEST of program CL_WDR_WINDOW=================CP

Method: EXECUTE of program CL_WDR_MAIN_TASK==============CP

Method: IF_WDR_RUNTIME~EXECUTE of program CL_WDR_MAIN_TASK==============CP

Method: HANDLE_REQUEST of program CL_WDR_CLIENT_ABSTRACT_HTTP===CP

can you explain.

and one thing no need of saying sorry we are all friends then there is no need of these words

thanks,

karunakar

saravanan_narayanan
Active Contributor
0 Kudos

Hello Karunakar,

next time if you get a dump, kindly provide the following

1. source code line in your code where its dumping

2. post the value of the LV_CONDITION that is constructed dynamically

3. if you get field symbol unassigned dump then check whether all the field symbols are assigned before executing the SQL statement. by this way you can easily identify the field symbol that is not assigned.

for the time being wrap the all the if conditions in the loop with another if condition to check whether the field-symbols are assigned or not


loop at lt_sel_item assigning <fs_sel_item>.
  case <fs_sel_item>-m_id.
    when `VBELN`.
      assign <fs_sel_item>-m_value->* to <fs_vbeln>.
 
      if <fs_vbeln> is assigned and <fs_vbeln> is not initial.
        if lv_condition is not initial.
         concatenate lv_condition 'AND' into lv_condition separated by space.
        endif.
        concatenate lv_condition 'VBELN = <FS_VBELN>' into lv_condition separated by space.
      endif.
 
    when `VKORG`.
      assign <fs_sel_item>-mt_range_table->* to <fs_vkorg>.
 
      if <fs_vkorg> is assigned and <fs_vkorg> is not initial.
        if lv_condition is not initial.
                concatenate lv_condition 'AND' into lv_condition separated by space.
        endif.
      concatenate lv_condition 'VKORG IN <FS_VKORG>' into lv_condition separated by space.
      endif
 
    when `VBTYP`.
      assign <fs_sel_item>-mt_range_table->* to <fs_vbtyp>.
      if <fs_vbtyp> is assigned and <fs_vbtyp> is not initial. 
        if lv_condition is not initial.
                concatenate lv_condition 'AND' into lv_condition separated by space.
        endif.
      concatenate lv_condition 'VBTYP IN <FS_VBTYP>' into lv_condition separated by space.
      endif
 
    when `ERDAT`.
      assign <fs_sel_item>-mt_range_table->* to <fs_erdat>.
      
      if <fs_erdat> is assigned and <fs_erdat> is not initial.
        if lv_condition is not initial.
                concatenate lv_condition 'AND' into lv_condition separated by space.
        endif.
        concatenate lv_condition 'ERDAT IN <FS_ERDAT>' into lv_condition separated by space.
      endif
 
  endcase.
endloop.

BR, Saravanan

former_member740473
Participant
0 Kudos

hi saravanan,

i resolve the errors

but at the time of click on the display button

i can't get the values on my table

i think sql statement is not triggered why ...?

can u explain clearly

otherwise give me an example for step by step procedure.

thanks,

karunakar

saravanan_narayanan
Active Contributor
0 Kudos

Hello Karunakar,

do the following

1. set a external breakpoint in SELECT statement.

2. check the value of the variable LV_CONDITION and let me know the value as well

3. post the value of all the fied symbols

4. check in the VBAK ddic table whether you have records statisfying the WHERE condition

BR, Saravanan

former_member740473
Participant
0 Kudos

hi saravanan,

this is the value of lv_condition

ERDAT IN <FS_ERDAT>

200045005200440041005400200049004E0020003C00460053005F00450052004400410054003E00

and click on the feild symbol i am getting the statement

feild symbol<fs_vbeln> is not assigned

and

when <fs_vkorg>

<fs_vbtyp>

<fs_erdat> are assigned and they were not giving any values

and i hav checked in vbak also the data present in the table

regards,

karunakar

saravanan_narayanan
Active Contributor
0 Kudos

Hello Karunakar,

Since your problem was not getting solved, I took sometime to try this program on my own and figured out that getting value of parameter field is not same like selection field. we need to change only that part. anyhow since I tried this I;m sharing the complete code.

code for creating the selection fields and parameter fields. verify whether you are doing the same in INIT method


  data lt_range type ref to data.
  data lr_vbeln type ref to vbeln.
  create data lr_vbeln.
  wd_this->m_handler->add_parameter_field(
      i_id    = 'VBELN'
      i_value = lr_vbeln ).

  lt_range = wd_this->m_handler->create_range_table( 'VKORG' ).
  wd_this->m_handler->add_selection_field(
      i_id                         = 'VKORG'
      it_result                    = lt_range ).

  lt_range = wd_this->m_handler->create_range_table( 'VBTYP' ).
  wd_this->m_handler->add_selection_field(
      i_id                         = 'VBTYP'
      it_result                    = lt_range ).

  lt_range = wd_this->m_handler->create_range_table( 'ERDAT' ).
  wd_this->m_handler->add_selection_field(
      i_id                         = 'ERDAT'
      it_result                    = lt_range ).

and code the action method


  data:
        lt_sel_item type if_wd_select_options=>tt_selection_screen_item,
        lt_parameters type if_wd_select_options=>tt_selection_screen_item,
        lt_r_vkorg type range of vkorg,
        lt_r_vbtyp type range of vbtyp,
        lt_r_erdat type range of erdat,
        lv_condition type string,
        lt_customer type wd_this->elements_customer,
        lo_nd_customer type ref to if_wd_context_node.

  field-symbols:
        <fs_sel_item> like line of lt_sel_item,
        <fv_vbeln> type vbeln,
        <ft_r_vkorg> like lt_r_vkorg,
        <ft_r_vbtyp> like lt_r_vbtyp,
        <ft_r_erdat> like lt_r_erdat.


  wd_this->m_handler->get_parameter_fields( importing et_fields = lt_parameters ).
  wd_this->m_handler->get_selection_screen_items( importing et_selection_screen_items = lt_sel_item ).


  loop at lt_parameters assigning <fs_sel_item>.
    case <fs_sel_item>-m_id.
      when `VBELN`.
        assign <fs_sel_item>-m_value->* to <fv_vbeln>.
        if <fv_vbeln> is assigned and <fv_vbeln> is not initial.
          if lv_condition is not initial.
            concatenate lv_condition 'AND' into lv_condition separated by space.
          endif.
          concatenate lv_condition 'VBELN = <FV_VBELN>' into lv_condition separated by space.
        endif.

    endcase.
  endloop.

  loop at lt_sel_item assigning <fs_sel_item>.
    case <fs_sel_item>-m_id.
      when `VKORG`.
        assign <fs_sel_item>-mt_range_table->* to <ft_r_vkorg>.

        if <ft_r_vkorg> is assigned and <ft_r_vkorg> is not initial.
          if lv_condition is not initial.
            concatenate lv_condition 'AND' into lv_condition separated by space.
          endif.
          concatenate lv_condition 'VKORG IN <FT_R_VKORG>' into lv_condition separated by space.
        endif.

      when `VBTYP`.
        assign <fs_sel_item>-mt_range_table->* to <ft_r_vbtyp>.
        if <ft_r_vbtyp> is assigned and <ft_r_vbtyp> is not initial.
          if lv_condition is not initial.
            concatenate lv_condition 'AND' into lv_condition separated by space.
          endif.
          concatenate lv_condition 'VBTYP IN <FT_R_VBTYP>' into lv_condition separated by space.
        endif.

      when `ERDAT`.
        assign <fs_sel_item>-mt_range_table->* to <ft_r_erdat>.

        if <ft_r_erdat> is assigned and <ft_r_erdat> is not initial.
          if lv_condition is not initial.
            concatenate lv_condition 'AND' into lv_condition separated by space.
          endif.
          concatenate lv_condition 'ERDAT IN <FT_R_ERDAT>' into lv_condition separated by space.
        endif.

    endcase.
  endloop.



  select * from vbak into table  lt_customer where (lv_condition).
  lo_nd_customer = wd_context->get_child_node( name = wd_this->wdctx_customer ).
  lo_nd_customer->bind_table( lt_customer ).

this is working as expected. hope this works for you as well

BR, Saravanan

former_member740473
Participant
0 Kudos

hi saravanan,

you have done great job my problem is solved..

thanks,

karunakar

Answers (1)

Answers (1)

former_member199125
Active Contributor
0 Kudos

for me, your code is somewhat strange.

explain me the below statement ...

SELECT * FROM vbak

INTO TABLE wd_this->customer , here can we use wd_this->customer ?

Regards

Srinivas

former_member199125
Active Contributor
0 Kudos

yes sarvanan. u r right.

Edited by: sanasrinivas on Jul 22, 2011 10:11 AM