Skip to Content
0

Using Function module BAPI_PR_CREATE Header Text not able to add

Apr 28, 2017 at 10:15 AM

249

avatar image

hi,

I am facing one problem I am using
CALL FUNCTION 'BAPI_PR_CREATE' For creating Purchase Request,
Everything is correct, But Purchase Header text i am not able to Add it, I have 3 Header texts At Indent ME51n. It only taking only one text for each indent.
If i give at a time 3 texts only last one which means what i passed last in the code it is taking as header text

like in coding.

header text1

header text2

header text3.

It only update Header text3.

IT_HTEXT TYPE BAPIMEREQHEADTEXT OCCURS 0,

The code is like.

IF WA_FINAL1-HTEXT1 IS NOT INITIAL.
WA_HTEXT-TEXT_ID = 'B01'.
WA_HTEXT-TEXT_LINE = WA_FINAL1-HTEXT1.
APPEND WA_HTEXT TO IT_HTEXT.
CLEAR : WA_HTEXT.
ENDIF.

IF WA_FINAL1-HTEXT1 IS NOT INITIAL.
WA_HTEXT-TEXT_ID = 'B02'.
WA_HTEXT-TEXT_LINE = WA_FINAL1-HTEXT1.
APPEND WA_HTEXT TO IT_HTEXT.
CLEAR : WA_HTEXT.
ENDIF.

IF WA_FINAL1-HTEXT1 IS NOT INITIAL.
WA_HTEXT-TEXT_ID = 'B03'.
WA_HTEXT-TEXT_LINE = WA_FINAL1-HTEXT1.
APPEND WA_HTEXT TO IT_HTEXT.
CLEAR : WA_HTEXT.
ENDIF.

All header texts not able to pass.Any suggestions update me, If it is not possible Please provide me Alternatives.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Nic Teunckens Apr 28, 2017 at 10:34 AM
2

Please check SAP-KBA 2075535 "BAPI_PR_CREATE: one header text" for this.

Extract :

"Cause
Even if you are able to define more than one text ID for the Preq, the system can only handle one text on the header level, text id B01, because they are considered internal documents, which does not support the creation of additional header memos.
In the standard SAP system, entering other header texts alongside the header memos is not supported.

Resolution
It is also not possible for online transaction codes. When using transaction ME51N, if you try to insert a test for the second text id, system will clear it out. Only the Header Note B01 will be considered. When using the BAPI, system will concatenate the two text IDs in the B01.
This functionality was not programmed in the system."

Show 4 Share
10 |10000 characters needed characters left characters exceeded

hi, thanks for you reply.
Solution i did not understood.What i understood is, I has to enter either 1 or 2 or 3.
Only one should be inserted.

I tried, any one it is taking. But not multiple.

0

Did some tests myself and indeed :

  • You can Update the Texts only for one 'TEXT_ID' at a Time ... In my Test THE LAST TEXT_ID is used to Fill the HeaderTexts ...
  • By filling the 'TEXT_FORM' in the HEADERTEXT-structure with ' / ' you can set up the Texts as Separate lines ...

 IF WA_FINAL1-HTEXT1 IS NOT INITIAL.
   WA_HTEXT-TEXT_ID   = 'B01'.    "Won't be used, only the ID of LAST RECORD of HDRTXT-Table!
   WA_HTEXT-TEXT_FORM = '/'.      "SET AS A NEW LINE
   WA_HTEXT-TEXT_LINE = WA_FINAL1-HTEXT1.
   APPEND WA_HTEXT TO IT_HTEXT.
   CLEAR : WA_HTEXT.
 ENDIF.

 IF WA_FINAL1-HTEXT1 IS NOT INITIAL.
   WA_HTEXT-TEXT_ID = 'B02'.      "LAST RECORD HDRTXT-Table => ALL RECORDS added with this ID
   WA_HTEXT-TEXT_FORM = '/'.      "SET AS A NEW LINE
   WA_HTEXT-TEXT_LINE = WA_FINAL1-HTEXT1.
 APPEND WA_HTEXT TO IT_HTEXT.
 CLEAR : WA_HTEXT.
 ENDIF.


That is how it worked in my system ...?

0

I passed the data like above,

Still same problem only B02 is adding i mean last one it is updating the text.

Can i use any Save_text function module

0

This means that the BAPI can not do more than what you can do via SAP Enjoy transaction.

Please try to add Multiple HeaderTexts in your PR via trx. "ME51N" ... Then the following behaviour should occur, mentioned in the KBA :

"It is also not possible for online transaction codes. When using transaction ME51N, if you try to insert a test for the second text id, system will clear it out. Only the Header Note B01 will be considered"

0
avatar image
Former Member Apr 28, 2017 at 10:57 AM
-1

Hi Kali,

try to set break point at FM : SAVE_TEXT and check some parameter input to FM, maybe you input wrong some data.

Thanks,

John

Show 3 Share
10 |10000 characters needed characters left characters exceeded

No no lot of posts are available, Like above problem, But no solution for above one.
Default behavior is like this, as per my knowledge.

0
Former Member
Kali Charan

Did you debug as i suggest ? and no error return after call FM save_text ?

Also call bapi commit if you are missing

0

I am calling commit.

0
Venkatramesh V Apr 29, 2017 at 04:53 AM
-1

Hi kali,

Try passing the text with the pr item in the structure PRITEMTEXT TYPE BAPIMEREQITEMTEXT.

Hope it helpful,

Regards,

Venkat.

Show 1 Share
10 |10000 characters needed characters left characters exceeded

I need at header not item level, Item level working fine. Ok correct me anything is wrong.

0