{"id":1490,"date":"2016-04-06T14:36:38","date_gmt":"2016-04-06T13:36:38","guid":{"rendered":"http:\/\/oprsteny.cz\/?p=1490"},"modified":"2016-04-06T14:36:38","modified_gmt":"2016-04-06T13:36:38","slug":"abap-parsing-vakey-in-sd-pricing-conditions","status":"publish","type":"post","link":"https:\/\/oprsteny.cz\/?p=1490","title":{"rendered":"ABAP &#8211; Parsing VAKEY in SD pricing conditions"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"358\" data-permalink=\"https:\/\/oprsteny.cz\/?attachment_id=358\" data-orig-file=\"https:\/\/oprsteny.cz\/wp-content\/uploads\/SAP.jpg\" data-orig-size=\"44,50\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;Picasa&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1365690880&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;}\" data-image-title=\"SAP\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/oprsteny.cz\/wp-content\/uploads\/SAP.jpg\" class=\"alignleft size-full wp-image-358\" src=\"http:\/\/oprsteny.cz\/wp-content\/uploads\/SAP.jpg\" alt=\"SAP\" width=\"44\" height=\"50\" \/>It is possible to\u00a0parse VAKEY (100 chars) field to separated key fields manually, knowing the structure of each condition table (A004, A055, &#8230;). <!--more--><\/p>\n<p>But there much easier way: Function modules to generate VAKEY (a key for condition tables KONH &#8211; condition headers, KONP &#8211; condition details, KONM &#8211; quantity scale, KONW &#8211; value scale) and vice versa &#8211; parse key fields from given VAKEY knowing the condition table name.<\/p>\n<pre lang=\"abap\">DATA:\r\n\u00a0\u00a0ls_komg\u00a0\u00a0\u00a0\u00a0TYPE\u00a0komg,\u00a0\u00a0\u00a0\u00a0\u00a0\"\u00a0Allowed\u00a0Fields\u00a0for\u00a0Condition\u00a0Structures\r\n\u00a0\u00a0lv_vakey_1\u00a0TYPE\u00a0vakey\u00a0VALUE\u00a0'106002B1050000\u00a01097631S50',\r\n\u00a0\u00a0lv_vakey_2\u00a0TYPE\u00a0vakey.\r\n\r\n*\u00a01.\u00a0Get\u00a0key\u00a0fields\u00a0for\u00a0given\u00a0VAKEY\u00a0and\u00a0condition\u00a0table\r\nCALL\u00a0FUNCTION\u00a0'SD_CONDITION_KOMG_FILL'\r\n\u00a0\u00a0EXPORTING\r\n\u00a0\u00a0\u00a0\u00a0p_kotabnr\u00a0=\u00a0'005'\u00a0\u00a0\u00a0\"table\u00a0name\u00a0is\u00a0A005 (here we use '005')\r\n\u00a0\u00a0\u00a0\u00a0p_kvewe\u00a0\u00a0\u00a0=\u00a0'A'     \"table\u00a0name\u00a0is\u00a0A005 (here we use 'A')        \r\n\u00a0\u00a0\u00a0\u00a0p_vakey\u00a0\u00a0\u00a0=\u00a0lv_vakey_1\r\n\u00a0\u00a0IMPORTING\r\n\u00a0\u00a0\u00a0\u00a0p_komg\u00a0\u00a0\u00a0\u00a0=\u00a0ls_komg.\r\n\r\n*\u00a02.\u00a0Get\u00a0VAKEY\u00a0from\u00a0given\u00a0key\u00a0fields\u00a0and\u00a0condition\u00a0table\r\nCALL\u00a0FUNCTION\u00a0'SD_CONDITION_VAKEY_FILL'\r\n\u00a0\u00a0EXPORTING\r\n\u00a0\u00a0\u00a0\u00a0p_kotabnr\u00a0=\u00a0'005'\r\n\u00a0\u00a0\u00a0\u00a0p_kvewe\u00a0\u00a0\u00a0=\u00a0'A'\r\n\u00a0\u00a0\u00a0\u00a0p_komg\u00a0\u00a0\u00a0\u00a0=\u00a0ls_komg\r\n\u00a0\u00a0IMPORTING\r\n\u00a0\u00a0\u00a0\u00a0p_vakey\u00a0\u00a0\u00a0=\u00a0lv_vakey_2.\r\n\r\n*\u00a0Just\u00a0verify\u00a0that\u00a0generated\u00a0VAKEY\u00a0is\u00a0equal\u00a0to\u00a0the\u00a0original\u00a0VAKEY\r\nIF\u00a0lv_vakey_1\u00a0=\u00a0lv_vakey_2.\r\n\u00a0\u00a0WRITE\u00a0'OK'.\r\n\r\nENDIF. \r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>It is possible to\u00a0parse VAKEY (100 chars) field to separated key fields manually, knowing the structure of each condition table (A004, A055, &#8230;).<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"ABAP - Parsing VAKEY in SD pricing conditions","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[16,9,390,389],"tags":[446,466,465,464],"class_list":["post-1490","post","type-post","status-publish","format-standard","hentry","category-abap","category-development","category-sales-distribution","category-sap","tag-abap","tag-sd_condition_komg_fill","tag-sd_condition_vakey_fill","tag-vakey"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p3nYbe-o2","jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/oprsteny.cz\/index.php?rest_route=\/wp\/v2\/posts\/1490","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/oprsteny.cz\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/oprsteny.cz\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/oprsteny.cz\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/oprsteny.cz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1490"}],"version-history":[{"count":1,"href":"https:\/\/oprsteny.cz\/index.php?rest_route=\/wp\/v2\/posts\/1490\/revisions"}],"predecessor-version":[{"id":1491,"href":"https:\/\/oprsteny.cz\/index.php?rest_route=\/wp\/v2\/posts\/1490\/revisions\/1491"}],"wp:attachment":[{"href":"https:\/\/oprsteny.cz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1490"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/oprsteny.cz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1490"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/oprsteny.cz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1490"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}