Skip to Content

HSN_SAC CODE FIELD IN BAPI_ACC_DOCUMENT_POST TO CREATE VENDOR INVOICE

H experts,

I am not able to find any for that store HSN_SAC Code in BAPI_ACC_DOCUMENT_POST to create vendor invoice(fb60).

Please give a solution.

Thank you!

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Nov 23, 2017 at 07:07 PM

    Hi Aamir,

    Use extension parameters to pass HSN values into the FM and implement BADI

    BADI_ACC_DOCUMENT and write code in method : IF_EX_ACC_DOCUMENT~CHANGE

    Sample Program code:

    ls_extension-structure = 'ZBAPI_EXTENSION_HSN_GST'.
    MOVE ls_accountpay-itemno_acc TO ls_extension-valuepart1(10).
    ls_extension-valuepart1+10(10) = <fs>-gst_part .
    ls_extension-valuepart1+20(3) = <fs>-plc_sup .
    ls_extension-valuepart1+23(16) = <fs>-hsn_sac.

    APPEND ls_extension TO lt_extension.
    CLEAR : ls_extension.

    Badi code :

    DATA: wa_extension TYPE bapiparex,
    ext_value(960) TYPE c,
    wa_accit TYPE accit,
    l_ref TYPE REF TO data.

    FIELD-SYMBOLS: <l_struc> TYPE ANY,
    <l_field> TYPE ANY.



    SORT c_extension2 BY structure.

    LOOP AT c_extension2 INTO wa_extension.

    CHECK wa_extension-structure IS NOT INITIAL.

    AT NEW structure.
    CREATE DATA l_ref TYPE (wa_extension-structure).
    ASSIGN l_ref->* TO <l_struc>.
    ENDAT.

    CONCATENATE wa_extension-valuepart1 wa_extension-valuepart2
    wa_extension-valuepart3 wa_extension-valuepart4
    INTO ext_value.

    MOVE ext_value TO <l_struc>.

    ASSIGN COMPONENT 'POSNR' OF STRUCTURE <l_struc> TO <l_field>.

    IF sy-subrc = 0.

    READ TABLE c_accit WITH KEY posnr = <l_field>
    INTO wa_accit.
    IF sy-subrc IS INITIAL.
    MOVE-CORRESPONDING <l_struc> TO wa_accit.
    MODIFY c_accit FROM wa_accit INDEX sy-tabix.
    ENDIF.

    ENDIF.

    ENDLOOP

    Add comment
    10|10000 characters needed characters exceeded