‎2011 Sep 08 8:10 PM
Hi all,
I am calling an external subroutine in my SAPscript. In this subroutine, I am using a simple select statement:
* get sales order number
SELECT vbelv posnv
FROM vbfa
INTO CORRESPONDING FIELDS OF TABLE it_so
WHERE vbeln = gv_deldoc
AND posnn = gv_posnr.
The problem is no data is being pulled into it_so. I have confirmed in VBFA (through SE16N) that data exists in the system so this isn't the problem. Are there restrictions with using selects in SAPscript?
Thanks,
Edited by: pistols123 on Sep 8, 2011 9:11 PM
‎2011 Sep 08 8:16 PM
Have you made sure that gv_deldoc has the leading zeros? Pass it through the conversion exit CONVERSION_EXIT_ALPHA_INPUT before doing the SELECT.
Rob
Edited by: Rob Burbank on Sep 8, 2011 3:17 PM
‎2011 Sep 08 8:16 PM
Have you made sure that gv_deldoc has the leading zeros? Pass it through the conversion exit CONVERSION_EXIT_ALPHA_INPUT before doing the SELECT.
Rob
Edited by: Rob Burbank on Sep 8, 2011 3:17 PM
‎2011 Sep 08 9:08 PM
Hi,
Please refer below code.
In SAP Script ,SE71: call the subroutine pool program with the below sysntax.
/: PERFORM GET_DATA IN PROGRAM ZXXXX
/: USING &XXXX-MATNR&
/: CHANGING &V_YYYY&
/: CHANGING &V_YYY2&
/: ENDPERFORM
Using Parameter will be the input in the subroutine pool to fetch the data.
Changing Paramter will be the your output to pass the data into SAP Form.
now goto SE38,and create a subroutine pool program with the name ZXXXX,follow the below code.
FORM get_data TABLES tbl_in STRUCTURE itcsy
tbl_out STRUCTURE itcsy.
READ TABLE tbl_in INDEX 1.
IF sy-subrc EQ 0.
XXXX-Matnr = tbl_in-value.
"Pass it through the conversion exit CONVERSION_EXIT_ALPHA_INPUT before SELECT."
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
input = gv_deldoc
IMPORTING
OUTPUT = gv_deldoc
SELECT vbelv posnv
FROM vbfa
INTO (l_vbelv,l_posnv)
WHERE vbeln = gv_deldoc
AND posnn = gv_posnr.
READ TABLE tbl_out INDEX 1.
IF sy-subrc = 0.
MOVE l_vbelv TO tbl_out-value.
MODIFY tbl_out INDEX 1.
ENDIF.
READ TABLE tbl_out INDEX 2.
IF sy-subrc = 0.
MOVE l_posnv TO tbl_out-value.
MODIFY tbl_out INDEX 2.
ENDIF.
Moderator message - Welcome to SCN. But please do not ask for "rewards"
Regards,
VSNM
Endform.
Edited by: Rob Burbank on Sep 8, 2011 4:18 PM