Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

not able to pass work area data to sap script

Former Member
0 Kudos

Hi gurus,

I have to pass some work area data to sap script , i have checked in debug mode also i am not able to see any value in sap script debug mode.

Below is the sample code.

data : wa_track type tp_track.
loop at it_track into wa_track.
perform set_trkid using '&VHILM_KU&' wa_track-VHILM_KU.
endloop.

form SET_TRKID using  VHILM_KU VHILM_KU1.
data : wa_track type tp_track.

loop at it_track into wa_track.


VHILM_KU1 = wa_track-VHILM_KU.

endloop.

endform.                    " SET_TRKID

attached is the code where i am paasing the internal table data

Script code is shown below

MG   &WGBEZ+0(30)&

MG   &WGBEZ+30(30)&

/:   ENDIF.

CP    TRACKING ID:

RF    &VHILM_KU&

CP    &VHILM_KU1&

MG    &VHILM_KU1&

MG    &VHILM_KU&

please help it is bit urgent.

1 ACCEPTED SOLUTION

arindam_m
Active Contributor
0 Kudos

Hi,

Try to do change editor and try inserting the Text Symbols via Insert->Symbols->Text Symbols.

Cheers,

Arindam

7 REPLIES 7

Former Member
0 Kudos

Ravi,

You are looping at it_track and then calling the perform set_trkid. So for all entries in the loop this routine will get called. So why are you looping again inside the perform?

loop at it_track into wa_track.

perform set_trkid using wa_track-VHILM_KU.

                              changing VHILM_KU.  * do not use &

endloop.

form SET_TRKID using  VHILM_KU VHILM_KU1.
data : wa_track type tp_track.

loop at it_track into wa_track.


VHILM_KU1 = wa_track-VHILM_KU.

endloop.

endform.                    " SET_TRKID

Hope this works.

Thanks,

Vikram.M

0 Kudos

ok but i am not able to pass the value of VHILM_KU1 in sap script i tried with all possibilities

0 Kudos

i did the same way vikram, but not able to pass it to sap script

Former Member
0 Kudos

hello,

I guess if I understood your issue correctly you are passing values from a program(include with subroutine) to sapscript.

If so here is an example of how to do that

http://wiki.sdn.sap.com/wiki/display/ABAP/Subroutines+And+Their+Use+In+SAPScript

Check this link and it gives good example of how to do that. I htink your issue is you are passing the values correctly but not reading them correctly in the sapscript.

best regards,

swanand

Former Member
0 Kudos

Hi

you have to use below function.,To pass data to script .

call function 'WRITE_FORM' .


arindam_m
Active Contributor
0 Kudos

Hi,

Try to do change editor and try inserting the Text Symbols via Insert->Symbols->Text Symbols.

Cheers,

Arindam

Former Member
0 Kudos

i did it my self, Thank you guys for your answers.

below is the process where i passed internal table data to script window

read table it_track into wa_track with key vbelv = it_lips-vbeln.
perform set_trkid using '&VHILM_KU&' wa_track-VHILM_KU.

   PERFORM write_form

*call window

   PERFORM z_write_form USING 'MATGRP' 'BODY' 'MATGRP'

**********************FORM CODE*********************

form SET_TRKID using  col_name col_value.
data : wa_track type tp_track.

  CALL FUNCTION 'TEXT_SYMBOL_SETVALUE'
       EXPORTING
            name            = col_name
            value           = col_value
*         VALUE_LENGTH    = 0
*         REPLACE_SYMBOLS = ' '
   EXCEPTIONS
              OTHERS          = 1.

endform.                    " SET_TRKID

   FORM z_write_form USING    p_windowelement TYPE c
                           p_type TYPE c
                           p_window TYPE c.

  CALL FUNCTION 'WRITE_FORM'
      EXPORTING
           element                  = p_windowelement
           function                 = 'SET'
           type                     = p_type
           window                   = p_window
*    IMPORTING
*         PENDING_LINES            =
      EXCEPTIONS
           element                  = 1
           function                 = 2
           type                     = 3
           unopened                 = 4
           unstarted                = 5
           window                   = 6
           bad_pageformat_for_print = 7
           OTHERS                   = 8.

*           clear d_subtotal.
ENDFORM.                    " Z_WRITE_FORM.........

***********************SCRIPT CODE***********************

MG   &WGBEZ+0(30)&

MG   &WGBEZ+30(30)&

/:   ENDIF.

/*   Begin of insert by ravi kumar on 06.05.2013

RF    Shipper Name :&VTEXT&

RF    Tracking ID     :&VHILM_KU+0(35)&

/*   End of insert by ravi kumar on 06.05.2013