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: 

COMPARING TIME FIELD FROM VBRK TABLE

former_member632991
Active Contributor
0 Kudos
253

HI I AM USING

FOLLOWING SELECT

SELECT VKVBELN VKXBLNR VKERZET VKERDAT

VPCHARG VPFKIMG VP~MATNR

INTO TABLE T_VBRK

FROM VBRK AS VK JOIN VBRP AS VP

ON VKVBELN = VPVBELN

WHERE VK~FKART = 'ZBFJ'

WHERE VK~ERZET GE VAR_TIME4

AND VK~ERZET LE VAR_TIME3

WHERE VK~ERDAT EQ VAR_DATE3

WHERE VK~ERDAT EQ VAR_DATE1

CONCATENATE VAR_TIME1(2) ':' VAR_TIME12(2) ':' VAR_TIME14(2) INTO

VAR_TIME3.

CONCATENATE VAR_TIME1(2) ':' VAR_MIN2 ':' VAR_TIME1+4(2) INTO

VAR_TIME4.

CONCATENATE VAR_DATE16(2) '.' VAR_DATE14(2) '.' VAR_DATE1(4) INTO

VAR_DATE3.

CONCATENATE VAR_DATE26(2) '.' VAR_DATE24(2) '.' VAR_DATE2(4) INTO

VAR_DATE4.

DATA IS THERE IN VBRK TABLE BUT IT IS NOT GETTING SELECTED

1 ACCEPTED SOLUTION

former_member2382
Active Participant
0 Kudos
144

I think the prb is with the multiple WHERE clauses that you written in the query. Can you adjust that into one WHERE clause and try to give the fields in order as in database table.

Regards,

parvez.

6 REPLIES 6

Former Member
0 Kudos
144

hi Sonika,

Check out whether the order of fields in the select statement is same as that of your internal table.

Regards,

Santosh

0 Kudos
144

INTERNAL TABLE HAS THE STR :

DATA : BEGIN OF T_VBRK OCCURS 0 ,

VBELN LIKE VBRK-VBELN,

XBLNR LIKE VBRK-VBELN, " changed to accomodate for all entries

ERZET LIKE VBRK-ERZET,

ERDAT LIKE VBRK-ERDAT,

CHARG LIKE VBRP-CHARG,

FKIMG LIKE VBRP-FKIMG,

MATNR LIKE VBRP-MATNR,

KUNNR LIKE LIKP-KUNNR,

END OF T_VBRK.

I THINK PROBLEM IS WITH THE DATA TYPE

COZ IN VBRK ERZET IS OF TYPE TIMS

BUT WE ARE TAKING IT OF CHAR TYPE IF WE TAKE IT OF TIMS TYPE THEN IT ALLOWS ONLY FOR LENGTH '6' WHILE IN VBRK OUTPUT LENGTH IS '8'

former_member2382
Active Participant
0 Kudos
145

I think the prb is with the multiple WHERE clauses that you written in the query. Can you adjust that into one WHERE clause and try to give the fields in order as in database table.

Regards,

parvez.

0 Kudos
144

SELECT VKVBELN VKXBLNR VKERZET VKERDAT

VPCHARG VPFKIMG VP~MATNR

INTO TABLE T_VBRK

FROM VBRK AS VK JOIN VBRP AS VP

ON VKVBELN = VPVBELN

WHERE VK~FKART = 'ZBFJ'

AND VK~ERZET GE VAR_TIME4

AND VK~ERZET LE VAR_TIME3

AND VK~ERDAT EQ VAR_DATE3

AND VK~ERDAT EQ VAR_DATE1

0 Kudos
144

try this way

SELECT VKVBELN VKXBLNR VKERZET VKERDAT

VPCHARG VPFKIMG VP~MATNR

INTO <b>CORRESPONDING FIELDS OF</b> TABLE T_VBRK

FROM VBRK AS VK JOIN VBRP AS VP

ON VKVBELN = VPVBELN

WHERE VK~FKART = 'ZBFJ'

AND VK~ERZET GE VAR_TIME4

AND VK~ERZET LE VAR_TIME3

AND VK~ERDAT EQ VAR_DATE3

AND VK~ERDAT EQ VAR_DATE1

0 Kudos
144

ALREADY TRIED