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: 

Using Save_text for Billing Document

Former Member
0 Kudos

Hello,

I've created BDC program to create Billing Documents in SD. I will be required to use the function module "save_text" to upload the long text. However the long text does not get updated. I've tried calling the save_text and this time the long text gets uploaded. Does anyone know why this is happening?

Thanks

Gladys

18 REPLIES 18

Former Member
0 Kudos

Gladys,

Could you please clarify what exactly are you trying to do? Please explain step by step, if possible.

Regards,

Ravi

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

So you are saying that using SAVE_TEXT in your program directly after the BDC does not work, but when using SAVE_TEXT somewhere else it does work? Please be more clear.

Regards,

Rich Heilman

former_member188685
Active Contributor
0 Kudos

Did you upload the same text in BDC and with out BDC.

and Can you what exactly you are doing..

regards

vijay

Former Member
0 Kudos

Hi,

The flow in my program is as follows.

1. Using BDC to create a billing document.

2. Retrieve out the internall generated billing document number.

3. Use the billing document number to call the function save_text to update the long text for this billing document.

After performing step 3, I went to check if the long text has been updated through VF03. However, the long text was not updated.

Alternatively, I used SE37 to run save_text using the same values I input into the program. This time the long text is updated in the Billing Document.

Does this sound clearer?

Thanks

Gladys

0 Kudos

Gladys,

The only reason I can think of might be the time lag between the BDC and then the firing of the SAVE_TEXT function. ARe you sure that SAVE_TEXT returns no errors regarding the document number?

Also, are you using COMMIT_TEXT after SAVE_TEXT? If NOT, can you try using those?

Regards,

Ravi

Note : Please reward the posts that were helpful.

0 Kudos

Some times it will Update but you will not be able to see..

check <b>sy-subrc</b> after save_text..

and do one thing use read_text to get the text what ever you saved . if that is there means it is saved.

regards

vijay

0 Kudos

Hi Gladys,

In debugging, check how the billing document number is returned to you(step 2 of your logic)? I think you get the billing document number in external format. You need to convert that to internal format to prepare your object key, before you call your save_text function module. So if the number is coming to you as 80000001, your object key should be 0080000001. You can use CONVERSION_EXIT_ALPHA_INPUT function module for converting the number into internal format.

Srinivas

0 Kudos

Hi Vijay!

This is with ref to your answers w.r.t. SAVE_TEXT.

While performing BDC for sales order VA01 we need to upload long text for each line items of the Sales order.Can you provide me with the details.

regards

kumar

Points will be awarded

0 Kudos

yeah definitely,

can you check this thread for sample code, if you don't understand then let me know..

just refer this thread..

if you can give the mail id i can provide the code for

bdc with save_text.

thanks

vijay

Message was edited by: Vijay Babu Dudla

Former Member
0 Kudos

Hello,

I've actually converted the billing document number using the alpha exit funtion module, as well as check the sy-subrc which return 0. I've tried to call read_text and i've got an ABAP dump which looks like what is pasted below. It seemed to me that the billing document has been locked in some ways?

An exception occurred. This exception is dealt with in more detail below

. The exception, which is assigned to the class 'CX_SY_DYN_CALL_ILLEGAL_TYPE',

was neither

caught nor passed along using a RAISING clause, in the procedure

"SAVE_HEADER_TEXT" "(FORM)"

.

Since the caller of the procedure could not have expected this exception

to occur, the running program was terminated.

The reason for the exception is:

The call to the function module "READ_TEXT" is incorrect:

The function module interface allows you to specify only fields

of a particular type under "NAME". The field "RECORD-BILLDOC" specified here

has a different field type.

0 Kudos

Gladys,

In that case can declare a variable of the same type as in the READ_TEXT function, dump the Bill doc number in it and use that variable.

That should work.

REgards,

Ravi

Note : Please reward the posts that help you.

0 Kudos

can you give the relevant code what exactly you are passing to save_txt and read_txt.

regards

vijay

Former Member
0 Kudos

This is my code. I've used the very same codes for creating sales order, delivery note and quotation and it works. Somehow it just doens't work for Billing document.

form save_header_text tables text_line using tdid.

DATA : HEADER LIKE THEAD.

data: v_function(1).

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

INPUT = record-billdoc

IMPORTING

OUTPUT = record-billdoc.

header-tdname = record-billdoc.

header-tdobject = 'VBBK'.

header-TDID = record2-tdid.

header-tdspras = 'E'.

CALL FUNCTION 'SAVE_TEXT'

EXPORTING

  • CLIENT = SY-MANDT

HEADER = header

  • INSERT = 'X'

SAVEMODE_DIRECT = 'X'

  • OWNER_SPECIFIED = 'X'

  • LOCAL_CAT = ' '

IMPORTING

FUNCTION = v_function

  • NEWHEADER =

TABLES

LINES = text_line

  • EXCEPTIONS

  • ID = 1

  • LANGUAGE = 2

  • NAME = 3

  • OBJECT = 4

  • OTHERS = 5

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

0 Kudos

Hi Glady,

Hardcode TDID and try...

header-tdname = record-billdoc.

header-tdobject = 'VBBK'.

<b>header-TDID = 'ZTES'.</b>

header-tdspras = 'E'.

Check any value inside TDID.

regards

vijay

Former Member
0 Kudos

Hi everyone,

Thanks everyone for all the help. I still can't figure out why my long text wont' go in. It seems to me that the transaction seems to be locking the billing document, though I'm not sure why. But I've found a way to work around it.

Instead of

loop at record

perform bdc.

perform save_text.

endloop.

I'll did this.

loop at record.

perform bdc.

update record with bill doc no.

endloop.

loop at record.

perform save_text.

endloop.

Thanks

Gladys

0 Kudos

Gladys,

I mentioned about the time lag in my first response. By the time the BDC is executed and the doc. no if available for other programs there will be a time lag.

If you are keen, you can as well try putting a Wait statement inside the first loop.

Regards,

Ravi

0 Kudos

Hi Ravikumar,

I've actually tried to put a wait 30 seconds statement. But it still doesn't work.

Regards

Gladys

0 Kudos

Hi,

I did not see any COMMIT WORK statement after SAVE_TEXT fm in your code. Do you have it and has not pasted it here? If it is not there then I think you should have it after your SAVE_TEXT fm call. As far as I know SAVE_TEXT does not commit the text to the database. The caller has to do it explicitly..

Hope this helps..

Sri