Application Development and Automation 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: 
Read only

BAPI Return Table is Initial for BAPI_BUPA_TAX_ADD/CHANGE/REMOVE

Former Member
0 Likes
4,799

Hi Friends,

               I am getting an Initial return Table for BAPI_BUPA_TAX_CHANGE/ADD/REMOVE. The return Table is not getting populated and therefore commit is not happening. Please advice what to do in this situation. I am also pasting the code below. ALL THE BAPIRET TABLES ARE COMING INITIAL AND SO I AM NOT GETTING ANY DECISION WHETHER TO COMMIT OR NOT...?? PLEASE HELP ME WITH THIS.

LOOP at lit_tax INTO lwa_tax.

          ls_taxtype = lwa_tax-taxtype.

          l_taxnum = lwa_tax-taxnum.

        SELECT SINGLE *

          FROM dfkkbptaxnum

          INTO ls_bptax

          WHERE partner = lwa_tax-partner

          and taxtype = ls_taxtype.

          if sy-subrc ne 0.

*           if ( ls_taxtype IS NOT INITIAL ) or ( l_taxnum IS NOT INITIAL ).

              CALL FUNCTION 'BAPI_BUPA_TAX_ADD'

                EXPORTING

                  businesspartner       = lwa_tax-partner

                  taxtype               = ls_taxtype

                  taxnumber             = l_taxnum

               TABLES

                 RETURN                = lit_bapiret_taxad

                        .

          READ TABLE lit_bapiret_taxad WITH KEY type = 'S' TRANSPORTING NO FIELDS.

         IF sy-subrc EQ 0.

           CLEAR: gW_bapiret2.

           CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

*          EXPORTING

*            WAIT          =

            IMPORTING

              return        = gW_bapiret2.

           .

         ENDIF.

*        endif.

          else.

            if lwa_tax-del_ind = 'Y'.

              CALL FUNCTION 'BAPI_BUPA_TAX_REMOVE'

                EXPORTING

                  businesspartner       = lwa_tax-partner

                  taxtype               = ls_taxtype

               TABLES

                RETURN                = lit_bapiret_taxdel

                        .

          READ TABLE lit_bapiret_taxdel WITH KEY type = 'S' TRANSPORTING NO FIELDS.

         IF sy-subrc EQ 0.

           CLEAR: gW_bapiret2.

           CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

*          EXPORTING

*            WAIT          =

            IMPORTING

              return        = gW_bapiret2.

           .

         ENDIF.

         ELSE.

         CALL FUNCTION 'BAPI_BUPA_TAX_CHANGE'

           EXPORTING

             businesspartner = lwa_tax-partner

             taxtype         = ls_taxtype

             taxnumber       = l_taxnum

           TABLES

             return          = lit_bapiret_taxch.

         READ TABLE lit_bapiret_taxch WITH KEY type = 'S' TRANSPORTING NO FIELDS.

         IF sy-subrc EQ 0.

           CLEAR: gW_bapiret2.

           CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

*          EXPORTING

*            WAIT          =

            IMPORTING

              return        = gW_bapiret2.

           .

         ENDIF.

       ENDIF.

     ENDIF.

     CLEAR: ls_taxtype,l_taxnum,ls_identification,lv_partner,lv_identificationno.

   ENDLOOP.


Thanks & Regards

Anirban

Hi Friends,

               I am getting an Initial return Table for BAPI_BUPA_TAX_CHANGE/ADD/REMOVE. The return Table is not getting populated and therefore commit is not happening. Please advice what to do in this situation. I am also pasting the code below. ALL THE BAPIRET TABLES ARE COMING INITIAL AND SO I AM NOT GETTING ANY DECISION WHETHER TO COMMIT OR NOT...?? PLEASE HELP ME WITH THIS.

LOOP at lit_tax INTO lwa_tax.

          ls_taxtype = lwa_tax-taxtype.

          l_taxnum = lwa_tax-taxnum.

        SELECT SINGLE *

          FROM dfkkbptaxnum

          INTO ls_bptax

          WHERE partner = lwa_tax-partner

          and taxtype = ls_taxtype.

          if sy-subrc ne 0.

*           if ( ls_taxtype IS NOT INITIAL ) or ( l_taxnum IS NOT INITIAL ).

              CALL FUNCTION 'BAPI_BUPA_TAX_ADD'

                EXPORTING

                  businesspartner       = lwa_tax-partner

                  taxtype               = ls_taxtype

                  taxnumber             = l_taxnum

               TABLES

                 RETURN                = lit_bapiret_taxad

                        .

          READ TABLE lit_bapiret_taxad WITH KEY type = 'S' TRANSPORTING NO FIELDS.

         IF sy-subrc EQ 0.

           CLEAR: gW_bapiret2.

           CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

*          EXPORTING

*            WAIT          =

            IMPORTING

              return        = gW_bapiret2.

           .

         ENDIF.

*        endif.

          else.

            if lwa_tax-del_ind = 'Y'.

              CALL FUNCTION 'BAPI_BUPA_TAX_REMOVE'

                EXPORTING

                  businesspartner       = lwa_tax-partner

                  taxtype               = ls_taxtype

               TABLES

                RETURN                = lit_bapiret_taxdel

                        .

          READ TABLE lit_bapiret_taxdel WITH KEY type = 'S' TRANSPORTING NO FIELDS.

         IF sy-subrc EQ 0.

           CLEAR: gW_bapiret2.

           CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

*          EXPORTING

*            WAIT          =

            IMPORTING

              return        = gW_bapiret2.

           .

         ENDIF.

         ELSE.

         CALL FUNCTION 'BAPI_BUPA_TAX_CHANGE'

           EXPORTING

             businesspartner = lwa_tax-partner

             taxtype         = ls_taxtype

             taxnumber       = l_taxnum

           TABLES

             return          = lit_bapiret_taxch.

         READ TABLE lit_bapiret_taxch WITH KEY type = 'S' TRANSPORTING NO FIELDS.

         IF sy-subrc EQ 0.

           CLEAR: gW_bapiret2.

           CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

*          EXPORTING

*            WAIT          =

            IMPORTING

              return        = gW_bapiret2.

           .

         ENDIF.

       ENDIF.

     ENDIF.

     CLEAR: ls_taxtype,l_taxnum,ls_identification,lv_partner,lv_identificationno.

   ENDLOOP.


Thanks & Regards

Anirban

8 REPLIES 8
Read only

former_member219762
Contributor
0 Likes
3,235

Hi,

Check for type E,if you find exit other wise call commit,

Regards,

Sreenivas.

Read only

rajucd81
Participant
0 Likes
3,235

Hi Anirban

Did you debug BAPIs and see the return table assignments ??  if really BAPIs have issue, raise a OSS msg since these BAPIs are standard ones, and SAP will fix it.

If it is urgent delivery, use BDC instead  of BAPI. I know BAPI method is very easy comparatively BDC.


Read only

nabheetscn
SAP Champion
SAP Champion
0 Likes
3,235

Hi Anirban

If you read the documentation of BAPI for return parameter it clearly status that it will be filled if an error occurs or a note should appear.

I believe you should just check if RETURN[] is initial means all well proceed with commit.

Nabheet

Read only

Former Member
0 Likes
3,235

Hi Anirban,

Check for message type 'E' , 'A' and 'X'.

Thanks and Regards

Srimanta

Read only

Former Member
0 Likes
3,235

Hi All,

          My problem is solved. PLEASE TELL ME HOW TO CLOSE THIS THREAD.

Thanks & Regards

Anirban

Read only

0 Likes
3,235

Please document your completw solution here so that some one can refer to it

Read only

Former Member
0 Likes
3,235

Hi,

     The documentation of these BAPI's says that return table will be populated only when there is an error. So I have done read table on the BAPIRET Tables for message type 'E' only. If not found then COMMIT. It's working well as I have tested it.

That is why I WANT TO CLOSE THIS THREAD.

Thanks & Regards

Anirban

Read only

0 Likes
3,235