Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Check out 1s plz....

in this sode .... it_t001w is getting data but......while looping down side its not moving from 1 table to another table ........from it_too1w to top.plz check out 1s .....if ti is ther any mistake say plz......

SELECTION-SCREEN : BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

SELECT-OPTIONS: P_WERKS for T001W-WERKS ."OBLIGATORY VALUE CHECK.

SELECT-OPTIONS: S_VBELN FOR LIKP-VBELN OBLIGATORY.

SELECTION-SCREEN: END OF BLOCK B1.

START-OF-SELECTION.

PERFORM FILL_LIKP.

&----


*& Form FILL_LIKP

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM FILL_LIKP .

SELECT VBELN

ERDAT

KUNNR

FROM LIKP

INTO TABLE IT_LIKP

WHERE VBELN IN S_VBELN.

                • IF INPUT IS INN-CORRECT ****************************

IF SY-SUBRC NE 0.

IF S_VBELN-HIGH NE SPACE.

MESSAGE S000 WITH 'NO DELIVERY CHALLAN No. FOUND FOR'

S_VBELN-LOW 'TO' S_VBELN-HIGH.

SUBMIT ZTM_GATEPASS VIA SELECTION-SCREEN.

ELSE.

MESSAGE s000 WITH 'NO DELIVERY CHALLAN No. FOUND FOR '

S_VBELN-LOW.

SUBMIT ZTM_GATEPASS VIA SELECTION-SCREEN.

ENDIF.

ENDIF.

******************************************************************

IF IT_LIKP[] IS NOT INITIAL.

SELECT

VBELN

POSNR

MATNR

WERKS

LFIMG

ARKTX

FROM LIPS

INTO CORRESPONDING FIELDS OF TABLE IT_LIPS

FOR ALL ENTRIES IN IT_LIKP

WHERE VBELN = IT_LIKP-VBELN."and

  • werks = it_t001w-werks.

IF NOT IT_LIPS[] IS INITIAL.

IT_LIPS2[] = IT_LIPS[].

SORT IT_LIPS2 BY VBELN.

DELETE ADJACENT DUPLICATES FROM IT_LIPS2 COMPARING VBELN.

SELECT

VBELN

POSNR

TRIP_NO

FROM ZITMD

INTO TABLE IT_ITMD

FOR ALL ENTRIES IN IT_LIPS

WHERE VBELN = IT_LIPS-VBELN AND

posnr = it_lips-posnr.

IF IT_ITMD[] IS NOT INITIAL.

SELECT

TRAID

EQUNR

NAME

FROM ZITM

INTO TABLE IT_ITM

FOR ALL ENTRIES IN IT_ITMD

WHERE TRAID = IT_ITMD-TRIP_NO.

ENDIF.

ENDIF.

it_likp2[] = it_likp[].

sort it_likp2 by vbeln.

delete ADJACENT DUPLICATES from it_likp2 COMPARING kunnr.

SELECT

KUNNR

NAME1

FROM KNA1

INTO TABLE IT_KNA1

FOR ALL ENTRIES IN IT_LIKP2

WHERE KUNNR = IT_LIKP2-KUNNR AND

  • werks in p_werks.

werks = it_lips-werks.

Refresh it_likp2.

                      • IF P_WERKS HAS NO INPUT ************

if p_werks eq space.

  • it_likp2[] = it_likp[].

*

  • sort it_likp2 by werks.

*

  • delete ADJACENT DUPLICATES FROM it_likp2 COMPARING werks.

SELECT

werks

stras

pstlz

ort01

adrnr

FROM T001W

INTO TABLE IT_T001W

for all entries in it_lips

WHERE werks = it_lips-werks.

IF IT_T001W[] IS NOT INITIAL.

SELECT

ADDRNUMBER

TEL_NUMBER

FAX_NUMBER

FROM ADRC

INTO TABLE IT_ADRC

FOR ALL ENTRIES IN IT_T001W

WHERE ADDRNUMBER = IT_T001W-ADRNR.

ENDIF.

ELSE.

SELECT WERKS

STRAS

PSTLZ

ORT01

ADRNR

FROM T001W

INTO CORRESPONDING FIELDS OF TABLE IT_T001W

WHERE WERKS IN P_WERKS AND

SPRAS = 'EN'.

IF IT_T001W[] IS NOT INITIAL.

SELECT

ADDRNUMBER

TEL_NUMBER

FAX_NUMBER

FROM ADRC

INTO CORRESPONDING FIELDS OF TABLE IT_ADRC

FOR ALL ENTRIES IN IT_T001W

WHERE ADDRNUMBER = IT_T001W-ADRNR.

ENDIF.

refresh it_likp2.

ENDIF.

ENDIF.

perform loop_zgp_top.

perform loop_it_items.

ENDFORM. " FILL_LIPS

&----


*& Form loop_zgp_top

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM loop_zgp_top.

loop at it_likp.

move it_likp-vbeln to top-vbeln.

move it_likp-erdat to top-erdat.

move it_likp-kunnr to top-kunnr.

  • read table it_lips with key vbeln = it_likp-vbeln.

*

  • top-vbeln1 = it_lips-vbeln.

  • top-matnr = it_lips-matnr.

  • top-lfimg = it_lips-lfimg.

  • top-arktx = it_lips-arktx.

read table it_itmd with key vbeln = it_likp-vbeln.

top-vbeln1 = it_itmd-vbeln.

top-trip_no = it_itmd-trip_no.

read table it_itm with key traid = it_itmd-trip_no.

top-traid = it_itm-traid.

top-equnr = it_itm-equnr.

top-name = it_itm-name.

read table it_kna1 with key kunnr = it_likp-kunnr

  • WERKS = P_WERKS.

werks = it_lips-werks.

top-kunnr1 = it_kna1-kunnr.

top-name1 = it_kna1-name1.

  • IT_LIkp2[] = IT_LIkp[].

*

  • SORT IT_LIkp2 BY WERKS.

*

  • DELETE ADJACENT DUPLICATES FROM IT_LIkp2 COMPARING WERKS.

read table it_t001w with key werks = p_werks

SPRAS = 'EN'.

top-werks = it_t001w-werks.

top-stras = it_t001w-stras.

top-pstlz = it_t001w-pstlz.

top-ort01 = it_t001w-ort01.

top-adrnr = it_t001w-adrnr.

REFRESH IT_LIPS2.

read table it_adrc with key addrnumber = it_t001w-adrnr.

top-addrnumber = it_adrc-addrnumber.

top-tel_number = it_adrc-tel_number.

top-fax_number = it_adrc-fax_number.

append top.

clear : it_likp, it_t001w ,it_adrc , it_itm,it_kna1.

endloop.

ENDFORM. " loop_zgp_top

&----


*& Form loop_it_items

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM loop_it_items .

loop at it_lips.

move it_lips-vbeln to body-vbeln.

move it_lips-matnr to body-matnr.

move it_lips-lfimg to body-lfimg.

move it_lips-arktx to body-arktx.

append body.

clear body.

endloop.

ENDFORM. " loop_it_items

END-OF-SELECTION.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

FORMNAME = 'ZS_GATE_PASS'

  • VARIANT = ' '

  • DIRECT_CALL = ' '

IMPORTING

FM_NAME = FM_NAME

  • EXCEPTIONS

  • NO_FORM = 1

  • NO_FUNCTION_MODULE = 2

  • OTHERS = 3

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

DESCRIBE table top lines total.

CALL FUNCTION FM_NAME

EXPORTING

  • MAIL_SENDER =

  • OUTPUT_OPTIONS =

  • USER_SETTINGS = 'X'

TOTAL = total

  • IMPORTING

  • DOCUMENT_OUTPUT_INFO =

  • JOB_OUTPUT_INFO =

  • JOB_OUTPUT_OPTIONS =

TABLES

TOP = top

BODY = body.

Former Member
Not what you were looking for? View more on this topic or Ask a question