cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

BAPI BAPI_ISUCONTRCT_CHANGEFROMDATA can be used to apply billing block ?

former_member220286
Participant
0 Kudos
1,692

Hi Gurus ,

I have a requirement that I have to apply billing block at contract level .I have to update the billing block reason field abrsperr .The billing block reason which I can see by executing ES32 tcode and then clicking on contract then going to billing tab there is shown a reason for billing block .I have to update this reason for billing block as 'SC' through this BAPI .Can this functionality can be achieved through this BAPI .Is using this BAPI will effect other things .I have some piece of code also .Please suggest some ideas or work around .

DATA: lwa_contractdata TYPE bapiisucontract,
l_string TYPE string,
lwa_contractdatax TYPE bapiisucontractx,
lwa_return TYPE bapiret2,
cv_eflag TYPE boolean,
cv_step TYPE n.

SELECT ANLAGE ,
MDUSREQUESTID
FROM ETRG INTO TABLE @DATA(lt_etrg)
where MDUSRQSTAT = '03'.
if sy-subrc eq 0 .

select MDUSREQUESTID
from EMDUSDRQRESULT INTO TABLE @DATA(lt_EMDUSDRQRESULT)
FOR ALL ENTRIES IN @lt_etrg
where MDUSREQUESTID = @lt_etrg-MDUSREQUESTID
AND ZMISSINGRD_CT <> ' '
AND RESPAR like '%D%'
AND ZMISSINGRD_CT <> 0.
if sy-subrc eq 0 .
select ANLAGE ,
MDUSREQUESTID
FROM ETRG INTO TABLE @data(lt_erg1)
for ALL ENTRIES IN @lt_EMDUSDRQRESULT
where MDUSREQUESTID = @lt_EMDUSDRQRESULT-MDUSREQUESTID.
if sy-subrc eq 0 .
select ANLAGE ,
AUSZDAT,
VERTRAG
from ever INTO TABLE @DATA(lt_ever)
FOR ALL ENTRIES IN @lt_erg1
where anlage = @lt_erg1-anlage.
if sy-subrc eq 0 .

sort lt_ever by auszdat DESCENDING.
delete ADJACENT DUPLICATES FROM lt_ever COMPARING anlage .
endif.

endif.

endif.
endif.

loop at lt_ever INTO DATA(wa_ever).

lwa_contractdata-contract = wa_ever-vertrag.
lwa_contractdata-installation = wa_ever-anlage.
lwa_contractdata-billblck_reason = 'TG'. "

lwa_contractdatax-billblck_reason = abap_true.


CALL FUNCTION 'BAPI_ISUCONTRCT_CHANGEFROMDATA'
EXPORTING
contractdata = lwa_contractdata
contractdatax = lwa_contractdatax
IMPORTING
RETURN = lwa_return.
** TABLES
** EXTENSIONIN =

IF lwa_return-type EQ 'E'.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 INTO l_string.
MESSAGE i000(zeservices) WITH l_string.
cv_eflag = abap_true.
cv_step = 1.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
* WRITE:/2 pv_ever-vertrag, 'Billing Block has been removed'(008).
ENDIF.

ENDLOOP.

Regards

Deep

Accepted Solutions (0)

Answers (4)

Answers (4)

daniel_mccollum
Active Contributor

If all you want to do is update Bill Block Reason for a contract, pass in:
CONTRACTDATA-CONTRACT = Contract you want to edit.

CONTRACTDATA-BILLBLCK_REASON = Bill block reason you want to apply

CONTRACTDATAX-CONTRACT = 'X'

CONTRACTDATAX-BILLBLCK_REASON = 'X'

Please note a blank Bill Block reason is fine & will remove the value if one exists.

Its very simple. The CONTRACTDATAX structure is used to control the scope of the updates made.

srinivasankh
Contributor

Hi Deep,

I am not sure if you have this issue still now, but as suggested by Daniel, as long as the Billing Block reason which you are applying is valid then you are good to use that BAPI - BAPI_ISUCONTRCT_CHANGEFROMDATA

Just use Contract and BILLBLCK_REASON under structure CONTRACTDATA and its corresponding indicators in CONTRACTDATAX.

Also try to use BAPI - BAPI_TRANSACTION_COMMIT after you used the first Contract update BAPI, may be after the loop at lt_ever.

Hope this helps.

Thanks,

Srini

Lakshmipathi
SAP Champion
SAP Champion
0 Kudos
which I can see by executing ES32 tcode

This is related to IS-U component and hence, adding the related tag for better reach

NTeunckens
Active Contributor
0 Kudos

Hello Deep

I don't think you need to provide both Contract (VERTRAG) ànd Installation (ANLAGE).
I would suggest you comment out the code regarding ANLAGE, thus only passing VERTRAG in the BAPI. Setting the Billing Block should work via this BAPI.

Hope this helps


Nic T.