2007 Sep 26 5:57 AM
Hi experts
I have used this query in my PAI module.
I have value on the field zrecpt-vbeln
first query is working, but second query is not working,
it returns the value sy-subrc = 4.
Can anyone help me, whats the mistake with second query and how to correct.
CHAIN .
FIELD : zrecpt-zrno.
MODULE vali_zrno ON CHAIN-INPUT.
ENDCHAIN.
MODULE vali_zrno INPUT.
if zrecpt-zrno is not initial.
select single * from zrecpt
where zrno = zrecpt-zrno.
endif.
select single vbeln kunnr from vbak
into (vbak-vbeln , vbak-kunnr)
where vbeln = zrecpt-vbeln.
ENDMODULE.
Thanks in advance.
Regards
Rajaram
2007 Sep 26 6:08 AM
Hi Rajaram ,
Please check the value of zrecpt-vbeln , it should be of length 10 , if it is not of length 10 then predeed it with 0 .
This can be done using the UNPACK command , use the follwing statement before the select statement
<b>UNPACK zrecpt-vbeln TO zrecpt-vbeln.</b>
Regards
Arun
Hi Rajaram ,
Please check the value of zrecpt-vbeln , it should be of length 10 , if it is not of length 10 then predeed it with 0 .
This can be done using the UNPACK command , use the follwing statement before the select statement
<b>UNPACK zrecpt-vbeln TO zrecpt-vbeln.</b>
Regards
Arun
2007 Sep 26 6:00 AM
Hi raja Ram,
select single vbeln kunnr from vbak
into (vbak-vbeln , vbak-kunnr)
where vbeln = zrecpt-vbeln.
ENDMODULE
Here <b>vbak-vbeln vbak-kunnr</b> - you have to Internal table field names.
Thanks,
Reward If Helpful.
2007 Sep 26 6:01 AM
try to save the data of variable zrecpt-vbeln in one global variable and then try for query,,,ok
reward points if useful.....
2007 Sep 26 6:02 AM
CHAIN .
FIELD : zrecpt-zrno.
MODULE vali_zrno ON CHAIN-INPUT.
ENDCHAIN.
MODULE vali_zrno INPUT.
DATA : WA_ZRECPT LIKE ZRECPT.
select single * from zrecpt INTO WA_ZRECPT
where zrno = zrecpt-zrno.
endif.
endif.
select single vbeln kunnr from vbak
into (vbak-vbeln , vbak-kunnr)
where vbeln = WA_zrecpt-vbeln.
ENDMODULE.
REWARD IF USEFUL.
aMIT sINGLA
2007 Sep 26 6:04 AM
Check my comment below -
MODULE vali_zrno INPUT.
if zrecpt-zrno is not initial.
select single * from zrecpt
where zrno = zrecpt-zrno.
<b>Here check if the select is working fine by checking SY-SUBRC</b>
<b>if sy-subrc eq 0.</b>
select single vbeln kunnr from vbak
into (vbak-vbeln , vbak-kunnr)
where vbeln = zrecpt-vbeln.
<b>Check in VBAK if there is an record with VBELN = ZRECPT-VBELN.</b>
endif.
endif.
ENDMODULE.
You can keep a break point in the code and check if SELECTs are working fine.
BTW is ZRECPT-VBELN is present on the screen too?
2007 Sep 26 6:08 AM
Hi Rajaram ,
Please check the value of zrecpt-vbeln , it should be of length 10 , if it is not of length 10 then predeed it with 0 .
This can be done using the UNPACK command , use the follwing statement before the select statement
<b>UNPACK zrecpt-vbeln TO zrecpt-vbeln.</b>
Regards
Arun
2007 Sep 26 6:25 AM
Its really great yar, working fine by your suggestion.
whats the use of UNPACK command,
why we go for this, even length of both fields are equal.
Thanks for everyone who have helped me.
Regards
Rajaram
2007 Sep 26 6:27 AM
Hi Rajaram ,
The purpose of Unpack command is to preced a varaible with zeros , please see the help of it for more info.
If you select the data form the database and assign it to the varaible it will work fine , but i feel you are getting it as a user input , since the user enteres it without 0's so the same value is passed on to the varaible , the legth of the varaible has nothing to do with it , that is one reason why we have the concepr of conversion exits , which converts data into input and output formats.
Regards
Arun
2007 Sep 26 6:33 AM
Hi Raja Ram,
If ur variable is of type C and size 10 and the value of that variable is 3456.
when u display it it will come by 3456.
but if u use unpack var to var.
then the value will be 0000003456.
Thanks,
Reward If Helpful.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |