Skip to Content
avatar image
Former Member

Is it possible to change a report variable inside the sapscript

Hi

I have to adapt a sapscript and i need a certain value for a variable.

For ex ekko-bukrs is empty in the report and i want to change it in the sapscript and give it a value

i tried the next:

/: define &ekko-bukrs& = '0001' but it did not work

Is it possible to change this variable in sapscript?

I cannot change the report since it is sap standard.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Jul 29, 2009 at 06:47 PM

    Hi Seba,

    Writing &ekko-bukrs& = '0001' in script is not all advisable as it is Hard coding which is not a Good programming practice.

    And as your driver program is a standard one so you have limitations. Moreover you can use the PERFORM command to call an ABAP subroutine (form) from any customized program. You can fetch the value from the routine and use it.

    Code will look like in the sript:

    /: PERFORM GET_BUKRS IN PROGRAM ZCJPERFO

    /: USING &PAGE&

    /: CHANGING &EKKO-BUKRS&

    /: ENDPERFORM

    REPORT QCJPERFO.

    Form routine in the customize program.

    FORM GET_BARCODE TABLES IN_PAR STUCTURE ITCSY

    OUT_PAR STRUCTURE ITCSY.

    <body>

    ENDFORM

    Get back in case of doubts.

    Cheers

    Ajay

    Edited by: ajay prak on Jul 29, 2009 8:51 PM

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 29, 2009 at 06:14 PM

    Hi,

    Yes you can change it. Try with capital letters

    /: DEFINE &EKKO-BUKRS& = '0001'.

    Regards

    Krishna

    Add comment
    10|10000 characters needed characters exceeded

  • Jul 30, 2009 at 07:20 AM

    Hi,

    Try with below code.

    /: PERFORM get_comp IN PROGRAM Z_bukrs
    /: USING &EKKO-EBELN&
    /: CHANGING &EKKO-BUKRS&
    /: ENDPERFORM
    
    
    FORM get_comp TABLES in_tab STRUCTURE itcsy
    out_tab STRUCTURE itcsy.
    
      DATA : wa_bukrs TYPE bukrs.
    
      READ TABLE out_tab INDEX 1.
      wa_bukrs = out_tab-value.
    
       IF wa_bukrs IS INITIAL.
    
        wa_bukrs = '0001'.
    
       ENDIF.
    
        READ TABLE out_tab INDEX 1.
        MOVE wa_bukrs TO out_tab-value.
        MODIFY out_tab INDEX sy-tabix.
    
        ENDFORM.                    "get_comp

    Regards

    Bala Krishna

    Edited by: Bala Krishna on Jul 30, 2009 12:58 PM

    We should read out_tab value.

    Edited by: Bala Krishna on Jul 30, 2009 12:59 PM

    Add comment
    10|10000 characters needed characters exceeded