Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
aadizarobi
Explorer

Hello,



I found many of people to face a trouble on quick one to split rows based on Quantity.


In this blog I will discussed how to split row based on Quantity.



Requirement


Let's begin with our learning.

 

Step 1. Create a structure using SE11 Or Create in Program


For full fill your requirement you need to create structure in SE11 or also you can create internal declaration


 

DATA:GT_MAIN               TYPE ZST_SPLIT_QUANTITY,
GT_MAIN_TMP     TYPE ZST_SPLIT_QUANTITY

 

 

Why GT_MAIN_TMP?

When you have a multiple material in your (Result Table i.e below snap) for this you need to create or append a multiple split based on Quantity.

 

Step 2. Write your Query statement to return data into your Result Table.


Result Table:


 

For this you can write a query using (Inline Declaration or INTO CORRESPONDING FIELDS OF TABLE)



 

Step 3. Write your logic.


 
  SORT LT_MAIN_DATA BY MATNR ASCENDING.

  LOOP AT LT_MAIN_DATA INTO DATA(LS_MAIN_DATA).

    "For Iteration

    GT_MAIN_TMP =

       VALUE # (

         FOR J = 1 UNTIL J > LS_MAIN_DATA-MENGE

         (

          MATNR = LS_MAIN_DATA-MATNR

           MAKTX= LS_MAIN_DATA-MAKTX

         )

       ).

    APPEND LINES OF GT_MAIN_TMP TO GT_MAIN.

//This will append a GT_MAIN_TMP to GT_MAIN

*For purpose to move this in GT_MAIN_TMP when For loop run to next item then the previous on is *disappears ( That’s why need to append this to other table.

ENDLOOP.

 

Result:



Result.


 

Conclusion

 

Now you can work on this kindly of requirement easily like this.you can slipt any line based of Quantity

For assigning a value to table must sequence of your fields.

 

For further any query feel free to ask OR share you feed back and query through comment section .

 
1 Comment