on 06-28-2023 10:11 AM
Hi Experts,
I have below code:
LOOP AT it_sales ASSIGNING <ls_sales>.
customer-sales_arrangement =
VALUE #( BASE customer-sales_arrangement
( partner_functions = VALUE #( FOR <ls_pf> IN it_price WHERE ( vkorg = <ls_sales>-vkorg AND vtweg = <ls_sales>-vtweg AND spart = <ls_sales>-spart )
( party_role_code = <ls_pf>-parvw
partner_description = <ls_pf>-knref
default_indicator = <fs_pf>-defpa
)
partner_functions_list_complet = COND #( WHEN it_pf IS NOT INITIAL THEN sai_true ELSE sai_false )
).
ENDLOOP.
I filled field partner_functions for it or it may stay empty if no partner fn are supplied for a particular sales area.
Based on partner_functions, I have to set indicator in the next field which will be 0 if partner_functions is empty and 1 if filled.
I there a way to determine if the FOR loop filled partner_funtions, so I can set flag on next field?
Added Question: is there any way to do GROUP BY/CONTROL BREAK(at-endat) inside FOR LOOP? I need this for sales txt.
Regards,
Shailesh
LET ... IN ...
e.g. (in this example, you must define type_partner_functions or rename it to the type you have used for typing customer-sales_arrangement-partner_functions)
LOOP AT it_sales ASSIGNING <ls_sales>.
customer-sales_arrangement = VALUE #(
LET lt_partner_functions = VALUE type_partner_functions(
FOR <ls_pf> IN it_price
WHERE ( vkorg = <ls_sales>-vkorg
AND vtweg = <ls_sales>-vtweg
AND spart = <ls_sales>-spart )
( party_role_code = <ls_pf>-parvw
partner_description = <ls_pf>-knref
default_indicator = <fs_pf>-defpa ) )
IN
BASE customer-sales_arrangement
( partner_functions = lt_partner_functions
partner_functions_list_complet = COND #( WHEN lt_partner_functions IS NOT INITIAL THEN
sai_true
ELSE
sai_false )).
ENDLOOP.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank You very much, this solves my query.
Will try to use LET often now to familiarize better.
User | Count |
---|---|
77 | |
9 | |
8 | |
7 | |
6 | |
6 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.