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

report

Former Member
0 Likes
486

Dear all ,

Please have look at this code..

SELECT * FROM likp

INTO CORRESPONDING FIELDS OF TABLE itlikp

WHERE vstel IN s_vstel

AND lfart IN ('NLCC','ZCAX')

AND wadat IN s_wadat

AND werks IN s_werks.

IF sy-subrc IS INITIAL.

SELECT ebeln ebelp budat xblnr dmbtr bwart bewtp FROM ekbe

INTO CORRESPONDING FIELDS OF TABLE it_ekbe

FOR ALL ENTRIES IN itlikp

WHERE xblnr = itlikp-vbeln

AND budat IN s_wa_ist

AND bewtp = 'U'.

AND xblnr IN s_xblnr.

endif.

SELECT * FROM lips

INTO CORRESPONDING FIELDS OF TABLE itlips

FOR ALL ENTRIES IN itlikp

WHERE vbeln = itlikp-vbeln

AND matnr IN s_matnr.

ENDFORM. "get_data

here i am connecting three tables..

likp ekbe and lips..

first i compared likp and ekbe table ...but ekbe xblnr and vbeln is not matching...means length is missmatching , then i changed the length of vbeln field in internal table itlikp..

now when i am comparing itlikp and itlips here length is missmatching....

means

itlips vbeln = 10

itlikp vbeln = 16 this i have changed to match to xblnr..

please tell me how to overcome this prob

4 REPLIES 4
Read only

Former Member
0 Likes
463

Hi

Use a JOIN beetween LIKP and LIPS, so u can load the data of the both table by only one select, or don't use FOR ALL ENTRIES option.

Max

Read only

Former Member
0 Likes
463

u can do like that..

first u fetch tha data from likp then lips by pasiing the delviery(vbeln)

then u fatch tha data from ekbe where xblnr = lips-vgbel.

( in lips table vgbel is the ref. document same as the xblnr ref. doc.)

thanks

Read only

Former Member
0 Likes
463

Hi

if that 2 fileds length is diffrent then in for all entries it won't accet you

so do one thing i had the same req

follw this method you will succed

declare 2 internal table of same type

TYPES : BEGIN OF ST_HRP1001,

OTYPE TYPE HRP1001-OTYPE,

OBJID TYPE HRP1001-OBJID,

RELAT type hrp1001-RELAT,

BEGDA TYPE HRP1001-BEGDA,

ENDDA TYPE HRP1001-ENDDA,

SCLAS TYPE HRP1001-SCLAS,

SOBID TYPE HRP1001-SOBID,

END OF ST_HRP1001.

TYPES : BEGIN OF ST_SOBID,

OTYPE TYPE HRP1001-OTYPE,

OBJID TYPE HRP1001-OBJID,

RELAT type hrp1001-OBJID,

BEGDA TYPE HRP1001-BEGDA,

ENDDA TYPE HRP1001-ENDDA,

SCLAS TYPE HRP1001-SCLAS,

SOBID TYPE HRP1001-OBJID,

END OF ST_SOBID.

TYPES : BEGIN OF ST_HRP1026,

OTYPE TYPE HRP1026-OTYPE,

OBJID TYPE HRP1001-OBJID,

AEDTM TYPE HRP1026-AEDTM,

UNAME TYPE HRP1026-UNAME,

DELET TYPE HRP1026-DELET,

CANCR TYPE HRP1026-CANCR,

END OF ST_HRP1026.

DATA : IT_HRP1001 TYPE STANDARD TABLE OF ST_HRP1001. "DATA FROM HRP1001 TABLE

DATA : WA_HRP1001 TYPE ST_HRP1001.

DATA : IT_SOBID TYPE STANDARD TABLE OF ST_SOBID. " TO CHANGE THE SOBID OF HRP1001 TO OBJID OF HRP1026

DATA : WA_SOBID TYPE ST_SOBID.

DATA : IT_HRP1026 TYPE STANDARD TABLE OF ST_HRP1026. "DATA FROM HRP1026 TABLE

DATA : WA_HRP1026 TYPE ST_HRP1026.

START-OF-SELECTION.

SELECT OTYPE

OBJID

RELAT

BEGDA

ENDDA

SCLAS

SOBID FROM HRP1001 INTO TABLE IT_HRP1001

WHERE OTYPE = 'D'

AND OBJID IN S_OBJID

AND BEGDA GE DATE-LOW

AND ENDDA LE DATE-HIGH

AND ( SCLAS = 'E' OR SCLAS = 'ET' ).

IF SY-SUBRC NE 0.

MESSAGE 'NO RECORD FOUND FOR THE GIVEN SELECTION CRITERIA ' TYPE 'E'.

ENDIF.

LOOP AT IT_HRP1001 INTO WA_HRP1001.

WA_SOBID-OTYPE = WA_HRP1001-OTYPE.

WA_SOBID-OBJID = WA_HRP1001-OBJID.

WA_SOBID-RELAT = WA_HRP1001-RELAT.

WA_SOBID-BEGDA = WA_HRP1001-BEGDA.

WA_SOBID-ENDDA = WA_HRP1001-ENDDA.

WA_SOBID-SCLAS = WA_HRP1001-SCLAS.

WA_SOBID-SOBID = WA_HRP1001-SOBID.

APPEND WA_SOBID TO IT_SOBID.

ENDLOOP.

SELECT OTYPE

OBJID

AEDTM

UNAME

DELET

CANCR

  • NCONT

FROM HRP1026

INTO TABLE IT_HRP1026

FOR ALL ENTRIES IN IT_SOBID

WHERE OBJID = IT_SOBID-SOBID

AND ( OTYPE = 'E' OR OTYPE = 'ET' )

AND DELET = 'X' AND

BEGDA GE DATE-LOW AND

ENDDA LE DATE-HIGH.

in the above example i need to maintain OBJID and SOBID with the same length both are same but SOBID is18 char and OBJID is 8 NUM

so for that i had declared 2 internal table of same type and in second table i had declared SOBID as OBJID

and i had moved my 1st internal table data into second one

from second internal table that SOBID value is OBJID

Read only

0 Likes
463

if you have any doubts let me know