ā2013 Apr 22 11:50 AM
Hello,
I am writing external subroutine for the script RVORDER01 to pass the value in the field KNA1-STCD1.
my script code is
/:PERFORM GET_VAL IN PROGRAM Y_RVOR
/:USING &KNA1-KUNNR&
/:CHANGING &NEWFIELD&
/:ENDPERFORM
I created subroutine using se38 and the code is
PROGRAM Y__RVOR.
FORM GET_VAL TABLES INTAB STRUCTURE ITCSY
OUTTAB STRUCTURE ITCSY.
DATA : V_STCD1 TYPE KNA1-STCD1.
read table INTAB with key NAME = 'KNA1-KUNNR'.
if sy-subrc = 0.
SELECT SINGLE STCD1
FROM KNA1 INTO (V_STCD1)
WHERE KUNNR = INTAB-VALUE.
if sy-subrc = 0.
read table OUTTAB with key NAME = 'NEWFIELD'.
if sy-subrc = 0.
OUTTAB-VALUE = V_STCD1.
modify OUTTAB index SY-TABIX .
endif.
endif.
endif.
ENDFORM.
The field is not printed . Please help
MOna
ā2013 Apr 22 12:27 PM
hi,
The coding is fine i am not finding check.Check is there any data for field STCD1 in KNA1.
http://help.sap.com/saphelp_40b/helpdata/ru/d1/803279454211d189710000e8322d00/content.htm
ā2013 Apr 22 12:30 PM
Thanks for the reply.
In this sapscript , all data is coming from VBDKA . Table KNA1 is not defined in the program .
But for the customer , value exist in customer master data i.e. kna1-stcd1(tax number 1).
When i debugg i get ?????? .
Not sure why?
Mona
ā2013 Apr 22 12:39 PM
hi Mona,
check modify OUTTAB index SY-TABIX .
check if structure is getting modified or not.If not modifying the add transporting VALUE.
ā2013 Apr 22 12:47 PM
Thanks Sai,
How do I "check modify OUTTAB index SY-TABIX ".
What would be the code for it.
mona
ā2013 Apr 22 1:37 PM
I mean to say is check ITCSY structure is value updated in it or not.If not updated try to change Modify statement.
ā2013 Apr 22 12:30 PM
Hi Mona,
The coding part looks good. Have you checked if the required data exists in the table KNA1 for the selection being made?
Also, try with copying data of KNA1-KUNNR to a variable and passing it to the form. Do the required variable name changes in the form also.
Hope this helps,
~Athreya
ā2013 Apr 22 12:48 PM
Thanks Athreya,
how do i check if d data exists in the table kna1.
mona
ā2013 Apr 22 1:02 PM
Hi,
Keep a break-point in zprogram and see the values in table INTAB .
Check if value exists against KNA1-KUNNR. if no value is coming, pass VBDKA-KUNNR instead of KNA1-KUNNR and change the program accordingly
I think script should be like this:
/:PERFORM GET_VAL IN PROGRAM Y_RVOR
/:USING &VBDKA-KUNNR&
/:CHANGING &NEWFIELD&
/:ENDPERFORM
Regards,
Swarna
ā2013 Apr 22 1:12 PM
Thanks Swarna,
Tried changing KNA1 to VBDKA , does not work .
Though VBDKA-KUNNR gets filled with the value of the customer number , but nothing more than that.
Mona
ā2013 Apr 22 1:22 PM
Hi,
Did you do the changes in program as well?
read table INTAB with key NAME = 'VBKD-KUNNR'.
Also check if kunnr value is coming with padding zeros. If not you may need to use conversion function module to change the value and then use it in select.
CONVERSION_EXIT_ALPHA_INPUT
Regards,
Swarna
ā2013 Apr 22 1:30 PM
ā2013 Apr 23 7:10 AM
Hi,
Did you try passing customer number with padding zeroes also. Go in debugging mode and check whether select statement is successful or not. After that, cehck if modify statement is working or not.
Also can you share your code after using FM CONVERSION_EXIT_ALPHA_INPUT.
Regards,
Swarna