cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to change a report variable inside the sapscript

Former Member
0 Kudos

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.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

Former Member
0 Kudos

Hello,

Try to make out what ajay said and inside the include routine check for ex in your case,

If bukrs eq space.

Bukrs = 'xxxx' ( Assign the value as per your requirement).

endif.

If u still have doubts plz revert.

Thanks,

Joe

Former Member
0 Kudos

Hi

I tried with define and it does not work.Also the solutin from you meetjoe does not work.I think the only possible solution is using that perform that will call an external report.

I will try that now and see if it works

former_member585865
Contributor
0 Kudos

Hi Seba,

you can use perform in the sapscript and then you can achieve your scenario in program.

see example code below and modify according to your needs,


/:	 	PERFORM GET_PURORG_ADDRESS IN PROGRAM ZM_PURCHASE_ORDER-------->call this perform in sap script
/:	 	USING &EKKO-EKORG&
/:	 	CHANGING &V_EKORG&
/:	 	ENDPERFORM


FORM GET_PURORG_ADDRESS      TABLES in_par  STRUCTURE itcsy------------------>call this in program
                                      out_par STRUCTURE itcsy.

  DATA :V_compcode LIKE <tablename-fieldname>.   
if compcode is initial.
then assign here.
  IF v_compcode IS NOT INITIAL.
    out_par-value = v_compcode.
    out_par-name = 'V_COMPCODE'.
    MODIFY out_par INDEX 1.
  ENDIF.

Edited by: suresh suresh on Jul 30, 2009 11:15 AM

Former Member
0 Kudos

Hi,

Thanks for the answers ,it worked as ajay said,thanks again

Answers (2)

Answers (2)

former_member585060
Active Contributor
0 Kudos

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

Former Member
0 Kudos

Hi,

Yes you can change it. Try with capital letters

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

Regards

Krishna