cancel
Showing results for 
Search instead for 
Did you mean: 

overwrite symbol with value from database - sapscript

Former Member
0 Kudos

Hi,

I have a requirement to use a local symbol (defined in the sapscript). This works as I define the symbol to 0, however I then need to do a check to see if a field in SAP is blank - and if it isn't, then I need to output this value as the symbol.

Basically I need to update a symbol with the value from the database. I have initially written the code below and although it is entering the if statement correctly - it doesn't appear to update the value of the symbol....

Would appreciate any help - as I have spent some time searching but found no answers...


/:   DEFINE &CUSTOMER_NO& = '0'
/:   IF &VBAP-KDMAT& NE ''
/:   &CUSTOMER_NO& = &VBAP-KDMAT&
/:   ENDIF
/*
/*   WRITE OUT THE REST OF THE CODE WITH SYMBOL - IF 0 THEN KDMAT = ''
=    KDMAT=&CUSTOMER_NO&,,MATNR=&VBAP-MATNR&,,ARKTX=&VBAP-ARKTX&

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

You can write this logic in driver program as below. you can use &CUSTOMER_NO& symbol directly in script window.

IF VBAP-KDMAT  NE ''.
        V_VALUE  = VBAP-KDMAT.
      ENDIF.

      V_NAME = '&CUSTOMER_NO&'.

    CALL FUNCTION 'TEXT_SYMBOL_SETVALUE'
         EXPORTING
              NAME            = V_NAME
              VALUE           =  V_VALUE
*         VALUE_LENGTH    = 0
*         REPLACE_SYMBOLS = ' '
         EXCEPTIONS
              OTHERS          = 1.

Thanks,

Suma.