03-07-2024 3:06 AM - edited 03-07-2024 4:57 AM
Hi, currently I was able to display the 1 sales document to related to my material. But there were multiple sales document related to my material.
This is my current logic:
it_output - this contains the material number. Sales document will be mapped on the loop.
Material | Sales Document |
1800 | |
7107 |
it_salesdoc - this contains the sales document which will be used for mapping.
Material | Sales Document |
1800 | 123456 |
1800 | 789010 |
1800 | 111213 |
7107 | 571234 |
7107 | 888123 |
7107 | 7741312 |
LOOP AT it_output INTO ls_output
DATA(lv_so) = VALUE #( it_salesdoc [ matnr = ls_output-matnr ]-vbeln ).
ls_output-vbeln = lv_so.
MODIFY it_output FROM ls_output TRANSPORTING vbeln WHERE matnr = ls_output-matnr.
ENDLOOP.
Current display is this:
Material | Sales Document |
1800 | 123456 |
7107 | 571234 |
Can I display it something like this?
Material | Sales Document |
1800 | 123456 |
1800 | 789010 |
1800 | 111213 |
7107 | 571234 |
7107 | 888123 |
7107 | 7741312 |
Yes it is possible, you need use conditional loop to search all sales orders related to the material number, use append statement to add all related records once finished use Modify statement otherwise your internal tale it will keep one record only (your current scenario)
example logic using 2 loops:
Loop AT it_output INTO WA_it_output
LOOP AT it_salesdoc WHERE ( matnr = WA_it_output-matnr ) INTO wa_it_salesdoc_final
APPEND wa_it_salesdoc to it_salesdoc_final.
ENDLOOP.
ENDLOOP.
MODIFY it_salesdoc_final.
You may achieve the same result with different approach you are not limited to the above.
Please reward if it was helpful.
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
101 | |
14 | |
10 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.