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: 

Warning in SAPScript: parameters are not passed to my form

Former Member
0 Kudos

Hi,

I've just written some code in SAPScript (transaction SO10) which calls a form using PERFORM statement. However, my parameters are not passed to my form (I can check that while debugging) so the text printed out is blank. As soon as I arrive in the form, variables p_input and p_output are initial. Here's the code (I'm using a 4.7 version):

/: DEFINE &PERNR& = '00000004'

/: PERFORM GET_DRIVERS_LICENSE IN PROGRAM ZSD_APPLICANT_PROFILE

/: USING &PERNR&

/: CHANGING &PERMIS&

/: ENDPERFORM

/

/ Permis: &PERMIS&

The form I've written looks like this:

REPORT ZSD_APPLICANT_PROFILE .

FORM GET_DRIVERS_LICENSE TABLES p_input STRUCTURE ITCSY

p_output STRUCTURE ITCSY.

TABLES: PB9004.

DATA: lv_zperm TYPE zperm,

lv_pernr TYPE aplno,

lw_input LIKE ITCSY,

lw_output LIKE ITCSY.

READ TABLE p_input INTO lw_input WITH KEY NAME = 'PERNR'.

lv_pernr = lw_input-value.

SELECT SINGLE ZPERM FROM PB9004

INTO lv_zperm

WHERE pernr = lv_pernr.

lw_output-name = 'PERMIS'.

lw_output-value = lv_zperm.

APPEND lw_output TO p_output.

ENDFORM.

Any help would be greatly appreciated...

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Your code looks pretty good to me. The only thing I can remark, is that I usually don't type the tables in the form:

FORM <form_name> TABLES pt_using pt_changing.

Also, to get the return value, you should modify the output table, not append. The symbol should already be present in the output table.

Hope this helps,

Peter Glas

18 REPLIES 18

Former Member
0 Kudos

Hi,

Your code looks pretty good to me. The only thing I can remark, is that I usually don't type the tables in the form:

FORM <form_name> TABLES pt_using pt_changing.

Also, to get the return value, you should modify the output table, not append. The symbol should already be present in the output table.

Hope this helps,

Peter Glas

0 Kudos

Peter,

Thx for your answer. I removed the "STRUCTURE ITCSY" parts from the form definition but it still does not work...

For the "append" part, you're right but since I did not find anything in p_output, I used that method at first. I'll change this. Thx.

0 Kudos

Can you modify the printing program?

Have you tried to define &PERNR& in the global data of the printing program, assing the value and then call the form to see what happens?

0 Kudos

Ramiro,

Printing program is a standard one. I'm actually trying to create a customised "applicant short profile" in Recruitment module. I followed the steps in transaction SPRO (creating text in SO10 then changing feature SHPRO in transaction PE03). This worked until I wanted to add a specific field value into my form...

So I guess what you call "printing program" is in my case program RPAPL001.

Anyway, thx for your answer. Any other idea?

0 Kudos

Just a question, when you debug the form, there is an entry in p_output? or is it empty?

0 Kudos

In debug both p_input and p_output are initial (no entry)... Quite strange since before the "perform" is executed, &PERNR& is correctly replaced by my hardcoded value '00000004' and &PERMIS& is correctly replaced by a blank.

0 Kudos

Weird.

Have you tried to hardcode a value into Permis in the form to see if the sapscript prints something?

0 Kudos

Hi Julien,

I think your SAPScript part is fine.

The program called might have some differences as I develop them, check this:

FORM obtener_resolucion TABLES in_tab STRUCTURE itcsy out_tab
STRUCTURE itcsy.

 DATA:  l_resolucion LIKE zresolpedido-resol,
        l_fecha_nota LIKE zresolpedido-fecha,
        l_ebeln LIKE ekko-ebeln,
        l_fecha_str TYPE STRING.

  READ TABLE in_tab WITH KEY 'EKKO-EBELN'.
  IF sy-subrc = 0.
    l_ebeln = in_tab-value.
  ENDIF.

  Clear l_resolucion.
  SELECT SINGLE fecha resol INTO (l_fecha_nota,l_resolucion)
  FROM zresolpedido
  WHERE ebeln = l_ebeln.

  IF sy-subrc = 0.
    l_resolucion = 'X'.
  ENDIF.

  out_tab-value = l_resolucion.
  MODIFY out_tab TRANSPORTING value WHERE name = 'RESOLUCION'.

  CONCATENATE l_fecha_nota+6(2) '.' l_fecha_nota+4(2)
  '.' l_fecha_nota+0(4) INTO l_fecha_str.

  out_tab-value = l_fecha_str.
  MODIFY out_tab TRANSPORTING value WHERE name = 'FECHANOTA'.

ENDFORM.

Hope this example help you.

Regards,

Gilberto Li

Edited by: Gilberto Li on May 27, 2008 6:25 PM

0 Kudos

Is PERMIS defined either as global parameter in the print program or with DEFINE (like you did with PERNR)?

And one more thing to add, after lw_output-value = lv_zperm, probably the value is right justified in lw_output-value:

SHIFT lw_output-value LEFT DELETING LEADING space.

0 Kudos

I didn't try this but actually p_output is correctly filled in in the form. But as soon as it comes back to the calling program, it's empty... I think this is because the parameter is empty when calling the form whereas it should contain one line with 'PERMIS' as name...

0 Kudos

It is declared with define in SAPScript...

0 Kudos

It seems to be a problem in standard form cop_symbol in which variable pa_token is different from variable pa_tok_symbol... This produces a warning which makes that variables co_sym_changing and co_sym_using are initial in form co_endperform...

Anyone familiar with this?

JozsefSzikszai
Active Contributor
0 Kudos

hi Julien,

the output table has the line with 'PERMIS' by default (value is empty). This means you don't need to APPEND this line to the internal but you have to change it:

lw_output-name = 'PERMIS'.
lw_output-value = lv_zperm.
APPEND lw_output TO p_output.

replace the above with:

lw_output-value = lv_zperm.
MODIFY p_output FROM lw_output WHERE name EQ 'PERMIS' TRANSPORTING value.

hope this helps

ec

0 Kudos

OK Eric,

thx for the code. My problem is actually more that internal p_ouput is empty when the code is executed, whereas (as you just stated) it should contain one line with "PERMIS" in the "NAME" column. I cannot understand why this happens.

Former Member
0 Kudos

Hi,

Try this...

Give the declaration of p_output table at the beginnig of the report program ... i mean declare it globally and in your SAPscript try to print it as &p_output-name& instead of &permis&.

Reward if helpful.

Regards,

Syed

Former Member
0 Kudos

I am having the same problem.

Have you solved your issue?

Thanks,

Benoit

0 Kudos

No, problem is still not solved. If you ever find the solution, don't hesitate to let me know

0 Kudos

Hello,

I have loged a Customer message with SAP. I hope they will be able to help!

I will let you know if I get a solution!

Thank you,

Benoit