Application Development and Automation 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: 
Read only

External subroutine code

Former Member
0 Likes
1,337

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

12 REPLIES 12
Read only

Former Member
0 Likes
1,310

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

Read only

0 Likes
1,310

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

Read only

0 Likes
1,310

hi Mona,

check  modify OUTTAB index SY-TABIX .

check if structure is getting modified or not.If not modifying the add transporting VALUE.

Read only

0 Likes
1,310

Thanks Sai,

How do I "check  modify OUTTAB index SY-TABIX ".

What would be the code for it.

mona

Read only

0 Likes
1,310

I mean to say is check ITCSY structure is value updated in it or not.If not updated try to change Modify statement.

Read only

Former Member
0 Likes
1,310

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

Read only

0 Likes
1,310

Thanks Athreya,

how do i check if d data exists in the table kna1.

mona

Read only

0 Likes
1,310

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

Read only

0 Likes
1,310

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

Read only

0 Likes
1,310

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

Read only

0 Likes
1,310

THANKS ,

does not work . no padding zeroes also .

mona

Read only

0 Likes
1,310

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