cancel
Showing results for 
Search instead for 
Did you mean: 

Display header note with condition

Former Member
0 Kudos

Hello everybody

In my standard smartform i have an include text with:

text name :&IS_BIL_INVOICE-HD_GEN-BIL_NUMBER&

text object :VBBK

text ID : 0002 " header note"

language :&CONTROL_PARAMETERS-LANGU&

My requirement is to display the text if and only if it contains a value.

So I have no idea on the field with which I have to test, like 'field # initial'.

thanks for your help

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Yeah ..READ_TEXT is only the solution for this prob...

Former Member
0 Kudos

yeah

but when i check the internal table 'IT_LINE', I don't have any value !!

brad_bohn
Active Contributor
0 Kudos

Because your code is bad...Did you read my comment?

Former Member
0 Kudos

Thanks Brad for your remark

In my smartform i passed the value via interface .!

you can offer another way to do it?

brad_bohn
Active Contributor
0 Kudos

I don't understand which 'value' you're referring to because you haven't been clear about what you've done or where that code is. I can only assume you're referring to the flag variable you created.

The value of 'NAME' in the READ_TEXT call in the code you posted is not valid. You hard-coded the document number but neglected to add the leading zeros. If in fact that invoice has text, you'll never get it. If it were me, I would put the entire logic in the smartform itself as I mentioned before - there's no need to change the standard invoice print program or use a custom print program when you can embed any needed logic in your invoice smartform design.

Former Member
0 Kudos

Thanks Brad .

Im talking about value of my text .!

I added this code to my printer program to get the value of the flag, so i will display the window if and only if the flag is not intial .

The real value of 'NAME' in the READ_TEXT is

NAME                    = CS_BIL_INVOICE-HD_GEN-BIL_NUMBER

I want separate my programming logic from my presentation,after debuging I found that the function module 'READ_TEXT' returns an empty table.

So I need to know what is the mistake I committed in the call of my function?!

Former Member
0 Kudos

Have you tried executing READ_TEXT in SE37 (with the values passed explicitly) to check the output ?

Former Member
0 Kudos

Yeah and i have 1 entries .

I think the problem stems from check of table STXH.

i will test this solution

Thaks Brad

brad_bohn
Active Contributor
0 Kudos

At least you have a variable in the function interface now. I don't recognize the structure though; the standard one is either IS_BIL_INVOICE or GS_HD_GEN. Perhaps that was a typo. If it still doesn't work, it's a simple thing to debug by putting a breakpoint in the function and comparing the values between the test workbench and your smartform call.

Former Member
0 Kudos

Yeah Brad

the standard struct is IS_BIL_INVOICE in the standard smartform ,baut im working in the print program where CS_BIL_INVOICE is the real name.

finally it worked, my code is below in my print program :

SELECT SINGLE TDOBJECT TDNAME TDID TDSPRAS FROM STXH
    INTO (STXH-TDOBJECT, STXH-TDNAME, STXH-TDID, STXH-TDSPRAS)
                                      WHERE TDOBJECT = 'VBBK'
                                      AND TDNAME = CS_BIL_INVOICE-HD_GEN-BIL_NUMBER
                                      AND TDID = '0002'
                                      AND TDSPRAS = SY-LANGU.
  CALL FUNCTION 'READ_TEXT'
    EXPORTING
      id                          = STXH-TDID
      language                = STXH-TDSPRAS
      name                     = STXH-TDNAME
      object                    = STXH-TDOBJECT
    TABLES
      lines                     = it_line
    EXCEPTIONS
      id                                  = 1
      language                        = 2
      name                            = 3
      not_found                      = 4
      object                           = 5
      reference_check            = 6
      wrong_access_to_archive = 7
      OTHERS                       = 8.


  LOOP AT it_line.
    IF it_line-tdline NE ''.
      c_text_flag = 'X'.
       ENDIF.
  ENDLOOP.

I passed the c_text_flag to the interface of my form

Thanks for your help

brad_bohn
Active Contributor
0 Kudos

Why do you need a condition for that?

Former Member
0 Kudos

if text has emply i am getting a line space in the forms . I need to chk condition in include text.

saying tath,if text has no value don't display in the smart forms . How to use this.

I need to add program lines, Read text using? and chek if text has no value?

brad_bohn
Active Contributor
0 Kudos

An empty include text does not produce an extra blank line in a MAIN window, even with the new paragraph or new line setting. You have another issue in your form definition I would guess.

Former Member
0 Kudos

Im traying this code but i dont have any value in 'IT_LINE'

DATA: IT_LINE    LIKE STANDARD TABLE OF TLINE INITIAL SIZE 0 WITH HEADER LINE,
       C_TEXTE_FLAG(1) type c    .


CALL FUNCTION 'READ_TEXT'
       EXPORTING
*          CLIENT                   = SY-MANDT
          ID                             = '0002'
          LANGUAGE             = SY-LANGU
          NAME                      = '90000042'
          OBJECT                  = 'VBBK'

     TABLES
          LINES                   = IT_LINE
     EXCEPTIONS
          ID                      = 1
          LANGUAGE                = 2
          NAME                    = 3
          NOT_FOUND               = 4
          OBJECT                  = 5
          REFERENCE_CHECK         = 6
          WRONG_ACCESS_TO_ARCHIVE = 7
          OTHERS                  = 8.

 LOOP AT IT_LINE.
    IF IT_LINE-TDLINE NE ''.
      C_TEXTE_FLAG = 'X'.
      ENDIF.
      CLEAR:  IT_LINE.

      ENDLOOP.

brad_bohn
Active Contributor
0 Kudos

Like I said before, you have some other issue in your design maybe. A blank line does not result if there's nothing maintained in the text object EXCEPT for explicitly entered blank lines. If this is your issue, then I would address it with the person or program that entered it. However, if you must, you need to set a GLOBAL variable in the smartform definition and set the value there in a code node.. Then use that variable on the condition tab.

By the way, hardcoding the value for the name doesn't work unless you actually use the correct value - I can see that you haven't just by looking at the length of your literal...