Fbra clearing voucher offset J_1B_FBRA_POSTING_AUFRUFEN

The front fbra can choose to reset and reverse

 

J_1B_FBRA_POSTING_AUFRUFEN

 

 

form frm_acc_reverse .

  data:

        lt_alv_c like table of gt_alv with header line.

 

  loop at gt_alv where sel = 'X'.

    lt_alv_c-augbl = gt_alv-augbl.

    lt_alv_c-bukrs = gt_alv-bukrs.

    lt_alv_c-gjahr = gt_alv-augdt(4).

    collect lt_alv_c.

  endloop.

  if sy-subrc ne 0.

    message e001(00) with'Select at least one row'.

  endif.

 

  data i_augbl type bkpf-belnr.

  data i_bukrs type bkpf-bukrs.

  data i_gjahr type bkpf-gjahr.

  data i_stgrd type bkpf-stgrd.

 

  loop at lt_alv_c.

    call function 'J_1B_FBRA_POSTING_AUFRUFEN'

      exporting

        i_augbl           = lt_alv_c-augbl

        i_bukrs           = lt_alv_c-bukrs

        i_gjahr           = lt_alv_c-gjahr

        i_stgrd = '01'

      exceptions

        not_possible_fbra = 1

        not_possible_fb08 = 2.

    message id sy-msgid

      type sy-msgty

      number sy-msgno

      with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4

       into  data(lv_msg).

    if sy-subrc = 0.

      call function 'BAPI_TRANSACTION_COMMIT'

        exporting

          wait = 'X'.

      lt_alv_c-rtype = 'S'.

      lt_alv_c-rtmsg ='Successful reversal:' && lv_msg.

    else.

      call function 'BAPI_TRANSACTION_ROLLBACK'.

      lt_alv_c-rtype = 'E'.

      lt_alv_c-rtmsg ='Reversal failed:' && lv_msg.

    endif.

    modify lt_alv_c.

  endloop.

  loop at gt_alv where sel = 'X'.

    read table lt_alv_c with key augbl = gt_alv-augbl bukrs = gt_alv-bukrs gjahr = gt_alv-gjahr.

    if sy-subrc = 0.

      gt_alv-rtype = lt_alv_c-rtype.

      gt_alv-rtmsg = lt_alv_c-rtmsg.

      modify gt_alv.

    endif.

  endloop.

 

endform.

 

 

Guess you like

Origin blog.csdn.net/cylcylcylcylwo/article/details/113968107