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: 

Reg: fetching the data from the table

Former Member
0 Kudos
219

Hi friends,

i want to take the field value RESWK from the table EKKO by linking

the field of EBELN from the table VIQMEL.

i am going to take the print out by using the tcode QM15 using standard program RQQMRB01 (Non Confirmation Report: NCR )

In that print out i want to display supplying plant for a STO order.

i didnt get any QM table which will have supplying plant data.

so, i am going to take the supplying plant field by linking EKKO and VIQMEL table in script.

In driver program of this script (RQQMRB01),EKKO table is not used.

so, i cant move EBELN value from VIQMEL table to EKKO table in the script.

my query:

/: IF &VIQMEL-EBELN+0(2)& EQ '66'.

/: &EKKO-EBELN& EQ &VIQMEL-EBELN&

/: ENDIF.

While debugging the script, i am getting message 'Text command &EKKO-EBELN& is not defined'

Once i get the value of EBELN from VIQMEL to EKKO,then only i can fetch the field RESWK.

So, how can i fetch the field value of a table which is not mentioned in the driver program of the script.

Thenks & Regards,

Sakthivel.VT

1 ACCEPTED SOLUTION

satyajit_mohapatra
Active Contributor
0 Kudos
136

The sapscript will identify only those variables which have been declared in the driver program. As described, the EKKO table has not been declared in your driver program, it's not possible to use it directly. Also, passing the EBELN value to EKKO only will not help and you have to query the table as well in the driver program.

1. Decalre EKKO in your driver program. Write a query to fetch the row for the VIQMEL-EBELN from EKKO. Now, you can use the EKKO-RESWK value as &EKKO-RESWK& in your script.

2. If your driver program is a standard one, use PERFORM-ENDPERFORM statement in the sapscript to get the RESWK value.


/:  DEFINE &RESWK& := ' '
/:  PERFORM F_GET_RESWK IN PROGRAM Z_TEST
/:  USING &VIQMEL-EBELN&
/:  CHANGING &RESWK&
/:  ENDPERFORM

Now, write a subrouitne F_GET_RESWK in subroutine pool Z_TEST to get the RESWK value using a query.

5 REPLIES 5

Former Member
0 Kudos
136

Hello

Change your query as:


/: IF &VIQMEL-EBELN+0(2)& EQ '66'
/: &EKKO-EBELN& = &VIQMEL-EBELN&
/: ENDIF

0 Kudos
136

HI,

STILL I AM GETTING THE SAME ERROR.

THE PROBLEM IS , THE TABLE EKKO IS NOT MENTIONED IN THE DRIVER PROGRAM.

SO HOW CAN I FETCH THE VALUE WHEN A TABLE NAME IS NOT USED IN DRIVER PROGRAM OF THE SCRIPT?

ERROR : Text command &EKKO-EBELN& is not defined

REGRADS,

SAKTHIVEL.VT

Former Member
0 Kudos
136

hi,

Check the below two options.

1. change the PF from /: to any PF format.

2.U can try using PERFORM statment in script. Put your logic in one 'Z' include.

Regards

harris

Former Member
0 Kudos
136

Hi Sakthivel.VT,

did you try this one?

/: IF &VIQMEL-EBELN+0(2)& EQ '66' and

  • &EKKO-EBELN& = &VIQMEL-EBELN&

/: ENDIF.

Regards,

Raghava Channooru.

satyajit_mohapatra
Active Contributor
0 Kudos
137

The sapscript will identify only those variables which have been declared in the driver program. As described, the EKKO table has not been declared in your driver program, it's not possible to use it directly. Also, passing the EBELN value to EKKO only will not help and you have to query the table as well in the driver program.

1. Decalre EKKO in your driver program. Write a query to fetch the row for the VIQMEL-EBELN from EKKO. Now, you can use the EKKO-RESWK value as &EKKO-RESWK& in your script.

2. If your driver program is a standard one, use PERFORM-ENDPERFORM statement in the sapscript to get the RESWK value.


/:  DEFINE &RESWK& := ' '
/:  PERFORM F_GET_RESWK IN PROGRAM Z_TEST
/:  USING &VIQMEL-EBELN&
/:  CHANGING &RESWK&
/:  ENDPERFORM

Now, write a subrouitne F_GET_RESWK in subroutine pool Z_TEST to get the RESWK value using a query.