ABAP dynamically acquires data

Source: Internet
Author: User

Dynamic Data Acquisition Method

 

Implementation of ABAP dynamic query: it can fully implement dynamic query, and each field can be dynamic.

(1) Use macros

(2) Use the ABAP pointer

(3) Use Field-Symbol

Specific implementation:

1. structure dynamic query

Define select_data_to_wa.

Select & 1

From & 2

Into corresponding fields of & 3

Where (& 4 ).

Exit.

Endselect.

End-of-definition.

2. dynamic query of Variables

Define select_data_to_variant.

Select & 1

From & 2

Into & 3

Where (& 4 ).

Exit.

Endselect.

End-of-definition.

3. dynamic query of internal tables

Define select_data_to_variant.

Select & 1

From & 2

Into corresponding fields of Table & 3

Where (& 4 ).

Exit.

Endselect.

End-of-definition.

 

 

Specific program implementation:

 

Code

Data: Maid (100) type C,

Rochelle table (10) type C,

Rochelle cond (100) type C.

Data: I _cond type talbe of l_cond.

Field-Symbols <FS> Type any.

 

Start-of-selection.

Concatenate 'carrid' 'connid' 'cityfrom'

Into l_s

Separate by space.

Concatenate 'connid = '''' 0123'''' Into l_cond.

Append cond to I _cond.

Rochelle table = 'spfli '.

If <FS> Is assigned.

Unassign <FS> .

Assign spfli to <FS>.

Else.

Assign spfli to <FS>.

Endif.

 

Select_data_to_wa (l_s) (l_table) <FS> I _cond.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.