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: 

How to pass dynamic subject in CL_DOCUMENT_BCS=>CREATE_DOCUMENT

0 Kudos
1,057

Hello Experts,

Here i am requesting for all of you please suggest how can i send dynamic subject in the given code here under for auto generated mail in ABAP:-

CALL METHOD CL_DOCUMENT_BCS=>CREATE_DOCUMENT
EXPORTING
I_TYPE = 'TXT'
I_SUBJECT = 'TOWN LOSS FOR THE MONTH OF'
I_TEXT = lt_body
RECEIVING
RESULT = DATA(lo_doc).


At above code i want that the 'TOWN LOSS FOR THE MONTH OF' should be changed as per table data.

Thanks in advance for the best solution.

7 REPLIES 7

Sandra_Rossi
Active Contributor
879

Use a variable instead of text literal.

matt
Active Contributor
0 Kudos
879

Why are you using the old syntax. What's wrong with

DATA(doc) = cl_document_bcs=>create_document( i_type    = 'TXT'
                                              i_subject = 'TOWN LOSS FOR THE MONTH OF'
                                              i_text    = body ).

0 Kudos
879

I am new in ABAP, that why i am using this syntax. In place of 'TOWN LOSS FOR THE MONTH OF' I want to use table data like :-

1.i_subject = 2022 after one year this should be

i_subject = 2023.

FredericGirod
Active Contributor
0 Kudos
879

Could you clarify what is l_i_subject ? and if this title is hard coded or have a dynamic part ?

stanislaslemaire
Participant
0 Kudos
879

Hello,
I don't understand where is the difficulty ! 🙂
use a variable as

 lv_subject type SO_OBJ_DES.

populate it, example with

lv_subject = sy-datum(4).

And set this variable to method parameters i_subject...

No ?

Sandra_Rossi
Active Contributor
0 Kudos
879
DATA(lo_doc) = CL_DOCUMENT_BCS=>CREATE_DOCUMENT(
    I_TYPE    = 'TXT'
    I_SUBJECT = |TOWN LOSS FOR THE MONTH OF { sy-datum(4) }|
    I_TEXT    = lt_body ).

0 Kudos
879

Thank You so much Sandra Rossi !! SAP Community is wonderful platform where we can hope for the best solution.

Thanks once again. Respected All who contribute for solving/suggesting me to solve the problem.