cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with Condition Type in BAPI_QUOTATION_CREATEFROMDATA2 for Txn VA21

Former Member
0 Kudos

Hi All,

I am using BAPI_QUOTATION_CREATEFROMDATA2 for Sales Quotation by txn VA21.

In this txn,There are 22 condition types available in my system.

The problem is,it is updating every condition type twice.

Pls give me the solution.

Regards,

Shiv Kant

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Use Debugging before to start the BAPI , then check how many values are passing to the condition internal table,

use flag variables to solve that issue.

Regards

Former Member
0 Kudos

Hi Sekhar,

Thanks for Reply.

Can you Pls give me sample code for this threat.

Regards,

Shiv Kant

Former Member
0 Kudos

Hi,

I am giving billing document code, we are using BAPI to upload billing documents into SAP.

you can check pricing conditions code. we are using only two pricing condition types. our technical consultant hardcoded condition types.

wa_billingdata-salesorg = wa_bill5-sorg.
    wa_billingdata-distr_chan = wa_BILL5-dist.
    wa_billingdata-division = wa_BILL5-div.
    wa_billingdata-doc_type = 'ZSO5'.
    wa_billingdata-ordbilltyp = 'FX'.
    wa_billingdata-bill_date = wa_BILL5-BDATE.
    wa_billingdata-sold_to = wa_BILL5-CUSTNO.
*    wa_billingdata-price_date = WA_BILL1-BDATE.
   wa_billingdata-country = wa_BILL5-CNTRY.
    wa_billingdata-bill_to = wa_BILL5-custno.
    wa_billingdata-currency = WA_BILL5-CURR.
    wa_billingdata-wbs_elem = wa_bill5-wbsele.
    wa_billingdata-xblnr = wa_bill5-billno.
    wa_billingdata-zuonr = wa_bill5-invoiceno.
flag1 = 1.
endif.
translate wa_bill5-matdesc to upper case.
    SELECT MATNR FROM MARA INTO IT_MARA  up to 1 rows WHERE MATNR = WA_BILL5-MATDESC.
            endselect.
    if sy-subrc = 0.
      wa_billingdata-plant = wa_BILL5-PLANT.
      wa_billingdata-NO_MATMAST = ' '.
      wa_billingdata-material = WA_BILL5-MATDESC.
      wa_billingdata-REQ_QTY = '1'.
      wa_billingdata-ACCTASGNMT = '05'.
   else.
       wa_billingdata-ACCTASGNMT = '05'.
       wa_billingdata-NO_MATMAST = 'X'.
       wa_billingdata-SHORT_TEXT = 'ADAGE MATERIAL'.
       wa_billingdata-TAXCL_1MAT = '0'.
       wa_billingdata-SALES_UNIT = 'EA'.
       wa_billingdata-material = WA_BILL5-MATDESC.
       wa_billingdata-REQ_QTY = '1'.
   endif.
flag = flag + 1.
    wa_billingdata-ref_item = flag.
    append wa_billingdata to billingdata.
    wa_conditiondata-data_index = flag.
     wa_CONDITIONDATA-cond_value = WA_BILL5-ADVERTISCOST.
    wa_conditiondata-cond_type = 'EK01'.
    append wa_conditiondata to conditiondata.
clear wa_conditiondata.
    wa_conditiondata-data_index = flag.
     wa_conditiondata-cond_value = WA_BILL5-COMM.
    wa_conditiondata-cond_type = 'ZCOM'.
    append wa_conditiondata to conditiondata.
clear wa_conditiondata.
IF TESTRUN IS INITIAL.
 move-corresponding wa_bill5 to wa_bill2.
wa_bill2-status = 'P'.
append wa_bill2 to it_bill2.
modify zzbilling from table it_bill2.
commit WORK.
ENDIF.
REFRESH IT_BILL2.
endloop.
flag1 = 0.
flag = 0.
IF TESTRUN IS INITIAL.
 CALL FUNCTION 'BAPI_BILLINGDOC_CREATEMULTIPLE'
*   EXPORTING
*     CREATORDATAIN         = creaord
*     TESTRUN               = 'X'
*     POSTING               = 'X'
    TABLES
     BILLINGDATAIN         =  billingdata
     CONDITIONDATAIN       =  conditiondata
*     CCARDDATAIN           =
*     TEXTDATAIN            =
*     ERRORS                =
      RETURN                = bapiret
      SUCCESS               = succ.

Regards,

Chandra

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi All,

Still I am not able to resolve this problem.

Pls give me exact solution.

Regards,

Shiv Kant

Former Member
0 Kudos

Please check SAP note 574088 Point 7.