cancel
Showing results for 
Search instead for 
Did you mean: 

how to set billing block field in VA03 to default using badi?

Former Member
0 Kudos

Hi experts,

I am new to SD area, My SD consultant asked me to create a report.

In that he needs the field "billing block"  to be set to value "space"(i.e the value should be null) in vA03 tcode. Such that once it takes the default value space, it should go and update the same value in table "fplt" for the field faksp. plz see attached screenshot. I tried a sample coding but still its not getting updated.

Should I use   'BAPI_SALESORDER_CHANGE' to change a Sale order then use 'BILLING_SCHEDULE_SAVE' to update the

Billing plan of the changed Sale order.

Tell me if i need to use any user-exits?

this is urgent, plz help me out in this....




Accepted Solutions (0)

Answers (6)

Answers (6)

Former Member
0 Kudos

HI friends

the issue got resolved, thanks for all your valuable inputs.

But I didnt do changes in user exits as the Functional people dont want that method.

As per the above code i did some changes that i pasted above ,

Its working fine.

regards

Sona

former_member786133
Discoverer
0 Kudos

Hi Sona,

please suggest me the changes you did

jason_barton
Active Participant
0 Kudos

Sona,

Sounds like the requirement is a sales document with a default value of blank in the billing block field. If that is the case, why not handle this using configuration via sales document type? You can see in TVAK-FAKSK. Have a look at that first, and see impact (or not) on table FPLT. Please review and advise.

Thx,

Jason

Former Member
0 Kudos

hi jason,

Thanks for your reply,

As you specified i want the billing block value in va03 tcode to be blank value. how to check it using via........configuration.. plz advise.

Hi Atul

As per your suggestion i checked the tcode ovbj,

There in the billing block field , value is empty there. What I should do next?

Message was edited by: SONAKSHI SINHGHANIA

Former Member
0 Kudos

Hi Sonakshi

Go To Tcode OVBJ

select billing plan Z3, and go to details.

Remove the billing block here and save.

Hope it helps

Regards'

Atul

Former Member
0 Kudos

hi vemuri Santhosh kumar

Can you help me on how to write the sample code inside the exit?

Below is my sample code:

*&---------------------------------------------------------------------*
*& Report  ZRAJ_TEST1
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
.
REPORT zraj_test1.
TABLES: fplt,fpla.

DATA: v_aufnr TYPE aufnr.
DATA:  lt_header          TYPE TABLE OF bapisdh1,
       ls_header          TYPE bapisdh1,
       lt_header_up       TYPE TABLE OF bapisdh1x,
       ls_header_up       TYPE bapisdh1x,
       lt_return          TYPE TABLE OF bapiret2,
       v_order            TYPE bapivbeln-vbeln.

v_order = '0040133807'.

ls_header-bill_block    = SPACE.
* append ls_header to lt_header.
ls_header_up-updateflag = 'U'.
ls_header_up-bill_block = 'U'.
* append ls_header_up to lt_header_up.

CALL FUNCTION 'BAPI_SALESORDER_CHANGE'
  EXPORTING
    salesdocument         = v_order
    order_header_in       = ls_header
    order_header_inx      = ls_header_up
*   SIMULATION            =
    behave_when_error     = ' '
    int_number_assignment = ' '
*   LOGIC_SWITCH          =
    no_status_buf_init    = ' '
  TABLES
    return                = lt_return.
*    ORDER_ITEM_IN               =
*    ORDER_ITEM_INX              =
*    PARTNERS                    =
*    PARTNERCHANGES              =
*    PARTNERADDRESSES            =
*    ORDER_CFGS_REF              =
*    ORDER_CFGS_INST             =
*    ORDER_CFGS_PART_OF          =
*    ORDER_CFGS_VALUE            =
*    ORDER_CFGS_BLOB             =
*    ORDER_CFGS_VK               =
*    ORDER_CFGS_REFINST          =
*    SCHEDULE_LINES              =
*    SCHEDULE_LINESX             =
*    ORDER_TEXT                  =
*    ORDER_KEYS                  =
*    CONDITIONS_IN               =
*    CONDITIONS_INX              =
*    EXTENSIONIN                 =


DATA: ls_fplnr TYPE fplnr,
      lt_fplt  TYPE TABLE OF fplt WITH HEADER LINE,
      lt_fpla  TYPE TABLE OF fpla WITH HEADER LINE.

DATA: t_zfpla TYPE STANDARD TABLE OF fplavb WITH HEADER LINE.
DATA: t_zfplt TYPE STANDARD TABLE OF fpltvb WITH HEADER LINE.


DATA: t_fpla_new TYPE STANDARD TABLE OF fplavb WITH HEADER LINE.
DATA: t_fpla_old TYPE STANDARD TABLE OF fplavb WITH HEADER LINE.

DATA: t_fplt_new TYPE STANDARD TABLE OF fpltvb WITH HEADER LINE.
DATA: t_fplt_old TYPE STANDARD TABLE OF fpltvb WITH HEADER LINE.

SELECT SINGLE fplnr FROM vbkd INTO ls_fplnr WHERE vbeln = '0040133807'.

SELECT  * FROM fplt INTO lt_fplt WHERE fplnr = ls_fplnr.
  ENDSELECT.
*
SELECT * FROM fpla INTO lt_fpla WHERE fplnr = ls_fplnr.
  ENDSELECT.


*CALL FUNCTION 'BILLING_SCHEDULE_READ'
*  EXPORTING
*    fplnr = ls_fplnr
*  TABLES
*    zfpla = t_zfpla
*    zfplt = t_zfplt.

*LOOP AT lt_fplt.

  MOVE-CORRESPONDING lt_fpla TO t_fpla_old.
*  t_fpla_old-updkz = 'D'.
*  APPEND t_fpla_old.
*ENDLOOP.

  MOVE-CORRESPONDING lt_fpla TO t_fpla_new.

*  APPEND t_fpla_old.
*ENDLOOP.

*  *LOOP AT lt_fpla.
  MOVE-CORRESPONDING lt_fplt TO t_fplt_old.
*  t_fplt_old-faksp = ' '.
  APPEND t_fplt_old.

*LOOP AT lt_fpla.
  MOVE-CORRESPONDING lt_fplt TO t_fplt_new.
  t_fpla_new-updkz = 'D'.
  t_fplt_new-faksp = ' '.
  APPEND t_fplt_new.

*ENDLOOP.
*BREAK-POINT.

CALL FUNCTION 'BILLING_SCHEDULE_SAVE'
  TABLES
    fpla_new = t_fpla_new
    fpla_old = t_fpla_old
    fplt_new = t_fplt_new
    fplt_old = t_fplt_old.


*CALL FUNCTION 'BILLING_SCHEDULE_MAINTAIN'
*  EXPORTING
**   I_FPLA           =
**   I_FPLT           =
*   I_UPD_FPLA       = 'X'
*   I_UPD_FPLT       = 'X'
*    i_fplnr          = ls_fplnr
** IMPORTING
**   E_DATALOSS       =
**   E_UPD_FPLA       =
**   E_UPD_FPLT       =
**   E_FPLNR          = fplnr
**   E_FPLTR          = fpltr
*TABLES
*    fpla_new = t_fpla_new
*    fpla_old = t_fpla_old
*    fplt_new = t_fplt_new
*    fplt_old = t_fplt_old.

WAIT UP TO 2 SECONDS.

LOOP AT lt_return
         TRANSPORTING NO FIELDS
             WHERE type = 'A' OR type = 'E'.
  EXIT.
ENDLOOP.
IF sy-subrc NE 0.
  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
      wait = 'X'.
ENDIF.

plz tell me what modification i should do such that the billing block field in VA03 should have default value space.

regards

sona

former_member186385
Active Contributor
0 Kudos

Hi,

Use user exit " USEREXIT_MOVE_FIELD_TO_VBAP"

put the logic in this exit and try, it will change billing block

regards,

santosh

Former Member
0 Kudos

Hiii

SONAKSHI SINHGHANIA

you can also acheive it through user exit.

Since For SD , Go to package VMOD in t-code SE80.

then expand Include node.

Go to MV45AFZZ   Billing.
here lots of User exit are defined.

find out ur require one and write ur code in that user exit , within  form user_exit ------endform.

regards

Syed