Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

bdc program for sales order(VA01)

Former Member
0 Kudos

hello everyone,

i am new on abap programming.so i am facing problem to make bdc program

my requirement is i want to create bdc program for sales order(VA01) in which i want to make updates in amount field(kbetr) only but there is one condition where condition type is 'PR00' that amount only i want to change. as condition type stores in knov table

so i declared one variable

Data : c_val type konv-kschl.

and give default value as PR00

and add if condition:

IF C_VAL EQ 'PR00'.
perform bdc_dynpro using 'SAPMV45A' '0101'.
perform bdc_field using 'BDC_CURSOR'
'VBAK-AUART'.
perform bdc_field using 'BDC_OKCODE'
'=COPY'.
perform bdc_field using 'VBAK-AUART'
WA_FINAL-AUART."'ZSUP'.
perform bdc_field using 'VBAK-VKORG'
WA_FINAL-VKORG."'1000'.
perform bdc_field using 'VBAK-VTWEG'
WA_FINAL-VTWEG."'10'.
perform bdc_field using 'VBAK-SPART'
WA_FINAL-SPART."'10'.
perform bdc_dynpro using 'SAPLV45C' '0100'.
perform bdc_field using 'BDC_OKCODE'
'=UEBR'.
perform bdc_field using 'BDC_CURSOR'
'VBRK-VBELN'.
perform bdc_field using 'VBRK-VBELN'
WA_FINAL-VBELN."'100332'.
perform bdc_dynpro using 'SAPMV45A' '4001'.
perform bdc_field using 'BDC_OKCODE'
'=T\01'.
perform bdc_field using 'KUAGV-KUNNR'
'M0023'.
perform bdc_field using 'KUWEV-KUNNR'
'M0023'.
perform bdc_field using 'VBKD-FKDAT'
'07.12.2017'.
perform bdc_field using 'VBKD-FBUDA'
'05.12.2017'.
perform bdc_field using 'VBKD-PRSDT'
'05.12.2017'.
perform bdc_field using 'BDC_CURSOR'
'RV45A-MABNR(02)'.
perform bdc_dynpro using 'SAPMV45A' '4001'.
perform bdc_field using 'BDC_OKCODE'
'=ITEM'.
perform bdc_field using 'KUAGV-KUNNR'
'M0023'.
perform bdc_field using 'KUWEV-KUNNR'
'M0023'.
perform bdc_field using 'VBKD-PRSDT'
'05.12.2017'.
perform bdc_field using 'VBAK-AUGRU'
'200'.
perform bdc_field using 'VBKD-FKDAT'
'07.12.2017'.
perform bdc_field using 'VBKD-FBUDA'
'05.12.2017'.
perform bdc_field using 'BDC_CURSOR'
'VBAP-POSNR(01)'.
perform bdc_field using 'RV45A-VBAP_SELKZ(01)'
'X'.
perform bdc_dynpro using 'SAPMV45A' '4003'.
perform bdc_field using 'BDC_OKCODE'
'=T\05'.
perform bdc_field using 'BDC_CURSOR'
'VBAP-ZMENG'.
perform bdc_field using 'VBAP-ZMENG'
' 2'.
perform bdc_field using 'VBAP-ZIEME'
'NOS'.
perform bdc_field using 'VBAP-UMZIN'
' 1'.
perform bdc_field using 'VBAP-UMZIZ'
' 1'.
perform bdc_field using 'VBKD-PRSDT'
'05.12.2017'.
perform bdc_dynpro using 'SAPMV45A' '5003'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'KOMV-KBETR(01)'.
perform bdc_field using 'KOMV-KBETR(01)'
WA_FINAL-KBETR."' 45'.
perform bdc_dynpro using 'SAPMV45A' '5003'.
perform bdc_field using 'BDC_OKCODE'
'=SICH'.
perform bdc_field using 'BDC_CURSOR'
'KOMV-KSCHL(01)'.

ENDIF.

i want to give condition like this way but i know this is not correct way so i need help

please help me.

thanks and regards

6 REPLIES 6

VeselinaPeykova
Active Contributor

I am not a developer, but why do you need a BDC to update pricing?

Condition adjustment (per sales document) can be done via BAPIs, and in general the possibility to modify prices depends on customizing and document status among other factors, which means that you need to check carefully the documents that you are trying to update.

Also it is a strange decision to use BDC or a custom program if all you need is to update base price per document - if incorrect price was applied to multiple orders that are not yet processed the business/pricing experts usually adjust the condition itself and reprice the orders - no development effort is needed for that.

This is normally the procedure in many companies because the amount for PR00 is often not modifiable via VA02.

And you mentioned KSCHL, which is the condition type, but you speak about amounts - these are different things and are controlled by different settings in configuration.

Edit: you also mention VA01 (create), which makes even less sense - there are many ways to create orders and qualified SD consultants know that it is technically possible to influence prices via configuration, exits, routines... Developers use BDC as a last resort, but from your explanation I saw no specific constraints that require BDC.

0 Kudos

Thank you for your answer but they want me to make BDC program and sorry for my mistakes i put wrong fields now i make correction in it. and i still not found any solution for it.

0 Kudos

The most reasonable approach is to explain to the person insisting on a BDC for sales order creation with additional price change that BDC is not a good solution and to suggest better alternatives.

And it is also a good idea to ask the requester why this program for creating sales orders is needed in the first place and why one has to specify the base price manually instead of using pricing conditions.

Former Member
0 Kudos

yes one of functional consultant made recording in shdb for VA01 transaction code but i dont know how to give condition for price 'pr00' and update amount field only.

Former Member
0 Kudos

Yes one of functional consultant made recording for VA01 transaction in shdb. even i import that recording in program but i dont know how to apply required condition inside program

Former Member

Vaselina is right, Check fisrt for solution through customization.

Now if you cannot do this by customization and you have to do the changes then better go for Custo report using BAPI.

BDC is not a good option for Order creation or change.

And I think you want to do changes in VA02 rather for VA01?