Application Development 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: 

Issue with BAPI Extensions and Custom table Update

former_member1716
Active Contributor
0 Kudos
1,178

Hello All Experts,

We have scenario where we need to update certain custom fields in VBAP via BAPI Extensions. The number of fields are so large that is more 960 characters so it is running into a dump. Hence forth we are note able to add those fields in the extension structures.

We have avoided the solution of adding VALUE_PART5 and VALUE_PART6 in BAPI since it would require a lot of Regression.

Now we have came up with solution to add all these custom fields in a separate custom table with key fields as same as in VBAP table, all we need to  ensure now is that we need to update the VBAP and the custom table Synchronously just like how VBAK and VBAP are updated.

We have decided to call this updation of the custom table in an update function module using V1.

We are using a BAPI to change and create quotations, The issue is we are not sure where can we add the logic of calling this update function inside this BAPI to achieve the requirement.

Please share some advice to achieve the same, also if there are any alternate solutions are there please suggest.

ABAP Switching, Enhancing, and Adapting Standard Programs

Regards,
Satish

4 REPLIES 4

sabirshah1
Participant
0 Kudos
323

to save text more than 255 characters , you should use long text (FM : SAVE_TEXT and READ_TEXT)

have a look at following liink .

Long Texts - ABAP Development - SCN Wiki

raymond_giuseppi
Active Contributor
0 Kudos
323

You are even not required to add this in the BAPI, you can bypass it like


* Call standard BAPI

CALL FUNCTION 'BAPI_QUOTATION_CREATEFROMDATA2'

  EXPORTING

    salesdocumentin        = salesdocumentin

    quotation_header_in    = quotation_header_in

    quotation_header_inx  = quotation_header_inx

        " (...)

  IMPORTING

    salesdocument          = salesdocument

  TABLES

    return                = return

    quotation_items_in    = quotation_items_in

    quotation_items_inx    = quotation_items_inx. " ...

* Check validity

LOOP AT return INTO wa_message WHERE type = 'E' OR type = 'A'.

  EXIT.

ENDIF.

* Success

IF sy-subrc NE 0.

  wa_itab-vbeln = salesdocument.

  MODIFY my_itab FROM wa_itab TRANSPORTING vbeln.

  CALL FUNCTION 'Z_HR_BADI_TIME_UPDATE' IN UPDATE TASK

    TABLES

      my_itab = my_itab.

  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

* Failure

ELSE.

  CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.

  " raise message error

ENDIF.

Regards,

Raymond

0 Kudos
323

Thanks for the reply,

But then only inside the bapi my run time structures will be holding the values for the y fields, neither the BAPI extension nor the tables will hold those values at the point where you are asking to write the logic.

That is the exact reason i need to code inside the BAPI.

Regards,

Satish

0 Kudos
323

As you cannot pass your data in  BAPIPAREX  structure, use Enhancement technique to add a new parameter (Function module, Enhance Interface) and call your FM IN UPDATE TASK in an implicit enhancement at end of the BAPI FM. Could/should you also adapt business object (SWO1) BUS2031?

Regards,

Raymond