2009 Mar 11 6:58 AM
Hi,
I have dynamic internal table and I have some slection screen fields , using these selection screen fields
(select -options), I have to filter the data? assigning will work with READ , but I have select options not the parametre,
and also delete will not work for dynamic table..
as we cannot use assigning with delete..
So how to do this?
and one more thing is , I cannot filter the data while selection( in select, I cannot filter the data-> as it's not coming directly from table, it's coming from buffer),
so now after selection of data, I need to filter the data from dynamic table.
Is there any way to do this?
Regards,
Mrunal
Hi,
I have dynamic internal table and I have some slection screen fields , using these selection screen fields
(select -options), I have to filter the data? assigning will work with READ , but I have select options not the parametre,
and also delete will not work for dynamic table..
as we cannot use assigning with delete..
So how to do this?
and one more thing is , I cannot filter the data while selection( in select, I cannot filter the data-> as it's not coming directly from table, it's coming from buffer),
so now after selection of data, I need to filter the data from dynamic table.
Is there any way to do this?
Regards,
Mrunal
2009 Mar 11 7:05 AM
2009 Mar 11 9:42 AM
Hi Avinash,
Thanks for the info.
But say , I have data in table <lt_data>, and now I have to delete the data according to my selection screen fields, say I have so_vbeln and so_erdat as select options,
and I have to filter the data from <lt_data> for so_vbeln and so_erdat.
then How to do that?
below statement won't work for dynamic internal table.
delete <lt_data> where vbeln not in so_vbeln and erdat not in so_erdat.
then How we will use delete for dynamic table? please guide.
Regards,
Mrunal
2009 Mar 11 9:45 AM
LOOP AT <lt_data> ASSIGNING <ls_data>.
ASSIGN COMPONENT 'VBELN' OF STRUCTURE <ls_data> TO <l_vbeln>.
IF <l_vbeln> NOT IN so_vbeln.
DELETE <lt_data>.
ENDIF.
ENDLOOP.matt
2009 Mar 11 9:54 AM
>
> say I have so_vbeln and so_erdat as select options,
> and I have to filter the data from <lt_data> for so_vbeln and so_erdat.
> then How to do that?
>
Perhaps you can do this when selecting data from the database itself.
Select * from vbak into table gt_vbak where vbeln in so_vbeln and erdat in so_erdat.
regards,
Advait
Edited by: Advait Gode on Mar 11, 2009 10:54 AM
2009 Mar 11 9:56 AM
Hi,
Use
LOOP AT <it_data> INTO ls_data WHERE (Give you condition here).
DELETE <it_data> index sy-tabix. "This will delete the record that matches the condition
ENDLOOP.
Regards,
Sesh
2009 Mar 11 9:57 AM
>
> >
> > say I have so_vbeln and so_erdat as select options,
> > and I have to filter the data from <lt_data> for so_vbeln and so_erdat.
> > then How to do that?
> >
>
> Perhaps you can do this when selecting data from the database itself.
>
> Edited by: Advait Gode on Mar 11, 2009 10:54 AM
The original poster said:
and one more thing is , I cannot filter the data while selection( in select, I cannot filter the data-> as it's not coming directly from table, it's coming from buffer),
matt
2009 Mar 12 6:05 AM
Hi matt,
I tried with below code as you said. But I am getting dump. can you help?
here is my piece of code.
FIELD-SYMBOLS: <LS_DATA> type any,
<LT_DATA> TYPE table,
<L_FIELD> type any.
ASSIGN <l_buffer_entry>-dataptr->* TO <LS_DATA>.
ASSIGN <l_buffer_entry>-dataptr->* TO <LT_DATA>.
LOOP AT <LT_DATA> ASSIGNING <LS_DATA>.
ASSIGN COMPONENT 'BUKRS' OF STRUCTURE <LS_DATA> TO <L_FIELD>.
IF <L_FIELD> NOT IN SO_BUKRS.
DELETE <LT_DATA>.
ENDIF.
UNASSIGN <L_FIELD>.
ASSIGN COMPONENT 'BELNR' OF STRUCTURE <LS_DATA> TO <L_FIELD>.
IF <L_FIELD> NOT IN SO_BELNR.
DELETE <LT_DATA>.
ENDIF.
UNASSIGN <L_FIELD>.
ENDLOOP.
and here is the description of my dump:->>>
You attempted to access an unassigned field symbol
(data segment 32772).
This error may occur for any of the following reasons:
- You address a typed field symbol before it is set using ASSIGN
- You address a field symbol that points to a line in an internal table
that has been deleted
- You address a field symbol that had previously been reset using
UNASSIGN, or that pointed to a local field that no longer exists
- You address a global function interface parameter, even
though the relevant function module is not active,
that is it is not in the list of active calls. You can get the list
of active calls from the this short dump.
2009 Mar 12 6:28 AM
Hello Mrunal
It looks like that your dynamic itab does not contain either of the fields BUKRS or BELNR.
In order to avoid dumps due to unassigned field-symbols add the following checks:
LOOP AT <LT_DATA> ASSIGNING <LS_DATA>.
ASSIGN COMPONENT 'BUKRS' OF STRUCTURE <LS_DATA> TO <L_FIELD>.
IF ( <l_field> IS ASSIGNED ).
IF <L_FIELD> NOT IN SO_BUKRS.
DELETE <LT_DATA>.
ENDIF.
ENDIF.
UNASSIGN <L_FIELD>.
ASSIGN COMPONENT 'BELNR' OF STRUCTURE <LS_DATA> TO <L_FIELD>.
IF ( <l_field> IS ASSIGNED ).
IF <L_FIELD> NOT IN SO_BELNR.
DELETE <LT_DATA>.
ENDIF.
ENDIF.
UNASSIGN <L_FIELD>.
ENDLOOP.
However, if neither BUKRS nor BELNR is within your data record (ASSIGN failed) then you probably should delete this record because it has no meaning for you.
Regards
Uwe
Regards
Uwe
2009 Apr 10 6:38 AM
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |