‎2010 Apr 15 1:03 PM
Hi GURUS,
Need your help, I wrote the below piece of code in my report program and I DINT GET ANY DATA IN "wa_it_ekpo"???
and there is no syntactical error when I execute the program pls help me get data into "wa_it_ekpo"..
LOOP AT it_lips into wa_it_lips.
MOVE-CORRESPONDING wa_it_lips TO wa_asnmain_ref.
SORT it_ekpo DESCENDING by ebeln ebelp .
READ TABLE it_ekpo INTO wa_it_ekpo WITH KEY ebeln = wa_it_lips-vgbel ebelp = wa_it_lips-vgpos .
MOVE-CORRESPONDING wa_it_ekpo TO wa_asnmain_ref.
*APPEND wa_it_ekpo to it_ekpo.
*MOVE-CORRESPONDING
*CONCATENATE wa_it_lips wa_it_ekpo INTO WA_ASNMAIN_ref.
*CLEAR wa_it_lips.
ENDLOOP.
Thanks,
Dep
‎2010 Apr 15 1:05 PM
‎2010 Apr 15 1:08 PM
‎2010 Apr 15 1:11 PM
Well it just means that the conditions specified in the READ statement doesnot match. Check in the debugging mode if the codition
ebeln = wa_it_lips-vgbel ebelp = wa_it_lips-vgpos is satisfied
‎2010 Apr 15 1:14 PM
Hi,
READ statement seems to be correct. Looks like a data problem. Check the values in the fields "wa_it_lips-vgbel" and "wa_it_lips-vgpos "
Regards
Vinod
‎2010 Apr 15 1:18 PM
Hi Vinod,
I debugged the program ther is data in the fields "wa_it_lips-vgbel" and "wa_it_lips-vgpos " but still there is no data being populated into wa_it_ekpo.
‎2010 Apr 15 1:17 PM
are you sure there is data in your IT_EKPO? i cant see any select.
‎2010 Apr 15 1:19 PM
Hi Florian,
There is data in IT_EKPO.
and I debugged the program ther is data in the fields "wa_it_lips-vgbel" and "wa_it_lips-vgpos " but still there is no data being populated into wa_it_ekpo.
‎2010 Apr 15 1:25 PM
ah ok so we most probably got a conversion error.
Check your data in your WA against the data in your table, may it be that EBELN hast some preceeding zeros in one case?
If that is the problem you can solve it by using following FM´s:
CONVERSION_EXIT_EBELN_INPUT
CONVERSION_EXIT_EBELN_OUTPUT
‎2010 Apr 15 1:34 PM
I call form populate_data passing value Suppose s_vbeln = u2018180000056u2019.
FORM populate_data USING val_vbeln.
s_vbeln = val_vbeln.
SELECT single likpVBELN likpTRMTYP likpLIFNR likpERNAM likp~BLDAT from likp
into (wa_ittab1-vbeln , wa_ittab1-trmtyp, wa_ittab1-lifnr, wa_ittab1-ernam, wa_ittab1-bldat ) where vbeln = s_vbeln.
APPEND wa_ittab1 to it_tab1.
SELECT single LIPSWERKS LIPSVGBEL FROM lips into (wa_ittab4-werks , wa_ittab4-vgbel) where lips~vbeln = s_vbeln.
APPEND wa_ittab4 to it_tab4.
SELECT SINGLE NAME1 FROM T001W INTO WA_ITTAB3-NAME1T WHERE T001W~WERKS = WA_ITTAB4-WERKS.
SELECT SINGLE BEDAT FROM EKKO INTO WA_ITTAB3-BEDAT WHERE EKKO~EBELN = WA_ITTAB4-VGBEL.
SELECT SINGLE NAME1 FROM LFA1 INTO WA_ITTAB3-NAME1 WHERE LFA1~LIFNR = WA_ITTAB1-LIFNR.
SELECT SINGLE ADRNR FROM EKPO INTO WA_ITTAB3-ADRNR WHERE EKPO~EBELN = WA_ITTAB4-VGBEL.
DATA it_ekpo_unf TYPE ekpo OCCURS 0.
DATA wa_it_ekpo_unf TYPE ekpo.
DATA it_ekpo TYPE ekpo OCCURS 0.
DATA wa_it_ekpo TYPE ekpo.
DATA it_lips_unf TYPE lips OCCURS 0.
DATA wa_it_lips_unf TYPE lips.
DATA it_lips TYPE lips OCCURS 0.
DATA wa_it_lips TYPE lips.
SELECT VGBEL VGPOS MATNR EAN11 ARKTX LGORT FROM lips INTO CORRESPONDING FIELDS OF TABLE it_lips_unf WHERE lips~vgbel = WA_ITTAB4-VGBEL.
LOOP AT it_lips_unf into wa_it_lips_unf.
SHIFT wa_it_lips_unf-vgpos LEFT DELETING LEADING '0'.
APPEND wa_it_lips_unf to it_lips.
ENDLOOP.
SELECT EBELN EBELP MENGE MEINS UMREZ FROM EKPO INTO CORRESPONDING FIELDS OF TABLE it_ekpo_unf WHERE ekpo~ebeln = WA_ITTAB4-VGBEL.
LOOP AT it_ekpo_unf into wa_it_ekpo_unf.
SHIFT wa_it_ekpo_unf-ebelp LEFT DELETING LEADING '0'.
APPEND wa_it_ekpo_unf to it_ekpo.
ENDLOOP.
LOOP AT it_lips into wa_it_lips.
MOVE-CORRESPONDING wa_it_lips TO wa_asnmain_ref.
SORT it_ekpo DESCENDING by ebeln ebelp .
READ TABLE it_ekpo INTO wa_it_ekpo WITH KEY ebeln = wa_it_lips-vgbel ebelp = wa_it_lips-vgpos .
MOVE-CORRESPONDING wa_it_ekpo TO wa_asnmain_ref.
ENDLOOP.
‎2010 Apr 15 7:32 PM
Hi,
compare the field size of ebeln = vgbel and ebelp = vgpos ( I don have system sap system with me so can't check), . your read statement is correct only problem may be with your key comparision
One tip beside your question. I saw in you code you are sorting inside loop, avoid doing this in future. It's a big performance issue if table is big.
‎2010 Apr 16 5:40 AM
Hi,
There is the data type mismatch betweeb ekpo-ebeln(numc6) and wa_it_lips-vgpos(numc5).
Try this solution.
define variable for and wa_it_lips-vgpos
data : m_vgpos type ebelp.
LOOP AT it_lips into wa_it_lips.
MOVE-CORRESPONDING wa_it_lips TO wa_asnmain_ref.
SORT it_ekpo DESCENDING by ebeln ebelp .
CALL FUNCTION 'CONVERSION_EXIT_NUMC1_INPUT'
EXPORTING
input = wa_it_lips-vgpos
IMPORTING
OUTPUT = m_vgpos
EXCEPTIONS
WRONG_INPUT = 1
OTHERS = 2.
READ TABLE it_ekpo INTO wa_it_ekpo WITH KEY ebeln = wa_it_lips-vgbel ebelp = m_vgpos.
MOVE-CORRESPONDING wa_it_ekpo TO wa_asnmain_ref.
ENDLOOP.Regards
Vinod
Edited by: Vinod Kumar on Apr 16, 2010 10:15 AM
‎2010 Apr 16 5:49 AM
After getting data into internal tables it_lips and it_ekpo I am reading data into it_ekpo for concerned(selected) records in
it_lips.
At database level
Table-Field Data Type Length
LIPS-VGBEL CHAR 10
LIPS-VGPOS NUMC 6
Table-Field Data Type Length
EKPO-EBELN CHAR 10
EKPO-EBELP NUMC 5
Because of above my inner join condition dint fetch records from Database. So , I fetched the records from DB into internal tables and removed leading zeros for LIPS-VGPOS and EKPO-EBELP fields in the internal tables.
Then I used :
READ TABLE it_ekpo INTO wa_it_ekpo WITH KEY ebeln = wa_it_lips-vgbel ebelp = wa_it_lips-vgpos .
Which was syntactically correct but in vain..no records fetched.
‎2010 Apr 16 6:05 AM
Hi Deepak,
Instead of removing the leading zero's in VGPOS & EBELP, try the conversion exit "'CONVERSION_EXIT_NUMC1_INPUT'". Refer to my previous Post.
Regards
Vinod
‎2010 Apr 16 12:35 PM
Hi Vinod,
I used conversion exit and issue has been resolved.
Thank You,
--Dep
‎2010 Apr 16 9:07 AM
Hi Dipak,
This is the code u have poted:------
LOOP AT it_lips into wa_it_lips.
MOVE-CORRESPONDING wa_it_lips TO wa_asnmain_ref.
SORT it_ekpo DESCENDING by ebeln ebelp .
READ TABLE it_ekpo INTO wa_it_ekpo WITH KEY ebeln = wa_it_lips-vgbel ebelp = wa_it_lips-vgpos .
MOVE-CORRESPONDING wa_it_ekpo TO wa_asnmain_ref.
*APPEND wa_it_ekpo to it_ekpo.
*MOVE-CORRESPONDING
*CONCATENATE wa_it_lips wa_it_ekpo INTO WA_ASNMAIN_ref.
*CLEAR wa_it_lips.
ENDLOOP.
Can you please try the below code and see the result.......
LOOP AT it_lips into wa_it_lips.
MOVE-CORRESPONDING wa_it_lips TO wa_asnmain_ref.
SORT it_ekpo DESCENDING by ebeln ebelp .
READ TABLE it_ekpo INTO wa_it_ekpo WITH KEY ebeln = wa_asnmain_ref-vgbel ebelp = wa_asnmain_ref-vgpos
binary search.
MOVE-CORRESPONDING wa_it_ekpo TO wa_asnmain_ref.
*APPEND wa_it_ekpo to it_ekpo.
*MOVE-CORRESPONDING
*CONCATENATE wa_it_lips wa_it_ekpo INTO WA_ASNMAIN_ref.
*CLEAR wa_it_lips.
ENDLOOP.
I think you should get your desired result...