Skip to Content
Author's profile photo Tanmay Verma

Add line items automatically in VA01 – Sales Order Create

Add a line item automatically when a user clicks on save to sales order in VA01

Limitations:

There is a long list of user-exits present in SD module that facilitate customization to the standard process. However, no User exits , Customer Exits or BADI’s have been provided which can add an item automatically to Sales Order.

Expectations:

To add an item manually in a SO the only input required from the user is the material number and quantity. Rest all the information is determined automatically by the standard code.The automatic addition of item should take care of below points.

      • The only required input should be material number and quantity.
      • Item number ( VBAP-POSNR ) should be auto determined.
      • Item category and other item details should be read from master data / configuration tables.
      • Schedule line data to be determined as for a normal manually added item.
      • Pricing should be determined automatically.
      • Any code written in user exits should be triggered for this item as well.

Approach Followed:


We will be using  USEREXIT_MOVE_FIELD_TO_VBAK to write our code. This userexit is present in include MV45AFZZ of program SAPMV45A.

This user exit is used to transfer some fields to the sales order header.However , we will write our code in this exit to add an item during save.

Code:

*–Check if the user has pressed SAVE button

IF syucomm EQ ‘SICH’.

 

*–Read table XVBAP to check if the material is not already added

           READ TABLE xvbap INTO ls_xvbap WITH KEY matnr = 000000000000240000

                                                     updkz = ‘I’.

           IF sysubrc NE 0.

             CLEAR: vbap.

*–Initialize workareas for VBAP and VBEP


             PERFORM vbap_unterlegen(sapfv45p).

             PERFORM vbep_unterlegen(sapfv45e).

*–Populate material number and quantity

             vbapmatnr     = ‘000000000000240000’.

             rv45akwmeng   = 1000.

*–Call standard performs to populate material details.

*–Perform for material validations and details

             PERFORM vbapmatnr_pruefen(sapfv45p) USING charx sysubrc.

*–Perform for item category determination. This will take care of substitution items if any for this material.

             PERFORM vbappstyv_pruefen(sapfv45p).

*–Perform for filling VBAP with default values from configuration and master tables

             PERFORM vbap_fuellen(sapfv45p).

             PERFORM vbapmatnr_null_pruefen(sapfv45p).

             PERFORM vbepwmeng_setzen(sapfv45e).

*–Perform to check sales unit

             PERFORM vbapvrkme_pruefen(sapfv45p) USING charx

                   CHANGING sysubrc symsgid symsgty symsgno

                            symsgv1 symsgv2 symsgv3 symsgv4.

*–Perform to update VBAP values

             PERFORM vbap_bearbeiten(sapfv45p).

*–Perform for filling VBEP with default values. This will take care of schedule lines of the item

             PERFORM vbep_fuellen(sapfv45e).

*–Perform to check quantity

             PERFORM vbepwmeng_pruefen(sapfv45e) USING charx

                   CHANGING sysubrc symsgid symsgty symsgno

                            symsgv1 symsgv2 symsgv3 symsgv4.

*–Perform to update VBEP values

             PERFORM vbep_bearbeiten(sapfv45e).

*–Perform to fill conditions and pricing data

             PERFORM vbap_bearbeiten_ende(sapfv45p).

           ENDIF.

         ENDIF.

Execution Snapshots:

Go to VA01 to create a sales order. Enter sold to party and other details. Add 1 item manually.

/wp-content/uploads/2015/06/1_716346.png

Click on save, item 240000 should be item as next item ( POSNR 20 ).


/wp-content/uploads/2015/06/2_716347.png

Check the SO in VA03. Here the item 20 is added successfully.


/wp-content/uploads/2015/06/3_716397.png



Check line item schedule line data:


/wp-content/uploads/2015/06/4_716398.png

Check Pricing data:

/wp-content/uploads/2015/06/5_716399.png

Thus , we see in this way a line item can be added automatically in the sales order.

Advantages:

  • The item addition can be done on the basis of certain conditions and multiple items can be added by placing this code in a loop.
  • Since all standard performs are called to fill the data , even the different user-exits for item will be triggered if implemented for the item.
  • By adding a check for call_bapi equal to ‘X’ and TRTYP eq ‘H’ , this code can be executed from Create Sales Order BAPI also.
  • Item number is determined automatically.
  • Item category , item substitution, scheduling , availability check and pricing is done by standard performs.
  • If the requirement is to add items just as the user enters the header details, that can be done with minimum code changes.

Use Cases:

This can be used in certain business scenarios like:

  • Suppose based on the customer some free items need to be added to sales order. In such case the item ( material ) and customer combination can be stored in a custom table. It can be then read from and populated automatically.
  • It can also be used if some default material has to be added to all sales orders being created.

EDIT:


  • The above code can also be written in user exit  USEREXIT_SAVE_DOCUMENT_PREPARE.


  • Sometime the requirement can be to delete a line item internally using code.Below is the code for this

        Suppose we want  to delete the item number 20.


        ivbap-selkz = ‘X’.

        MODIFY ivbap TRANSPORTING selkz WHERE posnr = ‘0020’.

        IF sy-subrc EQ 0.

          PERFORM xvbap_loeschen_loop(sapfv45p).

        ENDIF.



Help Taken from below SCN posts:


Re: New line  in SD order

Re: Adding default line items on VA01/VA21 based on Incoterms




Note:


Sensitive data has been blurred in the snapshots.

Feel free to provide feedback and valuable comments.

  • ~ Tanmay

Assigned tags

      48 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Athreya Ramakrishna Hegde
      Athreya Ramakrishna Hegde

      very useful ūüôā

      Author's profile photo Former Member
      Former Member

      useful information.

      Author's profile photo Former Member
      Former Member

      Excellent piece of Information.Very helpful

      Author's profile photo R Sampath Kumar
      R Sampath Kumar

      nice document.kindly explain in which business scenario it will be useful.

      Author's profile photo Tanmay Verma
      Tanmay Verma
      Blog Post Author

      Hi Sampath,

      This can be used in certain business scenarios like:

      • Suppose based on the customer some free items need to be added to sales order. In such case the item ( material ) and customer combination can be stored in a custom table. It can be then read from and populated automatically.
      • It can also be used if some default material has to be added to all sales orders being created.

      Regards,

      Tanmay.

      Author's profile photo Priyaranjan Gupta
      Priyaranjan Gupta

      Very useful information.nicely explained.

      Author's profile photo Former Member
      Former Member

      Hi,

      useful informations.

      Thanks & Best Regards,

      Mohd Fakruddin.

      Author's profile photo Juwin Pallipat Thomas
      Juwin Pallipat Thomas

      This information was already present in Re: New line  in SD order and Re: Adding default line items on VA01/VA21 based on Incoterms

      Thanks,

      Juwin

      Author's profile photo Tanmay Verma
      Tanmay Verma
      Blog Post Author

      Hi Juwin ,

      Thanks for posting the links. I had taken help from SCN posts for achieving my requirement but now was not able to find these posts  again whil creating the document.

      I will add these 2 links in the document as acknowledgement.

      ~Tanmay.

      Author's profile photo Jyoti Prakash
      Jyoti Prakash

      Hi,

      If you propose to hard coding the material values in your enhancement program. Then we can achieve the same result with Standard BOM functionality(when different materials for both items are determined) and free goods determination (when same material are determined in the line items). That to be without adding a single code/enhancement.

      What is the gist of this enhancment, when we can achieve the same functionality with enhancement?

      Thanks, JP

      Author's profile photo Tanmay Verma
      Tanmay Verma
      Blog Post Author

      Hi Jyoti,

      The hard coding showed in the document was only for example. In actual scenario we maintain a custom table having material number , customer and quantity of material. The material is then read on the basis of customer and the quantity to be added is calculated based on certain calculations. This item is then finally added using the above approach during SO creation.

      At the same time the custom table is updated with the quantity added so as to keep track of the quantity left.

      Also , the table provides the facility to:

      • switch off the material for a customer and replace it with new material
      • not adding the material if the quantity is exhausted
      • adding multiple materials for same customer. ( more then 1 material can be added to SO)

      we can achieve the same result with Standard BOM functionality(when different materials for both items are determined) and free goods determination (when same material are determined in the line items).

      I am not fully aware of the BOM functionality. Can we make the material and quantity determination dynamic using this ?

      ~Tanmay.

      Author's profile photo Jyoti Prakash
      Jyoti Prakash

      Hi Tanmay,

      Before proposing this solution to the business, did you take consent of your functional consultant for logistics?

      - material is then read on the basis of customer and the quantity basis of customer and the quantity to be added is calculated based on certain calculations

      - switch off the material for a customer and replace it with new material

      - not adding the material if the quantity is exhausted

      - adding multiple materials for same customer. ( more then 1 material can be added to SO

      Unfortunately, whatever you have mention above, can be achieved through standard configuration mention by me in my previous post. And that to be dynamically.

      Probably, you can talk to a functional consultant(SAP SD) in your team or you can search and read regarding BOM/Free Goods determination functionality.

      Thanks, JP

      Author's profile photo Tanmay Verma
      Tanmay Verma
      Blog Post Author

      Hi Jyoti ,

      Thanks for the insight on the topic. I would certainly explore on this more.

      As per the solution, it was discussed with the SD consultant. The table approach that we used was being used for other functionalities also apart from just adding the line item and since the table was being maintained by users directly who might not have knowledge of SD configurations, it was done in this way.

      Thanks,

      Tanmay.

      Author's profile photo Jyoti Prakash
      Jyoti Prakash

      Hi

      It's straight, enhancement has its own pros & cons. And enhancement is not at all advisable when you have standard functionality available. But, well-being of system Is consultant's priority and responsibility.

      If users starts dominating the system configuration. Then why would they need Consultant or Consulting Service provider/partner. Moreover, those are basic SAP SD standard functionality.

      who might not have knowledge of SD configurations

      Strange! By the way, which industry your user belong to?

      Thanks, JP

      Author's profile photo Tanmay Verma
      Tanmay Verma
      Blog Post Author

      Hi ,

      The end users belong to the supply chain industry and accessing the system through web interface / portal applications.

      ~Tanmay

      Author's profile photo Jyoti Prakash
      Jyoti Prakash

      Hi Tanmay,

      The discussion going between us is not to discourage you or find fault. And I appreciate the way you have assertively handled my queries/concerns.

      Functionally? Content may not be convincing to me. But, I can't ignore the way content is represented. It is good and systematic documentation. Probably, you can have

      1. numbering to the title

      2. table of content

      3. Code can be represented in different font (say, courier new)

      .

      Whether user uses SAP System in foreground or background. Basic and standard feature/functionality available in the system should not be ignored. Instead of opting for enhancement.

      Best wishes.

      Cheers, JP

      Author's profile photo Tanmay Verma
      Tanmay Verma
      Blog Post Author

      Hi Jyoti,

      Thanks a lot for your suggestions and pointing in the right direction. The discussion was definitely a good learning for me. ūüôā   Even , i believe in what you said and try to make use of the standard functionality and go for enhancements unless its the last option.

      I will explore the BOM / free good configs and see how that can be used.

      Thanks.

      Tanmay.

      Author's profile photo Juwin Pallipat Thomas
      Juwin Pallipat Thomas

      Hi Jyothi,

      We had to use this kind of enhancement when we had to add Freight cost to the order.

      Thanks,

      Juwin

      Author's profile photo Jyoti Prakash
      Jyoti Prakash

      Hi Juwim,

      Can you explain your requirement for which did the similar enhancement?

      Thanks, JP

      Author's profile photo Juwin Pallipat Thomas
      Juwin Pallipat Thomas

      Whenever the order value was lower than a minimum value, we had to add a fixed surcharge to the order. So, we added a new line to the order, using a service material, to add the fixed value.

      Thanks,

      Juwin

      Author's profile photo Jyoti Prakash
      Jyoti Prakash

      Hi Juwin,

      I assume fixed surcharge is for the whole sales doc that means it's a header condition. So, why that is taken item level and that to be as service material?

      Thanks, JP

      Author's profile photo Juwin Pallipat Thomas
      Juwin Pallipat Thomas

      Hi Jyoti, Please see details here Fixed Surcharge on Orders below minimum value.Thanks, Juwin

      Author's profile photo Bruno Esperança
      Bruno Esperança

      It's funny how sometimes you learn just as much or even more from the discussions than from the original post.

      Thanks so much Juwin.

      And thanks a lot to Tanmay as well for this very helpful post.

      Cheers,

      Bruno

      Author's profile photo RAMA P
      RAMA P

      very much helpful

      Author's profile photo Former Member
      Former Member

      Keep Learning new things tanmay ūüôā   Way to go ūüôā

      Author's profile photo Jobi Sebastian
      Jobi Sebastian

      Hi Tanmay,

      Good document in terms of the structure and presentation. It will be very handy for ABAPErs, if not for SD consultants.

      these kind of requirements can be met through std configurations in SD, even the additional surcharge for low value orders can be configured in std. its available in std pricing procedure.

      Regards

      Jobi

      Author's profile photo Former Member
      Former Member

      Hi Tanmay,

         Perfect solution, thanks.

      Regards

      Dou

      Author's profile photo Former Member
      Former Member

      Hello Tanmay,

      I have exactly the same requirement within my project :

      In my SD offer, I first need to identify item when material S_ANS is present. Then I need to recreate on item per line in my service order components.

      Based on your guidelines, I developed my exit to create sales order items.

      But although I used all the perform you mentioned, some data from vbap are still not populated what cause problem in SD document flow copy.

      Here is my code in the MOVE_FIELD_TO_VBAK :

      IF ( vbak-auart = 'ZSDH' ) AND ( sy-tcode = 'DP80' ).

          IMPORT w_skip FROM MEMORY ID 'ZSDH_SKIP'.

          CHECK w_skip = abap_false.

          w_perform = abap_false.

      * Check if S_ANS Material is present and delete item

          LOOP AT xvbap INTO ls_xvbap WHERE matnr =  'S_ANS'.

            ls_xvbap-updkz = 'D'.

            w_pstyv = xvbap-pstyv.

            w_perform = abap_true.

            MODIFY xvbap FROM ls_xvbap TRANSPORTING updkz.

          ENDLOOP.

          PERFORM vbap_bearbeiten_ende(sapfv45p).

          IF w_perform = abap_true.

      * Get components information from service order

            SELECT werks bdmng meins potx1 rspos

              FROM resb

              APPENDING CORRESPONDING FIELDS OF TABLE tb_components

              WHERE aufnr = vbap-aufnr

              AND matnr EQ ''.

            IF sy-subrc = 0.

              w_skip = abap_true.

              EXPORT w_skip TO MEMORY ID 'ZSDH_SKIP'.

      * Create one ANS item per component (what DIP cannot do)

              LOOP AT tb_components INTO ls_components.

      *     Fetch last existing item number

                DESCRIBE TABLE xvbap LINES w_lines.

                READ TABLE xvbap INDEX w_lines.

                w_posnr = xvbap-posnr.

      *--Initialize workareas for VBAP and VBEP

                PERFORM VBAP_BEARBEITEN_VORBEREITEN(sapfv45p). "666

                PERFORM vbap_unterlegen(sapfv45p).

                PERFORM vbep_unterlegen(sapfv45e).

                xvbap-posnr = w_posnr + 10.

                xvbap-matnr = 'S_ANS'.

                xvbap-matwa = 'S_ANS'.

                xvbap-arktx = ls_components-potx1.

      * Field EANNR is used to store recording of RESB (required for PREPARE TKOMP)

                xvbap-eannr = ls_components-rspos.

                xvbap-zmeng = ls_components-bdmng.

                xvbap-umzin = ls_components-bdmng / 1000.

                xvbap-umziz = ls_components-bdmng / 1000.

                xvbap-meins = ls_components-meins.

                xvbap-werks = ls_components-werks.

                xvbap-zieme = ls_components-meins.

                xvbap-updkz = 'I'.

                xvbap-spart = '00'.

                xvbap-pstyv = w_pstyv.

                append xvbap.

      *--Call standard performs to populate material details.

      *--Perform for material validations and details

                PERFORM vbap-matnr_pruefen(sapfv45p) USING charx sy-subrc.

      *--Perform for item category determination. This will take care of substitution items if any for this material.

                PERFORM vbap-pstyv_pruefen(sapfv45p).

                 PERFORM VBAP_FUELLEN(sapfv45p).  "666

                 PERFORM VBAP_BEARBEITEN(sapfv45p).  "666

      *--Perform for filling VBAP with default values from configuration and master tables

                PERFORM vbap_fuellen(sapfv45p).

                PERFORM vbap-matnr_null_pruefen(sapfv45p).

                PERFORM vbep-wmeng_setzen(sapfv45e).

      *--Perform to check sales unit

                PERFORM vbap-vrkme_pruefen(sapfv45p) USING charx

                      CHANGING sy-subrc sy-msgid sy-msgty sy-msgno sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

      *--Perform to update VBAP values

                PERFORM vbap_bearbeiten(sapfv45p).

      *--Perform for filling VBEP with default values. This will take care of schedule lines of the item

                PERFORM vbep_fuellen(sapfv45e).

                PERFORM vbep-wmeng_pruefen(sapfv45e) USING charx

                      CHANGING sy-subrc sy-msgid sy-msgty sy-msgno sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

      *--Perform to update VBEP values

                PERFORM vbep_bearbeiten(sapfv45e).

      *--Perform to fill conditions and pricing data

                PERFORM vbap_bearbeiten_ende(sapfv45p).

              ENDLOOP.

              w_pricing_to_update = abap_true.

              EXPORT w_pricing_to_update TO MEMORY ID 'ZSDH_PRICE'.

            ENDIF.

          ENDIF.

        ENDIF.

      It is working but I need to fix many value that are automaticaly populated if I create item manualy. (Like VBAP-KONDM; or KZTLF for example).

      So I assume one standard perform is still missing to commit data at then end.

      Do you have recommendation ?

      Author's profile photo Former Member
      Former Member

      NB : I add recently the line ended with comment "666 to see if it solves my problem but without success.

      Author's profile photo Tanmay Verma
      Tanmay Verma
      Blog Post Author

      Hi  PA,

      Sorry for the late reply.

      The code has to be written in USEREXIT_MOVE_FIELD_TO_VBAK. I can see and extra 'Append XVBAP' in your code. KIndly check if that is causing the issue. As the standard performs will take care of the XVBAP table and no explicit append is required.

      Using the code i have mentioned in the document i was able to successfully create an line item with all the required data.

      Regards,

      Tanmay.

      Author's profile photo Yarnagula Sudhir
      Yarnagula Sudhir

      Hi Tanmay Verma ,

      I'm very impressed with your solution. Thank you for providing to us.

      I'm having similar scenario in my project and I've done it so good and so simple based on your solution.

      Author's profile photo Tanmay Verma
      Tanmay Verma
      Blog Post Author

      Thanks  Yarnagula Sudhir.

      Happy to help. ūüôā

      ~Tanmay

      Author's profile photo Yarnagula Sudhir
      Yarnagula Sudhir

      Hi Tanmay Verma ,

      I have a scenario.

      1. My requirement is to add same material again, but only once.

      2. But your read statement does not allow for same material. (SY-SUBRC NE 0.)

      3. If I excluded read statement logic, as this exit triggers multiple times, my proposed material adding multiple times.

      4. Even though i've gone for count logic, as this exit triggering multiple times, its clearing my count variable on every iteration.

      Kindly let me know the how to resolve my issue. Kindly help me out on priority.

      With Regards,

      Sudhir.

      Author's profile photo Tanmay Verma
      Tanmay Verma
      Blog Post Author

      Hi Sudhir,

      You can declare your count variable as STATIC. This will hold the value during the LUW and will not get cleared out.

      Ex:  Statics: lv_count type i. ( instead of Data: lv_count type i. )

      Regards,

      Tanmay.

      Author's profile photo Yarnagula Sudhir
      Yarnagula Sudhir

      Hi Tanmay Verma ,

      Thanks alot for your reply and solution. Static variable worked.

      But how to make my proposed line item NET and TAX to be ZERO. Functional people maintaining Pricing as Mandatory for proposed Material.

      With Regards,

      Sudhir.

      Author's profile photo Sachin Adak
      Sachin Adak

      Nice one Tanmay !!! ūüôā

      Author's profile photo Former Member
      Former Member

      Really helpful post!!! Thank you so much.

      Author's profile photo Janagar Sundaramoorthy
      Janagar Sundaramoorthy

      Hi tanmay, nice post

      PERFORM vbep‚Äďwmeng_setzen(sapfv45e). this piece of perform is not in the system . what to do any work around.

      Author's profile photo Tanmay Verma
      Tanmay Verma
      Blog Post Author

      Hi Janagar ,

       

      Apologies for the late reply. Can you please let me know the system being used ?

       

      Regards,

      ~Tanmay

      Author's profile photo Former Member
      Former Member

      hi tanmay,

      now i am able to see the code, the following are the issues

      a)i am not able to track down the user status of the current line and copy the same into copied line b) i am passing the price, at komv-kbetr just before PERFORM vbap_bearbeiten_ende(sapfv45p).  it is is not getting into the item.

      Please help with some tips.

      even i tried updating xkomv for the netprice, but it is not happening.

      Regards

      S.Janagar

      Author's profile photo Paul Puvvula
      Paul Puvvula

      Hi Tanmay,

       

      Thanks for this blog. Very useful. I am using the same logic to add lines in the same user exit. However it gives me a syntax error 'The field VBAP-MATNR is unknown'. Did you also get this error ? Many thanks,

      Vijay.

      Author's profile photo Paul Puvvula
      Paul Puvvula

      By the way, I am implementing the logic in an Implicit enhancement instead of changing the Userexit directly.

      Author's profile photo Raj n
      Raj n

      Hi  Tanmay,

      Nice post and its really helpful to me .

      Could you please help me in updating the quantity fields automatically like creation. Actually i am using enhancement spot to populate the items automatically, now my requirement is to change the quantities based on popup. So, i am unable to use the exits as they are triggering at my point.

      Thanks in advance and it would be really helpful if you provide some solution.

       

      Thanks,

      Raj

      Author's profile photo kamalakar Reddy
      kamalakar Reddy

      Hello Tanmay,
      Greetings.
      My requirement is to determine free goods(Inclusive) at material group level instead of line item level and add the free goods line item by with least price material  .I am able to add free goods line item but I am not able to reduce the qty of line item having existing least price materail .Can you please let me know if you have some idea.

      Thanks,

      Kamalakar.

      Author's profile photo Kiran Kumar Panda
      Kiran Kumar Panda

      Hello Tanmay,

      I have a similar requirement where I need to add a new line item dynamically at run time (with material 'VC_AC_PWRC_M_IN' ) if a material is 'VC_AC_PWRC_B_NA' is present in a line item list.

      For example,

      if material 'VC_AC_PWRC_B_NA' is present, then add a new line item with material 'VC_AC_PWRC_M_IN'.

      I have referred the code you have mentioned above, but it is not working.

      Please help ūüôā

       

      Author's profile photo Tanmay Verma
      Tanmay Verma
      Blog Post Author

      Hi Kiran,

      Could you provide more info on the error. Since this blog is 5 year old , i gues if you are using S4H system there might be changes in standard code which might cause issue.

       

      Also , did you look into the possibility of using the standard item substitution ? This looks more like the substitute item requirement.

      https://help.sap.com/doc/1f8ac95360267214e10000000a174cb4/2.6/en-US/e589c95360267214e10000000a174cb4.html

      BR

      Tanmay

      Author's profile photo Kiran Kumar Panda
      Kiran Kumar Panda

      Thanks for prompt reply Tanmay.

      Yes. I am using S4 HANA server.

      Actually the requirement is to add a new line item when the country of Ship To Party(WE) is changed(Header Partner Tab).

      If the changed country is present in the custom table along with an existing material(let‚Äôs say ‚ÄėVC_AC_PWRC_B_NA‚Äô) combination, then add a new line item entry with material ‚ÄėVC_AC_PWRC_M_IN‚Äô.

      I have used user exit 'USEREXIT_MOVE_FIELD_TO_VBAK' under include MV45AFZZ of program SAPMV45A

      Awaiting for your reply ?

      Thank you.

      Author's profile photo Kiran Kumar Panda
      Kiran Kumar Panda

      Hello  Tanmay.

      I am able to add single line item using the code mentioned above. But my requirement is to add multiple materials.

      I have added above code in a loop statement and passing materials accordingly but it is not working.

      Code snippet is as follows : Here subroutine PERFORM¬†vbep_bearbeiten(sapfv45e) ( "*‚ÄďPerform¬†to¬†update¬†VBEP¬†values ) is causing an issue.

       

              LOOP AT lt_zvesper_saleskit ASSIGNING FIELD-SYMBOL(<fs_saleskit>).

      ¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†"*‚ÄďInitialize¬†workareas¬†for¬†VBAP¬†and¬†VBEP
                PERFORM vbap_unterlegen(sapfv45p).
                PERFORM vbep_unterlegen(sapfv45e).

      ¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†"*‚ÄďPopulate¬†material¬†number¬†and¬†quantity
                vbap-matnr = <fs_saleskit>-accessory. "<<--New Material is passing as per loop processing

                rv45a-kwmeng = 2.

      ¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†"*‚ÄďCall¬†standard¬†performs¬†to¬†populate¬†material¬†details.

      ¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†"*‚ÄďPerform¬†for¬†material¬†validations¬†and¬†details
                PERFORM vbap-matnr_pruefen(sapfv45p) USING charx sy-subrc.

      ¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†"*‚ÄďPerform¬†for¬†item¬†category¬†determination.
                "This will take care of substitution items if any for this material.
                PERFORM vbap-pstyv_pruefen(sapfv45p).

      ¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†"*‚ÄďPerform¬†for¬†filling¬†VBAP¬†with¬†default¬†values¬†from
                "configuration and master tables
                PERFORM vbap_fuellen(sapfv45p).

                PERFORM vbap-matnr_null_pruefen(sapfv45p).

                PERFORM vbep-wmeng_setzen(sapfv45e).

      ¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†"*‚ÄďPerform¬†to¬†check¬†sales¬†unit
                PERFORM vbap-vrkme_pruefen(sapfv45p) USING charx
                CHANGING  sy-subrc sy-msgid sy-msgty sy-msgno
                          sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

      ¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†"*‚ÄďPerform¬†to¬†update¬†VBAP¬†values
                PERFORM vbap_bearbeiten(sapfv45p). "<<--Giving issue

      ¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†"*‚ÄďPerform¬†for¬†filling¬†VBEP¬†with¬†default¬†values.¬†This¬†will¬†take¬†care¬†of¬†schedule¬†lines¬†of¬†the¬†item
                PERFORM vbep_fuellen(sapfv45e).

      ¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†"*‚ÄďPerform¬†to¬†check¬†quantity
                PERFORM vbep-wmeng_pruefen(sapfv45e) USING charx
                CHANGING  sy-subrc sy-msgid sy-msgty sy-msgno
                          sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

      ¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†"*‚ÄďPerform¬†to¬†update¬†VBEP¬†values
                PERFORM vbep_bearbeiten(sapfv45e).

      ¬†¬†¬†¬†¬†¬†¬†¬†¬†¬†"*‚ÄďPerform¬†to¬†fill¬†conditions¬†and¬†pricing¬†data
                PERFORM vbap_bearbeiten_ende(sapfv45p).
              ENDLOOP.

       

      Please help. ?