SD-reference structure and Reference Field Usage code tracking for the storage sequence in the Pricing Process

Source: Internet
Author: User

In SAP's pricing configuration, we often use reference structures and reference fields (condition tables and storage order). How are these fields used, with this curiosity, I read the sap source code (function sd_cond_access) and recorded my understanding for your reference.

Step 1 call the t682z_select sub-process to read from t682z and store the data in sequence to t682z_tab.
Perform t682z_select tables t682z_tab
Using t682i_ I
Changing subrc.
Splice the reference structure and reference fields into the field kommfield of the inner table.
Concatenate t682z_buf-qustr-'t682z_buf-qufna
Into t682z_buf-kommfield.

 

Step 2. In the child routine sel_kondtab, extract the corresponding Field Values of the reference structure based on the reference structure and field names in the storage order.
Assign table field (proto_fld_tab-kommfield) to <F>.
Proto_fld_tab-wert =.

Note: the value of the proto_fld_tab-kommfield, such as: KOMP-PRODH1

 

Step 3 splice query conditions in the child routine sel_kondtab (put in the Table in coding_tab)
* Buffered with wrong value-> replace value
Coding_template-value = proto_fld_tab-wert.
Replace all occurrences of ''' in proto_fld_tab-wert
With ''' in character mode.
Concatenate ''' proto_fld_tab-wert ''' into h_value.
Concatenate <t682z>-zifna '= 'h_value
Into coding_template-line
Separated ''.
Modify coding_template index sy-tabix transporting Value Line.
If first = yes.
First = No.
Coding_tab = coding_template-line.
Else.
Concatenate 'and' coding_template-line into coding_tab
Separated ''.
Endif.
Endif.
Append coding_tab.

Step 4 in the child routine sel_kondtab, query conditions are obtained based on splicing (placed in the coding_tab table) and read condition records are obtained.
Select * from (t681-kotab) appending table <cond_tab>
Up to 1 rows
Where kappl = se_kappl
And kschl = se_kschl
And (coding_tab ).

Note: The t681-kotab for the condition table name such as: a802; coding_tab content see

With this, we can easily understand the use of reference fields and reference structures.

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.