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: 

BAPI

Former Member
0 Kudos
252

Hi All,

I am using the BAPI_CONTRACT_CREATEFROMDATA Function Module to create the Contract.. But I have not find the header fields Billing plan date and billing plan value.. here I need to enter 2 or more records.. I aslo not find the equipment number..

Please help me..

Thank you..

1 ACCEPTED SOLUTION

Former Member
0 Kudos
107

Hi,

In that FM,

CONTRACT_HEADER_IN

CONTRACT_HEADER_INX

are the Header Datas.

Regards,

Padmam.

3 REPLIES 3

Former Member
0 Kudos
107

Hi,

first created the contract (with start date and end date) followed by modification of the billing plan.

I did not use BAPI_CONTRACT_CREATEFROMDATA because the BAPI interface is incomplete since it is missing a parameter for scheduling lines. Thus, I used directly the RFC-enabled function module SD_SALESDOCUMENT_CREATE (if you look at the coding of the BAPI it does exactly the same, nothing else). This function module contains the missing parameter SALES_SCHEDULES_IN.

The following coding shows how I cut the relation between header and item billing plan and modified the item billing plan.

FUNCTION z_billingplan_change .

*"----


""Lokale Schnittstelle:

*" IMPORTING

*" VALUE(ID_SALESDOCUMENT) TYPE VBELN_VA

*" VALUE(IT_BILLING_PLAN) TYPE Z_FPLAVB_TTYP

*" VALUE(ID_COMMIT) TYPE AS4FLAG DEFAULT ' '

*" EXPORTING

*" REFERENCE(EO_MSGLIST) TYPE REF TO IF_RECA_MESSAGE_LIST

*"----


  • NOTE: structure z_fplavb consists of:

- ITM_NUMBER (of type POSNR_VA)

- structure FPLAVB

  • define local data

DATA:

ls_plan TYPE z_fplavb,

ls_bufferread TYPE sado_buf_flagstring.

DATA:

  • lt_return TYPE bapirettab,

  • lo_msglist TYPE REF TO if_reca_message_list,

*

ld_fplnr_head TYPE fplnr, " Kopf-Fakturaplan

ld_fplnr_pos TYPE fplnr, " Position-Fakturaplan

ls_vbak TYPE vbak,

ls_vbkd TYPE vbkd,

ls_vbkdvb TYPE vbkdvb,

ls_vbrk TYPE vbrk,

lt_vbkd TYPE STANDARD TABLE OF vbkd,

lt_vbkdvb TYPE STANDARD TABLE OF vbkdvb,

*

ls_fpla TYPE fpla,

ls_fplt TYPE fplt,

ls_zfpla TYPE fplavb,

ls_zfplt TYPE fpltvb,

lt_zfpla_old TYPE STANDARD TABLE OF fplavb,

lt_zfplt_old TYPE STANDARD TABLE OF fpltvb,

lt_zfpla_new TYPE STANDARD TABLE OF fplavb,

lt_zfplt_new TYPE STANDARD TABLE OF fpltvb.

  • initialization

OVERLAY ls_bufferread WITH 'XXXXX'.

  • Create message handler

eo_msglist = cf_reca_message_list=>create( ).

  • Read sales document (with locking, AUTH-Check)

CALL FUNCTION 'SD_SALES_DOCUMENT_READ'

EXPORTING

document_number = id_salesdocument

  • PROCESSING_MODIFICATION = ' '

processing_bufferread = ls_bufferread

  • RESULTS_INSERT = ' '

  • SUPPRESS_AVAILIBILITY_DIA = 'X'

  • SUPPRESS_TEXT_POPUP = 'X'

  • i_block = 'X'

  • STATUS_BUFFER_REFRESH = 'X'

  • REQUISITION_BUFFER_REFRESH = 'X'

  • CALL_ACTIVE = ' '

  • I_NO_AUTHORITY_CHECK = ' '

  • I_CALL_BAPI = ' '

  • I_CRM_LOCK_MODE = ' '

IMPORTING

evbak = ls_vbak

evbkd = ls_vbkd

EXCEPTIONS

error_message = 1.

IF sy-subrc <> 0.

eo_msglist->add_symsg( ).

RETURN. " leave function module

ENDIF.

CALL FUNCTION 'SD_VBKD_READ_WITH_VBELN'

EXPORTING

i_vbeln = id_salesdocument

  • I_BYPASSING_BUFFER = ' '

  • I_REFRESH_BUFFER =

TABLES

et_vbkdvb = lt_vbkdvb

et_vbkd = lt_vbkd

EXCEPTIONS

record_not_found = 1

OTHERS = 2.

IF sy-subrc <> 0.

eo_msglist->add_symsg( ).

RETURN. " leave function module

ENDIF.

  • Get billing plan number of header

LOOP AT lt_vbkd INTO ls_vbkd

WHERE ( posnr IS INITIAL ).

EXIT.

ENDLOOP.

IF ( syst-subrc = 0 ).

ld_fplnr_head = ls_vbkd-fplnr.

ELSE.

CLEAR: ld_fplnr_head.

ENDIF.

LOOP AT lt_vbkd INTO ls_vbkd.

  • Read billing plans (header and/or position)

CALL FUNCTION 'BILLING_SCHEDULE_READ'

EXPORTING

fplnr = ls_vbkd-fplnr

  • I_VFKDAT =

  • I_BFKDAT =

TABLES

zfpla = lt_zfpla_old

zfplt = lt_zfplt_old

EXCEPTIONS

error_message = 1.

IF sy-subrc <> 0.

eo_msglist->add_symsg( ).

RETURN. " leave function module

ENDIF.

ENDLOOP.

lt_zfpla_new = lt_zfpla_old.

CLEAR: ls_zfpla.

  • Modify billing plan

LOOP AT it_billing_plan INTO ls_plan.

READ TABLE lt_vbkd INTO ls_vbkd

WITH KEY posnr = ls_plan-itm_number.

IF ( syst-subrc NE 0 ).

CONTINUE.

ELSE.

LOOP AT lt_zfpla_new INTO ls_zfpla

WHERE ( fplnr = ls_vbkd-fplnr ).

CLEAR: ls_zfpla-rfpln. " cut link to header billing plan

ls_zfpla-updkz = 'U'. " update

ls_zfpla-perio = ls_plan-perio. " change period

MODIFY lt_zfpla_new FROM ls_zfpla.

ENDLOOP.

ENDIF.

ENDLOOP.

CALL FUNCTION 'BILLING_SCHEDULE_SAVE'

TABLES

fpla_new = lt_zfpla_new

fpla_old = lt_zfpla_old

fplt_new = lt_zfplt_new

fplt_old = lt_zfplt_old.

CALL FUNCTION 'SD_ORDER_BILLING_SCHEDULE'

EXPORTING

i_vbeln = id_salesdocument

i_beleg_lesen = 'X'

i_commit = id_commit " committed later

i_termine_bis_zum_horizont = 'X'

  • I_MEILENSTEINE_ZURUECKMELDEN =

i_aktualisieren = 'X'

  • TABLES

  • TMSTSD =

.

ENDFUNCTION.

<b>Reward points</b>

Regards

0 Kudos
107

Hi Kiran,

I want to modify the header billing plan.. and the Item equipment number..

Any solution for this..

Thanks for the update..

Former Member
0 Kudos
108

Hi,

In that FM,

CONTRACT_HEADER_IN

CONTRACT_HEADER_INX

are the Header Datas.

Regards,

Padmam.