cancel
Showing results for 
Search instead for 
Did you mean: 

Create billing document from IDOC INVOIC01

Former Member
0 Kudos

Hi Experts,

I created a function module to extend IDOC_INPUT_INVOIC_MRM. After created successfully the invoice from this inbound idoc, I tried to create a billing document by code below:

          • get sale order number from purchase order *****************************

CALL FUNCTION 'BAPI_PO_GETDETAIL'

EXPORTING

PURCHASEORDER = lw_tfrseg-ebeln

ACCOUNT_ASSIGNMENT = 'X'

TABLES

PO_ITEM_ACCOUNT_ASSIGNMENT = lt_acc_ass

.

*************************************************************************************

****get sale order details*******************************************************

CALL FUNCTION 'BAPISDORDER_GETDETAILEDLIST'

EXPORTING

I_BAPI_VIEW = lw_order_view

  • I_MEMORY_READ =

TABLES

SALES_DOCUMENTS = lt_sales_key

ORDER_HEADERS_OUT = lt_ord_headers

ORDER_ITEMS_OUT = lt_ord_items

ORDER_SCHEDULES_OUT = lt_ord_schedules

ORDER_BUSINESS_OUT = lt_ord_business

ORDER_PARTNERS_OUT = lt_ord_partners

ORDER_ADDRESS_OUT = lt_ord_address

  • ORDER_STATUSHEADERS_OUT =

  • ORDER_STATUSITEMS_OUT =

ORDER_CONDITIONS_OUT = lt_ord_cond

*************************************************************************************

****Fill billing data in*******************************************************

lt_bill_data-SALESORG = lt_ord_headers-sales_org.

lt_bill_data-DISTR_CHAN = lt_ord_headers-DISTR_CHAN.

lt_bill_data-DIVISION = lt_ord_headers-DIVISION.

lt_bill_data-DOC_TYPE = lt_ord_headers-DOC_TYPE.

lt_bill_data-ORDBILLTYP = lt_ord_headers-ORDBILLTYP.

lt_bill_data-BILL_DATE = lt_ord_business-bill_date.

lt_bill_data-SOLD_TO = lt_ord_headers-SOLD_TO.

lt_bill_data-ITEM_CATEG = lt_ord_items-ITEM_CATEG.

lt_bill_data-ACCTASGNMT = lt_ord_business-ACCNT_ASGN.

lt_bill_data-PRICE_DATE = lt_ord_business-PRICE_DATE.

lt_bill_data-COUNTRY = 'US'.

lt_bill_data-PLANT = lt_ord_items-PLANT.

lt_bill_data-BILL_TO = lw_partner_bp-customer.

lt_bill_data-PAYER = lw_partner_py-customer.

lt_bill_data-SHIP_TO = lw_partner_sh-customer.

  • REF_DOC = lt_sales_orders-DIVISION.

lt_bill_data-MATERIAL = lt_ord_items-material.

lt_bill_data-REQ_QTY = lt_ord_items-req_qty.

lt_bill_data-CURRENCY = lt_ord_items-currency.

lt_bill_data-SHORT_TEXT = lt_ord_items-short_text.

lt_bill_data-TAXCL_1MAT = lt_ord_items-TAX_CLASS1.

  • REF_ITEM = lt_sales_orders-DIVISION.

  • STAT_GROUP = lt_sales_orders-DIVISION.

lt_bill_data-NO_MATMAST = 'X'.

lt_bill_data-ADDR_NO = lt_ord_address-ADDRESS.

  • lt_bill_data-TITLE = lt_ord_address-DIVISION.

lt_bill_data-NAME = lt_ord_address-NAME .

lt_bill_data-NAME_2 = lt_ord_address-NAME_2.

lt_bill_data-POSTL_CODE = lt_ord_address-POSTL_CODE.

lt_bill_data-CONSUMCTRY = lt_ord_address-COUNTRY.

lt_bill_data-CITY = lt_ord_address-CITY.

lt_bill_data-DISTRICT = lt_ord_address-DISTRICT.

lt_bill_data-STREET = lt_ord_address-STREET.

lt_bill_data-REGION = lt_ord_address-REGION.

lt_bill_data-PROD_HIER = lt_ord_items-PROD_HIER.

lt_bill_data-SALES_UNIT = lt_ord_items-SALES_UNIT.

lt_bill_data-PROFIT_CTR = lt_ord_items-PROFIT_CTR.

  • TAXJURCODE = lt_sales_orders-DIVISION.

lt_bill_data-PURCH_ORD = lt_ord_headers-PURCH_NO.

lt_bill_data-DOC_NUMBER = lt_ord_items-DOC_NUMBER.

lt_bill_data-ITM_NUMBER = lt_ord_items-ITM_NUMBER.

  • ORIGINDOC = lt_sales_orders-DIVISION.

  • lt_bill_data-ITEM = lt_sales_orders-DIVISION.

lt_bill_data-CREATED_BY = sy-uname.

  • MATERIAL_EXTERNAL = lt_sales_orders-DIVISION.

  • MATERIAL_GUID = lt_sales_orders-DIVISION.

  • MATERIAL_VERSION = lt_sales_orders-DIVISION.

lt_bill_data-INCOTERMS1 = lt_ord_business-INCOTERMS1.

lt_bill_data-INCOTERMS2 = lt_ord_business-INCOTERMS2.

lt_bill_data-EXCHANGE_RATE = lt_ord_business-EXCHG_RATE.

lt_bill_data-PAYMENT_TERMS = lt_ord_business-PMNTTRMS.

lt_bill_data-HG_LV_ITEM = lt_ord_items-HG_LV_ITEM .

*************************************************************************************

******call bapi function to create billing document********************

CALL FUNCTION 'BAPI_BILLINGDOC_CREATEMULTIPLE'

EXPORTING

CREATORDATAIN = lw_creator

TESTRUN = lc_testrun

POSTING = lc_posting

TABLES

BILLINGDATAIN = lt_bill_data

  • CONDITIONDATAIN =

  • CCARDDATAIN =

  • TEXTDATAIN =

ERRORS = lt_bill_errs

RETURN = lt_bill_retu

SUCCESS = lt_bill_succ

*********************************************************************************

A return message in the table lt_bill_retu:

"This item is not relevant for billing!"

Anyone can tell me why? I think this problem be generated from the step "fill billing data" but I don't know where.

Pls help me!!!

Thanks,

Gy

Accepted Solutions (1)

Accepted Solutions (1)

prabhu_s2
Active Contributor
0 Kudos

check in NACE. Application V3 and see for which condition is set and check the same in the billing doc if the conditions are satisfying

Former Member
0 Kudos

Hi,

I recheck the condition type 'ZHD0' in NACE and not found it in V3 application.

But when I try to create the billing document by manual then can retrieve this condition type as picture below:

<a href="http://gyroly.com/zmiro10.jpg">Billing Document Manual Creating</a>

Is the new condition type requirement in V3 application before add it in the billing document automatic?

Thanks,

Gy

prabhu_s2
Active Contributor
0 Kudos

for automatic detection maybe the condition type set for this output type is not matching the billing doc combination like sales org/customer or sales org/doc type etc

Message was edited by:

Prabhu S

Answers (2)

Answers (2)

prabhu_s2
Active Contributor
0 Kudos

maybe the qty is zero. check for the material stock in mmbe or in mb5b. so for testing fill qty's greated than 0 and see if it is posting.

Former Member
0 Kudos

Hi,

Thanks for your help. I recheck the step 'fill billing data', and found out field 'REF_DOC_CA' to be missed.

I'm surprised that is after create successfully the billing document then the printer is automatic to be called.

How can I do to disable this event?

Thanks,

Gy

prabhu_s2
Active Contributor
0 Kudos

u need to check with the output types.

Former Member
0 Kudos

Hi,

In the condition data, I want to add new condition type as below:

  • << Add new condition type

CLEAR: lt_cond_data.

lt_cond_data-COND_TYPE = 'ZHD0'.

lt_cond_data-COND_VALUE = mrm_ship_charge-summe. " amount of shipping charge

lt_cond_data-COND_CURR = mrm_ship_charge-waerq. " USD

append lt_cond_data.

*>>

But I created successfully billing document, this condition type is not appear in the billing view by transaction VF03.

Could you help me to find out the fault?

Thanks,

Gy

prabhu_s2
Active Contributor
0 Kudos

u mean billing items overview? u will get this WRT invoice. But is this related to your subject in post?

Former Member
0 Kudos

Hi,

This is related to my subject post. I go to the menu "Go to" -> "Header" -> "Pricing Conditions Header" to view conditions but not found new condition type to be added.

Thanks,

Gy

Former Member
0 Kudos

Hi,

Item is not billable is only the warning message. This is giving you the error message.

Thanks,

Narayan