‎2016 Jul 06 5:01 PM
Dear all,
I'm having trouble passing a variable to my SAPScript. I can't get the values to pass. What am I doing wrong?
FORM read_zpm001 TABLES IN_TAB STRUCTURE ITCSY
OUT_TAB STRUCTURE ITCSY.
CALL FUNCTION 'CONVERSION_EXIT_TPLNR_OUTPUT'
EXPORTING
INPUT = CAUFVD-TPLNR
IMPORTING
OUTPUT = CAUFVD-TPLNR.
DATA lv_t TYPE TPLNR.
SELECT SINGLE TPLNR FROM ZPM001 INTO lv_t WHERE TPLNR EQ CAUFVD-TPLNR(14).
IF sy-subrc EQ 0.
READ TABLE OUT_TAB WITH KEY NAME = 'VAR1'.
OUT_TAB-value = lv_t.
MODIFY OUT_TAB INDEX SY-TABIX.
ENDIF.
ENDFORM.
SAPScript:
😕 PERFORM READ_ZPM001 IN PROGRAM ZRIPRJT00_READ_ZPM001F01 USING &VAR1&
😕 ENDPERFORM.
T6 <B2>&VAR1&</>
Thank you
‎2016 Jul 06 6:26 PM
Hello Tiago,
In your form you are using 'TABLES' when I think you should be using 'USING'.
Instead of passing the tables in your form parameter, you pass the field.
Regards,
Thales Schmidt
Message was edited by: Thales Schmidt
‎2016 Jul 06 7:06 PM
Hi
If you need to change the value VAR1, this has to be moved by option CHANGING and not USING in your sapscript
:/ PERFORM READ_ZPM001 IN PROGRAM ZRIPRJT00_READ_ZPM001F01 USING &VAR1&
:/ PERFORM READ_ZPM001 IN PROGRAM ZRIPRJT00_READ_ZPM001F01 CHANGING &VAR1&
:/ ENDPERFORM
In this way the sapscript variable VAR1 will be available in OUT_TAB table of your form:
FORM read_zpm001 TABLES IN_TAB STRUCTURE ITCSY
OUT_TAB STRUCTURE ITCSY.
READ TABLE OUT_TAB WITH KEY NAME = 'VAR1'.
IF SY-SUBRC = 0.
............................................................
Max
‎2016 Jul 06 7:08 PM
Are you saying that your print program value is not passing back to the form?
I see that you are modifying OUT_TAB in the program. But you only have a USING parameter in your Script. You don't have any CHANGING parameter to get the value back into the form.
Try do something like:
😕 PERFORM READ_ZPM001 IN PROGRAM 'ZRIPRJT00_READ_ZPM001F01'
USING &VAR1&
CHANGING &xxx&
😕 ENDPERFORM.
T6 <B2>&VAR1&</>
‎2016 Jul 07 11:30 AM
I tried all your suggestions with no success
Maybe I'm complicating things here.
I just need to make a validation on my printing program and then send an OK to my form.
This is what I'm validation:
SELECT SINGLE TPLNR FROM ZPM001 INTO lv_t WHERE TPLNR EQ CAUFVD-TPLNR(14).
If it finds a match, then I want to send an OK to my form. In this case, I want to send the actual value of lv_t.
Any simpler way of doing it?
‎2016 Jul 07 12:50 PM
Hi
What do you mean?
Do you need to raise a message or to avoid the print or something else (for example to print the validation)?
‎2016 Jul 07 12:55 PM
Hi Max,
If that SELECT returns a value, I want to print specific message on my form.
‎2016 Jul 07 1:06 PM
and remember you can fine a variable in the sapscript and set the value by a form:
:/ DEFINE &OK& = ' '
:/ PERFORM READ_ZPM001 IN PROGRAM ZRIPRJT00_READ_ZPM001F01 CHANGING &OK&
:/ ENDPERFORM
:/ IF &OK& = 'X'.
do something
:/ ELSE
:/ do something else
:/ ENDIF
‎2016 Jul 07 2:02 PM
‎2016 Jul 07 2:23 PM
Copied from: Help In SCript | SCN
Plagiarism is not tolerated in the forums. Any further instances of plagiarism will be reported to the TPTB and may lead to deletion of your user!
‎2016 Jul 07 2:34 PM
Hi Suhas,
I was giving reference to an example. If i had simply put that link, then that's also a violation or may lead to post deletion. What to do in that case?
‎2016 Jul 07 3:23 PM
Pranay Patel wrote:
I was giving reference to an example. If i had simply put that link, then that's also a violation or may lead to post deletion. What to do in that case?
That means the OP could have also found it if he had searched => you wanted to spoonfeed the OP, which btw is also an RoE violation
‎2016 Jul 07 2:50 PM
I set a break point on my printing program, inside the form read_zpm001 and it's not stoping there, which means I'm doing something wrong on the SAPscript:
/: PERFORM READ_ZPM001 IN PROGRAM ZRIPRJT00 CHANGING &OK&.
/: ENDPERFORM.
Any ideas?
Thank you all
‎2016 Jul 07 3:56 PM
Hi
USING and CHANGING parameters has to be indicated in an own command line
/: PERFORM READ_ZPM001 IN PROGRAM ZRIPRJT00 CHANGING &OK&.
/: PERFORM READ_ZPM001 IN PROGRAM ZRIPRJT00
/: CHANGING &OK&.
/: ENDPERFORM.
Max