Skip to Content

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

where condition in double loop problem.

In my LOOP where codition is not working....

even then I tried IF condtion ....which is not working ? Why ?

It says gs_solto-edi_tr_par is unknown.

HELP ME.

LOOP AT gt_soldto INTO gs_soldto.

LOOP AT gt_bstnk_storeno_kunnr

INTO wa_bstnk_storeno_kunnr

    • WHERE edi_tr_par = gs_solto-edi_tr_par* .

IF wa_bstnk_storeno_kunnr-edi_tr_par = gs_solto-edi_tr_par.

gs_bstnk_storeno_kunnr1-edi_tr_par = wa_bstnk_storeno_kunnr-edi_tr_par.

Below is my realted code:

=======================================

TYPES : BEGIN OF t_bstnk_storeno_kunnr,

edi_tr_par(16) TYPE c,

brd_idfr TYPE vkorg, " Brand Identifier

po_no TYPE bstnk, " PO number

sap_cust_no TYPE kunag, " SAP Customer

store_no TYPE kunnr, " Store number

dept TYPE j_3adepm, " Department

END OF t_bstnk_storeno_kunnr.

*For internal table gt_soldto to capture from zadi_869_870_sta table.

TYPES: BEGIN OF t_soldto,

mandt TYPE mandt,

edi_tr_par(16) TYPE c, " EDI TRADING RTNER

sales_org TYPE vkorg,

sold_to TYPE kunnr,

END OF t_soldto.

DATA : gs_bstnk_storeno_kunnr1 TYPE t_bstnk_storeno_kunnr,

gs_soldto like line of gt_soldto,

gt_bstnk_storeno_kunnr1 TYPE TABLE OF t_bstnk_storeno_kunnr.

LOOP AT gt_soldto INTO  gs_soldto.
    LOOP AT gt_bstnk_storeno_kunnr
            INTO wa_bstnk_storeno_kunnr
*            WHERE edi_tr_par = gs_solto-edi_tr_par
            .
      IF wa_bstnk_storeno_kunnr-edi_tr_par = gs_solto-edi_tr_par.

gs_bstnk_storeno_kunnr1-edi_tr_par = wa_bstnk_storeno_kunnr-edi_tr_par.

gs_bstnk_storeno_kunnr1-brd_idfr = wa_bstnk_storeno_kunnr-brd_idfr.

gs_bstnk_storeno_kunnr1-po_no = wa_bstnk_storeno_kunnr-po_no.

gs_bstnk_storeno_kunnr1-sap_cust_no = gs_soldto-sold_to.

gs_bstnk_storeno_kunnr1-store_no = wa_bstnk_storeno_kunnr-store_no.

gs_bstnk_storeno_kunnr1-dept = wa_bstnk_storeno_kunnr-dept.

APPEND gs_bstnk_storeno_kunnr1 TO gt_bstnk_storeno_kunnr1.

CLEAR : gs_bstnk_storeno_kunnr1 .

ENDIF .

ENDLOOP.

CLEAR : wa_soldto.

ENDLOOP.

Tags:
replied
WHERE edi_tr_par = gs_solto-edi_tr_par

should be

WHERE edi_tr_par = gs_soldto-edi_tr_par

See the difference?

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question