on 11-12-2013 6:37 PM
Hi experts, I am programming a Web dynpro and I have two inputs (Class Sales Organization and Sales), when run i get this error "A dynamically specified column name is unknown", this is the code:
The method is the search button
Declaración de datos
DATA: lo_el_context TYPE REF TO if_wd_context_element,
ls_context TYPE wd_this->element_context,
lv_vkorg TYPE wd_this->element_context-vkorg,
lv_auart TYPE wd_this->element_context-auart.
*Obtener elementos vía selección
lo_el_context = wd_context->get_element( ).
*Obtener un unico atributo
lo_el_context->get_attribute(
EXPORTING
name = 'VKORG'
IMPORTING
value = lv_vkorg ).
*Obtener elementos vía selección
lo_el_context = wd_context->get_element( ).
*Obtener un unico atributo
lo_el_context->get_attribute(
EXPORTING
name = 'AUART'
IMPORTING
value = lv_vkorg ).
*Declaración de datos para tabla
DATA: lt_hdr TYPE STANDARD TABLE OF VBAK,
ls_cond TYPE c,
lt_cond LIKE TABLE OF ls_cond.
*Condición
CONCATENATE 'VKORG = ''' lv_vkorg '''' INTO ls_cond.
APPEND ls_cond TO lt_cond.
CONCATENATE 'AUART = ''' lv_auart '''' INTO ls_cond.
CONCATENATE 'AND' ls_cond INTO ls_cond SEPARATED BY space.
APPEND ls_cond TO lt_cond.
This piece of code generates the error me
SELECT vbeln erdat erzet auart vkorg
FROM vbak
INTO TABLE lt_hdr
WHERE (lt_cond).
*
*Declarar datos de cabecera
DATA: lo_nd_header TYPE REF TO if_wd_context_node.
*Navegar desde CONTEXT hacia HEADER via selección
lo_nd_header = wd_context->get_child_node( name = wd_this->wdctx_header ).
*Declarar todos los atributos
lo_nd_header->bind_table( lt_hdr ).
Please can you help me.
Best Regards.
Hi Brujo,
The runtime error is pointing to the issue in WHERE condition i.e. lt_cond table is not having valid field names specified.
Error in the below code :
*Declaración de datos para tabla
DATA: lt_hdr TYPE STANDARD TABLE OF VBAK,
ls_cond TYPE c,
lt_cond LIKE TABLE OF ls_cond.
As ls_cond declared as type "C" , it can take only 1 char, hence lt_cond is filled with incorrect condition
Correct the same as below
DATA: lt_hdr TYPE STANDARD TABLE OF VBAK,
ls_cond type string,
lt_cond LIKE TABLE OF ls_cond.
Hope it helps you.
Regards,
Rama
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI Brujo,
Please maintain the proper spacing between the variable.
CONCATENATE 'VKORG = ''' lv_vkorg '''' INTO ls_cond.
APPEND ls_cond TO lt_cond.
Your code " CONCATENATE 'AUART = ''' lv_auart '''' INTO ls_cond.
CONCATENATE ' AUART = ''' lv_auart '''' INTO ls_cond.
Your code "CONCATENATE 'AND' ls_cond INTO ls_cond SEPARATED BY space.
"CONCATENATE ' AND' ls_cond INTO ls_cond SEPARATED BY space.
APPEND ls_cond TO lt_cond.
Please give the space before staring the AUART and AND .
Regards..
Nishant Bansal
Hi Ram,
Am executing bapi with 2 different records in webdynpro abap , bapi executing successfully but the problem am facing is, in databse table it storing with first record multiple times it is not taking 2nd record ....i kept debugger n i checked in bapi that it taking 2 different records but while storing in bdtable, it storing single record multiple times .. .please help to solve this its adj..
SELECT vbeln erdat erzet auart vkorg
FROM vbak
INTO TABLE lt_hdr
WHERE (lt_cond).
Error is because VBAK have no. of field and you fetching data for some field only 'vbeln'... So as kiran suggested please try with Corresponding filed of table. because at run time query unable to find corresponding fields...
one more thing, have you created the node using whole "VBAK" table,means all attribute, because you are binding table with lt_hdr, but you are fetching data for only 5 fields so i don't thing that your node have all attribute as like VBAK field, so why you are binding table with lt_hdr.
lo_nd_header->bind_table( lt_hdr ).
I will suggest you to read the table node and then apply the query on that only using Corresponding filed of table..and bind that lt_node with table.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Use INTO CORRESPONDING FIELDS OF TABLE lt_hdr instead of INTO TABLE.
Or create a local structure with only those 4 fields which you want to fetch using Types and use INTO TABLE .
Regards,
Kiran
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
9 | |
8 | |
6 | |
6 | |
6 | |
5 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.