cancel
Showing results for 
Search instead for 
Did you mean: 

How to create a button in VA22 toolbar that will copy the items from another quotation ?

Hello SAP ABAPers,

I have a request to enhance VA22 transaction with a new button in the application toolbar that will have to raise a pop-up window in which I will introduce a quotation number and then I will copy the items from the inserted quotation number to the displayed quotation number.

I have proceeded below steps:

  1. copy PF-status 'U' into pf-status 'ZZ1' from prog SAPMV45B into Z* prog and add my button, than Activate
  2. Into PAI module of screen 4001 in program SAPMV45A, I create an implicit enhancement Z* at the end of the routine CUA_SETZEN with the below code where I am using the pf-status created above:

if sy-tcode = 'VA22' and SY-DYNNR = '4001'.
set PF-STATUS 'ZZ1' OF PROGRAM 'ZTSTGUI'.

endif.

3. Create an enhancement Z* into PBO module of screen 4001 in program SAPMV45A, module FCODE_BEARBEITEN, and code the functionality here (raise pop-up, get value and call bapi BAPI_QUOTATION_GETDETAILBOS to get the items of the inserted quotation and call bapi BAPI_CUSTOMERQUOTATION_CHANGE for updating my quotation .


Should you please check my steps and advice me where am I wrong ? Why the pf-status is not identical with the old pf-status even if I have copied the correct pf-status ? (now i have more buttons) Why the BAPI for QUOTATION_CHANGE is returning error V1 - 045 - "Insert document number" , even if the input values and tables were maintained correctly ?

Can you give your opinion regarding the requirement of copying items from a different quotation into another is feasible and that it will not affect the SAP standard ?

Thank you,

Andreea

Accepted Solutions (1)

Accepted Solutions (1)

Lakshmipathi
Active Contributor
0 Kudos
Can you give your opinion regarding the requirement of copying items from a different quotation into another is feasible


Whether the answer is feasible or not - it is immaterial. My question is why you have not considered clubbing multiple quotations into one sale order which is standard functionality ? Needless to mention copying data from one quotation to another one is definitely not a Best Practice. In fact, tell me how the system should behave in case the header data / item data, in Quotation-1 differs in Quotation-2 ?

0 Kudos

Hi Mr. Lakshmipathi,

User wil be aware of how to use this new functionality and will copy items from a proper quotation. Also, option "Create with reference" is working only once per quotation, therefore it's justified why they asked for this similar requirement that shall work as many times they will need to copy items from a quotation to another.

thanks,

Andreea

Answers (1)

Answers (1)

rajkumarnarasimman
Active Contributor
0 Kudos

Hi Andrea,

Issue1:

"Why the pf-status is not identical with the old pf-status even if I have copied the correct pf-status ?

When you are calling the PF-STATUS statement make sure to exclude the unnecessary buttons like below. Check the standard PF-STATUS code and use the same internal table.

if sy-tcode = 'VA22' and SY-DYNNR = '4001'.

set PF-STATUS 'ZZ1' OF PROGRAM 'ZTSTGUI' EXCLUDING EXTAB[].

endif.

Issue2:

"Why the BAPI for QUOTATION_CHANGE is returning error V1 - 045 - "Insert document number" 

Error clearly showed the document number is not inserted. Place the breakpoint and Debug it.

I don't understand one thing, you are writing the code inside VA22 enhancement, and using BAPI to change quotation which is not at all required.

Regards

Rajkumar Narasimman

0 Kudos

Hi Mr. Narasimman,

Issue 1 really helped me to have a similar pf-status.

Related to Issue 2, I've realized that the best approach is to create a Z program and submit it in the PBO screen when the new FCODE is triggered. Inside my Z program I can to proceed with the items creation using BAPI and afterwards call transaction VA22 .

Here is a discussion with a similar requirement, just that this example is getting the positions from an imported file

https://archive.sap.com/discussions/thread/3366708?db=5

Thank you very much,

Andreea