cancel
Showing results for 
Search instead for 
Did you mean: 

Use of BAdI /SAPSLL_CUHD_PROP for text fields

Former Member
0 Kudos

Hello together,

I have to create a data proposal for text fields on custom document header. Therefor I found thread that worked great! Problem here for us is, that the text field in the data proposal can only take 100 characters, that´s too small for our needs.

Therefor I thought to just insert a "code" including a text-id and text-name from SO10. With this I thought in a BAdI implementation of /SAPSLL_CUHD_PROP I can manipulate the data proposal, read with the "code" from data proposal my text out of SO10 and then populate that text in the target field of the custom document header.

Anyway, I get stucked with the step of implementing the BAdI. I cannot find the text fields there in the data structures? Is this correct? How are you using the BAdI /SAPSLL_CUHD_PROP, maybe you have an example?

Any other suggestions how to achieve to get default text data (~500 digits) (based on FTO) into my custom document header is appreciated!

Thanks, Tobias

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member215181
Active Contributor
0 Kudos

Hi Tobias,

Maybe we could help in other directions if you could explain WHY you need a long text defaulted?  It's unusual for a Customs Declaration to need any such long text, so I guess it's for a purpose unconnected with the submission of a Declaration.

Regards,

Dave

Former Member
0 Kudos

Hi Dave,

yes, you´re right that the text is not needed for the submission of the declaration.

Background is, that we print the EUR.1 document for some customs documents. Now, due to our business, we need additional text on the back side of this print out. This text varies for the FTO the custom declaration is created, on top the user has even to change some of the text before printing.

That´s why I tried the followin approach:

I created an additional print message that is connected to a smartform. In this smart form we then want to read the text from header level of the custom document.

In the customs document, I want, based on FTO, propose the related text already in the text field, The user can change it if needed and after that execute my connected print message (on communication tab) and the text is read out of the custom document directly in the smartform.

Any other suggestions for sure are welcome!

Tobias

thomasrausch
Active Participant
0 Kudos

Hello Tobias,

you must do your programming in the Methode ITEM_DATA_PROPOSE and the text are find in the structure CS_ITEM: cs_item-iwtxt. Here you have 240 digits.

I added some coding that we use to built up a detailed Description of Goods

Hope that helps a little

Regards,

Thomas

Former Member
0 Kudos

Hi Thomas,

thanks a lot for your very quick answer! With your coding I got a better feeling, how to use the BAdI.

Anyway, using cs_item-iwtxt is the wrong field for us. That´s the custom relevant material description. But I´m really talking about the text on text-tab on header level, where free text can be entered as desired.

No idea how to solve that request.

Tobias

thomasrausch
Active Participant
0 Kudos

Hello Tobias,

okay, then take a look at the FM READ_TEXT, SAVE_TEXT or the program SAPLSTXD - SAPscript program interface 1. Here you find all the FMs that deals with texts in the SAP Systems. Maybe you want to get a Standard text created with SO10. Use READ_TEXT with the Import parameters

 

                 CLIENT                     500

                 ID                              ST

                 LANGUAGE             EN

                 NAME                       ZTEST

                OBJECT                   TEXT

                ARCHIVE_HANDLE                  0

                LOCAL_CAT

you get the text back to the table LINES. If you want to save the text, use FM SAVE_TEXT. But this is a bit more complicated. Read the documentation of the FMs and you get an idea of ​​how they works.

I've added an example for storing sales text in the material master data.

You find the relevant data in the tables STXH and STXL e.g. for a standardtext

STXH : 500 TEXT ZTEST ST EN 731 RAUSCH 29.10.2015 07:03:05 731 RAUSCH 29.10.2015 07:03:05 SYSTEM 3

STXL : 500 TX TEXT ZTEST ST EN 0 176 FF06020102028000343130330000000087030000121F9D028C998F81818191074830B0326001210C3E0C9E0C7E0CAE0C6B212A57818559C01423C73A88E03EA8

Hope this helps

Regards,

Thomas

Former Member
0 Kudos

Hi Thomas,

thanks again. Good idea, but then one final question, maybe you know. In the implementation of BAdI /SAPSLL/CUHD_PROP there is by standard no access to the data proposals entered in the master data? There I can only manipulate the data proposal with data created or read during the BAdI execution?

Tobias

thomasrausch
Active Participant
0 Kudos

Hello Tobias,

in principle, that's right. But with the SAP word processing that is such a thing. I have tried it out in the method ITEM_DATA_PROPOSE  and read a standard text. It worked. Here is the coding

Define

DATA : lt_header  TYPE thead,

             lt_tex        TYPE TABLE OF tline.

TRY.    

CALL FUNCTION 'READ_TEXT'      

     EXPORTING         

          client                  = sy-mandt         

          id                      = 'ST'         

          language                = 'E'         

          name                    = 'ZTEST'        

          object                  = 'TEXT'

*          archive_handle          = 0

*          local_cat               = ' '

*        IMPORTING

*          header                  = l_header

*         OLD_LINE_COUNTER        =      

     TABLES        

          lines                   = lt_text       

     EXCEPTIONS         

          id                      = 1         

          language                = 2         

          name                    = 3         

          not_found               = 4         

          object                  = 5         

          reference_check         = 6        

          wrong_access_to_archive = 7         

          OTHERS                  = 8.    

IF sy-subrc <> 0.

* Implement suitable error handling here    

ENDIF.  

CATCH cx_root.

ENDTRY.

The table LT_TEXT contains

LINE  TDFORMAT(C2)         TDLINE(C132)

  1              *                           Dies ist ein Test

  2              *                           Für einen Standardtext

  3              *                           Der könnte auslesen werden

In your place I would now try to save the text with the FM SAVE_TEXT in your document.

Good luck

Regards,

Thomas

Former Member
0 Kudos

Hi Thomas,

OK, that´s fine. But I had something different in mind. In the BAdI there is no access to the data I maintained in the data proposal master data? Or? With your example you are reading text from standard text repository, but I would first like to fetch data from the GTS data proposals (because based on this different text from standard text repository should be read).

Thanks for your efforts!

thomasrausch
Active Participant
0 Kudos

Hello Tobias,

what kind of data or text do you like to read?

Regards,

Thomas

former_member215181
Active Contributor
0 Kudos

Hi Tobias,

The DP data is not immediately available in the BAdI, but you can retrieve it from the database - table /SAPSLL/DPDATA.  Of course, the table keys depend on your configuration, so you have to be careful in case of later changes.

Regards,

Dave

Former Member
0 Kudos

Hi,

so, Dave thanks, that clarified that I got the BAdI right and have to take care reading DP data on my own.

Thomas, with data proposal I already can insert some text (based on FTO etc.) in the header text of my customs document. But as there is a limitation of 100 chars for that data proposal text, I have to replace that data proposal text with a standard text (in that BAdI).

That´s why. Maybe a really specific request, but with your infos I think I can get it run, although more coding is needed than I hoped.

Thanks a lot, Tobias